Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: Jragyn on September 21, 2008, 05:19:41 am

Title: [rmXP]HP Absorb failure. Not even Tons works. :(
Post by: Jragyn on September 21, 2008, 05:19:41 am
I don't understand why this is /fail ing!?



# HP Absorbption Skills 
# by RPG Advocate


# Sample code used for an 'absorb' common event:
#
#   absorb = $game_temp.damage_hook * -1
#   $scene.active_battler.damage = absorb
#   $scene.active_battler.damage_pop=true
#   $scene.active_battler.hp -= absorb

#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
#  Refer to "$game_temp" for the instance of this class.
#==============================================================================
class Game_Temp
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :damage_hook              # damage hook
  attr_accessor :damage_pop
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias has_initialize initialize
  def initialize
    # Original call
    has_initialize
    # Initialize damage hook
    @damage_hook = 0
  end
end



#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass for the Game_Actor
#  and Game_Enemy classes.
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # * Apply Skill Effects
  #     user  : the one using skills (battler)
  #     skill : skill
  #--------------------------------------------------------------------------
  alias has_skill_effect skill_effect
  def skill_effect(user, skill, dilute = 1)
    # Original call
    effective = has_skill_effect(user, skill)
    # Set hook to damage
    if self.damage.is_a?(Numeric)
      $game_temp.damage_hook += self.damage
    end
    # End Method
    return effective   
  end
end 
 

 
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader :active_battler
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 1 : action preparation)
  #--------------------------------------------------------------------------
  alias has_up4s1 update_phase4_step1
  def update_phase4_step1
    # Reset damage hook
    $game_temp.damage_hook = 0
    # Original call
    has_up4s1
  end
end


This spews out an error with RTAB, in regards to line 1577.

QuoteRTAB script line 1577, Arguement Error occured.
Wrong number of arguements (1 for 0).


And that points to this:

    case battler.phase
    when 1
      update_phase4_step1(battler)  # <---------- I be the problemed line, yo!
    when 2
      update_phase4_step2(battler)
    when 3
      update_phase4_step3(battler)
    when 4
      update_phase4_step4(battler)
    when 5
      update_phase4_step5(battler)
    when 6
      update_phase4_step6(battler)
    end


This code seems to function via comment eventing, drawing our attention to this:

Quote#   absorb = $game_temp.damage_hook * -1
#   $scene.active_battler.damage = absorb
#   $scene.active_battler.damage_pop=true
#   $scene.active_battler.hp -= absorb


which is simply inserted into a comment event, and then attatching the comment to occur when you use the skill. Now this works just dandy with the default battle system, but RTAB has a problem with it.

I remember I think it was namckor that said something about RTAB not having 'active_battler's...so I figured, why not change all 'active_battler' to 'battler' !

Now it says this:

QuoteNoMethodError occurred while running script.
undefined method 'battler' for #<Scene_Battle:0x3453300>.


This script seems pretty straightforward and it bothers me that it just doesn't seem to cooperate with RTAB. I even tried to cut out the aspect where it messes with phase4, and it still has a problem with 'battler'. I'm just not sure what to do with it.

I tried TON's absorb hp/sp thing, and it always pops up this error.

QuoteNameError occurred while running script.
uninitialized constant Interpreter::Scene_Battle.


Which also baffles me. I don't even know where to start with that.

Any ideas?
Title: Re: [rmXP]HP Absorb failure. Not even Tons works. :(
Post by: Blizzard on September 22, 2008, 08:59:05 am
O_O I will look into that problem with Tons' HP/SP Absorb. It actually doesn't make any sense. But if you are getting an error, there could be a bug. Can you just tell me exactly when the error happens?