Help - Search - Members - Calendar
Full Version: Access to the 'level' parameter in BattlerBase?
RPG RPG Revolution Forums > Scripting > Script Development and Support
Twin Matrix
I want to use custom formulas for the basic parameters of HP, MP, etc.
I downloaded Yanfly Engine Ace - Extra Param Formulas v1.00, but it is not actually meant for these basic parameters and I am running into some issues. This is the code:

CODE
class Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # mass alias methods
  #--------------------------------------------------------------------------
  alias_param = ["mhp"]
  alias_param.each { |param|
  aStr = %Q(
  alias game_battlerbase_#{param}_epf #{param}
  def #{param}
    base_#{param} = game_battlerbase_#{param}_epf
    n = eval(YEA::XPARAM::FORMULA[:#{param}_n_value])
    return eval(YEA::XPARAM::FORMULA[:#{param}_formula])
  end
  )
  module_eval(aStr)
  } # Do not remove this.
  
end # Game_BattlerBase


And this is the formula:

CODE
      :mhp_n_value => "self.level",
      :mhp_formula => "((1.0587**(n+81.7))*1.0).to_i",


Now the issue is, I need to use "self.level". This is not available for enemies, so I get an error message in battles. I can't check "self.is_a?(Game_Actor)" because it's BattlerBase... And also, I need to be able to check the actor's id, because the stats need to vary between actors.

Anyone can help? ^^;

Normally I'm quite good at figuring these things out, but it seems the parameter methods are absent from the RGSS3 code...

[edit] Nevermind! I think I fixed it by editing the defs at the top of BattlerBase and the param_base call in Game_Actor to change the appearance in the status window, etc. Not sure why I didn't think of this before. -_-
Jens of Zanicuud
Just add this snippet in Materials section:

CODE
class Game_Enemy < Game_Battler
def level
  return 0
end
end


This way, when your script calls self.level, will receive a parameter even if the battler is an enemy (in that case, the script will return a 0 value) and you'll solve your problem.

I hope this can help,

Jens
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.