Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Request] Equipments that increases HP/MP stats [RGSS2] - RESOLVED

Equipments that increases HP/MP stats
Monday, July 07 2008



Summary
Simply put, this script will enable characters to have their Max HP/MP to be increased when wearing certain equipments.

Features Desired

Increases Max HP/MP
If the character equips the equipment when in max hp/mp, the max hp/mp will then increase to a certain amount but the remaining hp will stay the same e.g. Minato equips a HP Booster when his hp is 50/50, then his hp is boosted to 50/60
Preferablly to be able to increase AND decrease max hp/mp
Able to use either values and or %


Mockups
Not Necessary.

But if there is it's just a window with a list of characters and their respective HP/MPs and choices to either "Heal One" or "Heal All"
There's also a small window showing the player's amount of money.

Games its been in

Disgaea
Phantom Brave
Makai Kingdom

Did you search?
YES

Where did you search?

rmrk.net
rmvx.org
rpgmakervx.net
rpgrevolution.com
rpgmakerbrasil.com (Thank you Google translate)

What did you search for?

I've looked everywhere for the past few days.
Rather unlikely I've missed such a thing.

Besides, I've made a list of available VX scripts on the internet and update it frequently.
There is no such thing as of today. I saw something like this for XP, so if somebody convert it to RGSS2 it would be nice. =D
 

poccil

Sponsor

The script below, which I just made, does what you want.  Put it after all other scripts in the Materials section of the script editor.

After installing the script, add the tag [MaxHPIncrease: X] and/or [MaxMPIncrease: X] to the weapon or armor's notes, where X is the amount of HP or MP that the weapon or armor increases.  X can be negative and can be a number or a percentage.  The following are examples of its use:

[MaxHPIncrease: -10] - Decrease maximum HP by 10
[MaxHPIncrease: 30%] - Increase maximum HP by 30%
[MaxMPIncrease: -50%] - Decrease maximum MP by 50%

The script code is below.
Code:
class Game_Actor
  @@MaxHPWeapons=nil
  @@MaxMPWeapons=nil
  @@MaxHPArmors=nil
  @@MaxMPArmors=nil
  def parseMaxHPTag(note,tag)
   value=[0,false]
   note.scan(/\[#{tag}\:\s*(\-?)(\d+)(\%?)\]/i){
    value=$2.to_i
    if $1=="-"
     value=-value
    end
    if $3=="%"
     value=[value,true]
    else
     value=[value,false]
    end
    break
   }
   return value
  end
  def parseMaxHPNotes
   @@MaxHPWeapons={}
   @@MaxMPWeapons={}
   @@MaxHPArmors={}
   @@MaxMPArmors={}
   for equip in $data_weapons
    next if !equip
    @@MaxHPWeapons[equip.id]=parseMaxHPTag(equip.note,"MaxHPIncrease")
    @@MaxMPWeapons[equip.id]=parseMaxHPTag(equip.note,"MaxMPIncrease")
   end
   for equip in $data_armors
    next if !equip
    @@MaxHPArmors[equip.id]=parseMaxHPTag(equip.note,"MaxHPIncrease")
    @@MaxMPArmors[equip.id]=parseMaxHPTag(equip.note,"MaxMPIncrease")
   end
  end
  def modifyValue(v,base,x)
   v+=(x[1]) ? base*x[0]/100 : x[0]
   v=1 if v<1 # Ensure max value is not 0 or less
   return v
  end
  alias :petero_maxhp_base_maxhp :base_maxhp
  alias :petero_maxhp_base_maxmp :base_maxmp
  alias :petero_maxhp_hp :hp
  alias :petero_maxhp_mp :mp
  def base_maxhp
   parseMaxHPNotes() if !@@MaxHPWeapons
   base=petero_maxhp_base_maxhp
   b=base
   for equip in self.weapons
    b=modifyValue(b,base,@@MaxHPWeapons[equip.id])
   end
   for equip in self.armors
    b=modifyValue(b,base,@@MaxHPArmors[equip.id])
   end
   return b
  end
  def base_maxmp
   parseMaxHPNotes() if !@@MaxHPWeapons
   base=petero_maxhp_base_maxmp
   b=base
   for equip in self.weapons
    b=modifyValue(b,base,@@MaxMPWeapons[equip.id])
   end
   for equip in self.armors
    b=modifyValue(b,base,@@MaxMPArmors[equip.id])
   end
   return b
  end
  def hp
   b=petero_maxhp_hp
   curmaxhp=self.maxhp
   if b>curmaxhp # Ensure HP is not over max HP
    self.hp=curmaxhp
   end
   return b
  end
  def mp
   b=petero_maxhp_mp
   curmaxmp=self.maxmp
   if b>curmaxmp # Ensure MP is not over max MP
    self.mp=curmaxmp
   end
   return b
  end
end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top