RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
auto_mp_recover

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 75
RMRK Junior
I have a script that can add abilities to armor and wanted to know if these look correct

Code: [Select]
  #--------------------------------------------------------------------------
  # * Perform Automatic Recovery (called at end of turn)
  #--------------------------------------------------------------------------
  def do_auto_recovery
    if auto_hp_recover and not dead?
      self.hp += maxhp / 20
    end
    if auto_mp_recover and not dead? #TESTING
      self.mp += maxmp / 20
    end
  end
Code: [Select]
  #--------------------------------------------------------------------------
  # * Get [Auto MP Recovery] Armor Option TESTING
  #--------------------------------------------------------------------------
  def auto_mp_recover
    for armor in armors.compact
      return true if armor.auto_mp_recover
    end
    return false
  end

I copied and pasted all other instances of auto_hp_recover and changed it to auto_mp_recover but I am still having some errors saying 'undefined method'
I have not learned the Roby language, but I am learning, snippet by snippet, how to alter some things.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Well, you need to define the auto_mp_recover method in the armors. Have you done that?

**
Rep: +0/-0Level 75
RMRK Junior
I went to all Game_Actor and copied and re-pasted auto_mp_recover exactly like auto_hp_recover and such. I did give it to the armor but got a
'script 'pre/suf' line 329: no method error occured
undefined method 'auto_mp_recover' RPG::armor:ox16843o8

I went to Pre/Suf and found all instance of auto_hp_recover and made a copy for mp_recover but keep getting that error. I just assumed making a copy of something that already works would be easy, what gives?

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
The difference is that auto_hp_recover is already a method in RPG::Armor and auto_mp_recover is not.

Add the following:

Code: [Select]
class RPG::Armor
  def auto_mp_recover
    return self.note[/auto_mp/i] != nil
  end
end

Then, that should make it so that if you put:
auto_mp

into the notebox of any armor, then the rest will work.

**
Rep: +0/-0Level 75
RMRK Junior
I noticed that in the script I am using it seems to define that already.
Code: [Select]
class Armor
  alias oecs_epss_name name
  alias oecs_epss_description description
  alias oecs_epss_price price
  alias oecs_epss_atk atk
  alias oecs_epss_def def
  alias oecs_epss_spi spi
  alias oecs_epss_agi agi
  if OECS.constants.include?("Durability")
    alias oecs_epss_durability durability
  end
  alias oecs_epss_state_set state_set
  alias oecs_epss_element_set element_set
  alias oecs_epss_prevent_critical prevent_critical
  def prevent_critical
    if @identified
      return self.oecs_epss_prevent_critical
    else
      return self.mother_item.critical
    end
  end
  alias oecs_epss_half_mp_cost half_mp_cost
  def half_mp_cost
    if @identified
      return self.oecs_epss_half_mp_cost
    else
      return self.mother_item.critical
    end
  end 
  alias oecs_epss_double_exp_gain double_exp_gain
  def double_exp_gain
    if @identified
      return self.oecs_epss_double_exp_gain
    else
      return self.mother_item.critical
    end
  end 
  alias oecs_epss_auto_hp_recover auto_hp_recover
  def auto_hp_recover
    if @identified
      return self.oecs_epss_auto_hp_recover
    else
      return self.mother_item.critical
    end
  end
  alias oecs_epss_auto_mp_recover auto_mp_recover
  def auto_mp_recover
    if @identified
      return self.oecs_epss_auto_mp_recover
    else
      return self.mother_item.critical
    end
  end
Ah, there is no script for the RPG::Armor auto_hp thing is there? Is it built in?
Also, I am not sure the method that injects item abilities is not notebox driven. Can I just do
Code: [Select]
class RPG::Armor
   def auto_mp_recover
   end
end
so that it is defined, then alter game_actor and stuff to cause it to regen mp? I tried but it seems to not be working...my way, that is, not yours.

Edit: Also, if this is the kind of stuff you guys go through to script for us undeserving wretches, you guys deserve a cake.
« Last Edit: April 16, 2011, 02:07:24 PM by SirCumferance »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
OK, well I know nothing about that script which totally changes everything about armors (probably a good thing to mention when asking for help by the way) but the problem must be that the armors method of Game_Actor is still returning the default armor objects, not the special armor objects that the script you're using has. How you could fix that I am unsure without seeing the script, but look at the script you're using and see what edits it has made to the Game_Actor class, if any. It might be that which is causing the problem.

Also, yes, RPG::Armor is a hidden class, but you can see everything about it in the Help file

**
Rep: +0/-0Level 75
RMRK Junior
Sorry about the surprise on the script, I got caught up in almost doing something. I think this is just beyond me, my reach exceeded my grasp.

Thanks modern algebra, for your response and help and for all the bomb scripts you write. Maybe one day I will understand half of what I think I do, but not now and certainly not today.