General RGSS/RGSS2/RGSS3 Help

Started by G_G, March 04, 2009, 12:14:28 am

Previous topic - Next topic

fugibo

Quote from: samsonite789 on September 29, 2009, 02:07:10 am
I've tried to use that, but it doesn't seem to work.

If I put it below RTAB 1.6 (which I am using) and I go into battle and use the Regen skill, it returns this error:

Script 'Real Time Active Battle' line 2671: NoMethodError occurred.
undefined method 'each' for 686:Fixnum

And when I go into the script editor, it points me to this method:

Spoiler: ShowHide

#--------------------------------------------------------------------------
  # * Remaining HP estimate
  #--------------------------------------------------------------------------
  def rest_hp
    # Substituting reality HP to rest_hp
    rest_hp = @hp
    # All damage which the battler receives is made to reflect on rest_hp
    for pre_damage in @damage
      if pre_damage[1].is_a?(Numeric)
        rest_hp -= pre_damage[1]
      end
    end
    return rest_hp
  end


I'm not sure where 'each' is or what to do about it, really.  So, I tried putting the HoT DoT script above RTAB, and I go into battle and it works, with one strange exception: no matter what I specify in the HoT DoT database, the spell consistently deals about 200 points of damage over time.  I tried changing the positives and negatives, the damage numbers and the type of damage and it always will deal 200 points every turn or so.  I'm thinking that something in RTAB is overriding its functionality partially so that it's getting mixed signals, but I have no idea what to do about it.

Any thoughts?


Your problem is that HoT DoT is specifying @damage as a number, while RTAB requires an array. I'm not sure how to fix it off the top of my head, but if you'll look at some of the RTAB compatibility code in Blizzard's Tons of Add-Ons I'm sure you'll find what you need.

samsonite789

QuoteYour problem is that HoT DoT is specifying @damage as a number, while RTAB requires an array. I'm not sure how to fix it off the top of my head, but if you'll look at some of the RTAB compatibility code in Blizzard's Tons of Add-Ons I'm sure you'll find what you need.


What RTAB compatibility code are you referring to?  I looked in Tons of Addons and didn't find anything that seemed like that specifically.  Come to think of it, another one of my big gripes is that Tons of Addons is not working well with RTAB.  The only way I can get it to avoid that stupid "wrong arguments (2 for 1)" error is to put the scripts above RTAB.  The problem, though, is that then RTAB overwrites all of the goodies that Tons of Addons provides. 

Any thoughtses?

Blizzard

Well, Tons does have compatibility code for RTAB included so it should go below.
The compatibility code mostly includes things like method definitions with the battler parameter that is usually used in RTAB. That's what he meant. This usually gets rid of the argument error.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

fugibo

Quote from: Blizzard on September 29, 2009, 02:11:32 pm
Well, Tons does have compatibility code for RTAB included so it should go below.
The compatibility code mostly includes things like method definitions with the battler parameter that is usually used in RTAB. That's what he meant. This usually gets rid of the argument error.


Exactly what I meant.

Blizzard

I know. It wasn't just that clear from your post. xD
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

samsonite789

But when I put it below RTAB, it still gives me the arguments error.  Is there a specific block of code I should be activating having to do with RTAB compatibility?

P.S.  Thanks for the help so far.  Much appreciated.

Blizzard

No, there isn't. Which line is giving the error?
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

samsonite789

When I place Tons of Addons below RTAB, soon after I go into battle it gives me the following error message:

Script 'Real Time Active Battle' line 1683: ArgumentError occurred
wrong number of arguments (1 for 0)

The script it refers to is the following method in the massive Scene_Battle class of the RTAB script:
Spoiler: ShowHide

def update_phase4_step2(battler)
    # If it is not forced action
    unless battler.current_action.forcing
      # When restriction [ the enemy is attacked ] [ friend attacks ] usually usually
      if battler.restriction == 2 or battler.restriction == 3
        # Setting attack to action
        battler.current_action.kind = 0
        battler.current_action.basic = 0
      end
    end
    # It diverges with classification of action
    case battler.current_action.kind
    when 0  # Basis
      if fin?
        battler.phase = 6
        return
      end
      make_basic_action_result(battler)
    when 1  # Skill
      if fin? and $data_skills[battler.current_action.skill_id].scope == 1..2
        battler.phase = 6
        return
      end
      make_skill_action_result(battler)  <-----  **THIS LINE**
    when 2  # Item
      if fin? and $data_items[battler.current_action.item_id].scope == 1..2
        battler.phase = 6
        return
      end
      make_item_action_result(battler)
    end
    if battler.phase == 2
      # It moves to step 3
      battler.phase = 3
    end
  end


I'm befuzzled...

On a side note, I have another simpler question about RGSS if'n ya don't mind.  How would one call a check to see if an actor has learned a certain skill?  Something like $game_data.skill_learned? or something like that...I'm trying to fix up one of my scripts to add a check to see if an actor has learned the skill and I'm not sure how to call it.

Thanks!

Blizzard

October 03, 2009, 07:14:41 am #268 Last Edit: October 03, 2009, 10:49:07 am by Blizzard
"$game_actors[ID].skill_learn?" is the call.

I'll take a look at that RTAB problem later.

EDIT: Fixed. Get the newest version of Tons. It was G_G's HP Consuming Skills. I forgot to make the script compatible with RTAB. Now it should be fine.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

wait was the error in the script my fault? If so sorry :(

Anyways question, is it possible to have rmxp load a script from a text file and run it? Like say I have this text file just for example and its got a config in it like so
module GameGuy
  Stuff = "Blah"
end


Now would it be possible to make one of the script slots load that text file and run it? This goes back to what I was asking blizz whether how to load rxdata through c# and reading and writing so seeing my friend is lazy....he like wants a config for everything so anyways instead of actually using c# to read and write I use it instead to generate this code that rmxp loads into a script that makes the rxdata.

So I just wanted to know if thats possible or not. So hopefully it is and I know its probably a stupid idea to be doing it like this but I want to experiment and stuff.

samsonite789

Thank you so much for all your help!  I'll try it out as soon as I can get back home.  One question, though...is there any specific place I should download the latest version of Tons from?  I assume it's from the stickied post in these forums, but I just thought I'd ask.

Thanks again!

fugibo

Quote from: game_guy on October 04, 2009, 11:32:21 am
wait was the error in the script my fault? If so sorry :(

Anyways question, is it possible to have rmxp load a script from a text file and run it? Like say I have this text file just for example and its got a config in it like so
module GameGuy
  Stuff = "Blah"
end


Now would it be possible to make one of the script slots load that text file and run it? This goes back to what I was asking blizz whether how to load rxdata through c# and reading and writing so seeing my friend is lazy....he like wants a config for everything so anyways instead of actually using c# to read and write I use it instead to generate this code that rmxp loads into a script that makes the rxdata.

So I just wanted to know if thats possible or not. So hopefully it is and I know its probably a stupid idea to be doing it like this but I want to experiment and stuff.


Yep, you'd use

require File.expand_path 'script_name.rb'

samsonite789

I tried the new Tons of Addons, and it's got several more error messages it's giving me...

When I put it below RTAB and everything else now, as soon as I attack something in battle, it gives me the following:

Script 'Tons of Addons 2' Line 3814: ArgumentError occurred
wrong number of arguments (0 for 1)

I checked out that section of the code - it's the skill separation section.  So I tried blocking out that chunk of code with =begin and =end to see if that was causing the problem.  When I did that and attacked something, it gave me the following:

Script 'Real Time Active Battle' line 2772: ArgumentError occurred
wrong number of arguments(2 for 1)

That is this sections of RTAB:
Spoiler: ShowHide

#--------------------------------------------------------------------------
  # * Effective application of normality attack
  #     attacker : Attack person (battler)
  #--------------------------------------------------------------------------
  def attack_effect(attacker)
    # Clearing the critical flag
    self.critical[attacker] = false
    state_p[attacker] = []
    state_m[attacker] = []
    # First on-target hit decision
    hit_result = (rand(100) < attacker.hit)
    # In case of on-target hit
    hit_result = true
    if hit_result == true
      # Calculating the basic damage
      atk = [attacker.atk - self.pdef / 2, 0].max
      self.damage[attacker] = atk * (20 + attacker.str) / 20
      # Attribute correction
      self.damage[attacker] *= elements_correct(attacker.element_set)
      self.damage[attacker] /= 100
      # When the mark of the damage is correct,
      if self.damage[attacker] > 0
        # Critical correction
        if rand(100) < 4 * attacker.dex / self.agi
          self.damage[attacker] *= 2
          self.critical[attacker] = true
        end
        # Defense correction
        if self.guarding?
          self.damage[attacker] /= 2
        end
      end
      # Dispersion
      if self.damage[attacker].abs > 0
        amp = [self.damage[attacker].abs * 15 / 100, 1].max
        self.damage[attacker] += rand(amp+1) + rand(amp+1) - amp
      end
      # Second on-target hit decision
      eva = 8 * self.agi / attacker.dex + self.eva
      hit = self.damage[attacker] < 0 ? 100 : 100 - eva
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
    end
    # In case of on-target hit
    if hit_result == true
      # State shocking cancellation
      remove_states_shock
      # From HP damage subtraction
      # State change
      @state_changed = false
      states_plus(attacker, attacker.plus_state_set) <---- THIS LINE
      states_minus(attacker, attacker.minus_state_set)
    # In case of miss
    else
      # Setting "Miss" to the damage
      self.damage[attacker] = "Miss"
      # Clearing the critical flag
      self.critical[attacker] = false
    end
    # Method end
    return true
  end



Any thoughts?

Blizzard

October 05, 2009, 02:13:43 pm #273 Last Edit: October 05, 2009, 03:08:23 pm by Blizzard
I'll look into it when I'm back from dinner.

EDIT: Fixed. BTW, you can post bugs about Tons in the Tons thread. :P

EDIT: Wait. Something else is wrong.

EDIT: Ok, done
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

samsonite789

Rock on.  Thanks, man.  I will post in the Tons sticky in the future.  In fact, I just did because I found another bug.  Computers suck.

And thank you for all your help.  You are very helpful.

samsonite789

Question:

How do I detect player/event collision through a script call?

I have a little dilemma. I'm making an enemy detection system using a view range script. Right now, I've got it set up so that the first event page for an enemy is a parallel process in which they are constantly scanning to see if the player is within range via a script call - when they are, a self switch goes on and they chase the player down, etc., etc. However, there's a little problem: the few times I've tested it where the enemies DON'T see me, I can walk right up behind them and into them but nothing happens. Obviously, whether or not the enemy sees the player or not, I want a battle to start when the player touches the enemy. However, I can't do this simply by making an 'Event Touch' condition for battle processing because I need a parallel process to check for when the enemy DOES see the player.

So, all that rambling preamble is to this question: Is there a way to make a script call that will detect whether or not a player is in collision with an event? If I could use a conditional branch on the first parallel process page, that would bypass the problem completely.

Thanks!

Blizzard

$game_player.passable?(X, Y, DIRECTION)


Direction is 2, 4, 6 or 8 for down, left, right or up respectively. Also, this checks for general passability, not just for collision detection with events.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

C.C. rOyAl

k i got a question. in RGSS do you have to put things in order?
Spoiler: ShowHide

winkio


C.C. rOyAl

ok to be more specific

Say i  want to make a CMS, would i have to define the class Scene_Menu before i defined The Status screen?
Spoiler: ShowHide