Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Access to the 'level' parameter in BattlerBase?
Twin Matrix
post Mar 6 2013, 01:43 AM
Post #1


Level 19
Group Icon

Group: Revolutionary
Posts: 390
Type: Artist
RM Skill: Masterful




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. -_-

This post has been edited by Twin Matrix: Mar 6 2013, 02:35 AM


__________________________
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Mar 13 2013, 01:16 PM
Post #2


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 916
Type: Scripter
RM Skill: Skilled
Rev Points: 120




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


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th June 2013 - 01:52 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker