HP / MP Equipment Bonuses
Version: 1.0
Author: modern algebra
Date: July 7, 2008
Description
This script allows you to set Equipment that give bonuses to your Max HP and Max MP
Features
- Uses the Note box for easy configuration
- Allows you to set bonuses to Max HP and MP to equipment individually
Instructions
Place script above Main and below other Custom scripts
Simply use these codes in the note box of any Equipment:
\maxhp[<integer>] positive or negative
\maxmp[<integer>] positive or negative
Script
#==============================================================================
# Max HP/MP Equipment
# Version 1.0
# Author: modern algebra
# Date: July 7, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Instructions:
# Place Above Main and below other Custom scripts
#
# Simply use this code in the note box of any Equipment:
#
# \maxhp[<integer>] positive or negative
# \maxmp[<integer>] positive or negative
#==============================================================================
#==============================================================================
# ** RPG::BaseItem
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# new methods - maxhp, maxmp
#==============================================================================
class RPG::BaseItem
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * MaxHP Bonus
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def maxhp
return $1.to_i if self.note[/\\maxhp\[(-*\d+)\]/i] != nil
return 0
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * MaxMP Bonus
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def maxmp
return $1.to_i if self.note[/\\maxmp\[(-*\d+)\]/i] != nil
return 0
end
end
#==============================================================================
# ** Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Summary of Changes:
# aliased method - setup, change_equip
# new method - add_hpmp_bonuses
#==============================================================================
class Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Setup
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_levent_hpmpmax_upd_equipment_stup setup
def setup (actor_id)
# Run Original method
modalg_levent_hpmpmax_upd_equipment_stup (actor_id)
equips.each_index { |i| calc_hpmp_bonuses (equips[i]) }
self.hp = self.maxhp
self.mp = self.maxmp
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Change Equip
#--------------------------------------------------------------------------
# Adds and subtracts maxhp upon equip
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_levnthn_maxhpmp_equip_change_9nej change_equip
def change_equip (equip_type, item, test = false)
calc_hpmp_bonuses (equips[equip_type], false)
# Run Original Method
modalg_levnthn_maxhpmp_equip_change_9nej (equip_type, item, test)
calc_hpmp_bonuses (item)
self.hp = [self.hp, self.maxhp].min
self.mp = [self.mp, self.maxmp].min
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Add HPMP Bonuses
# item : the item in question
# sign : true => add, false => subtract
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def calc_hpmp_bonuses (item = nil, sign = true)
return if item == nil
hp = sign ? item.maxhp : -item.maxhp
@maxhp_plus += hp
mp = sign ? item.maxmp : -item.maxmp
@maxmp_plus += mp
end
end
Credit
Thanks
- Leventhan, for the request
Support
Post here at rmrk.net for the swiftest response
This script by
modern algebra is licensed under a
Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.