Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Weapon and Armor modifies max HP/SP
#1
Weapon and Armor modifies max HP/SP
by Zeriab
Jun 9 2007

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given.


A script I made in 5-10 minutes or so because someone requested it.
I am to lazy to write a proper topic and to write comments.
It should be compatible to most scripts.
Code:
class Game_Actor
  if @stack.nil?
    alias zer_ori_maxhp maxhp
    alias zer_ori_maxsp maxsp
    @stack = true
  end
  
  def maxhp
    n = zer_ori_maxhp
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon != nil ? weapon.hp_plus : 0
    n += armor1 != nil ? armor1.hp_plus : 0
    n += armor2 != nil ? armor2.hp_plus : 0
    n += armor3 != nil ? armor3.hp_plus : 0
    n += armor4 != nil ? armor4.hp_plus : 0
    n = [[n, 1].max, 9999].min
    return n
  end
  
  def maxsp
    n = zer_ori_maxsp
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    n += weapon != nil ? weapon.sp_plus : 0
    n += armor1 != nil ? armor1.sp_plus : 0
    n += armor2 != nil ? armor2.sp_plus : 0
    n += armor3 != nil ? armor3.sp_plus : 0
    n += armor4 != nil ? armor4.sp_plus : 0
    n = [[n, 1].max, 9999].min
    return n
  end
end

module RPG
  class Weapon
    attr_writer :hp_plus
    attr_writer :sp_plus
    def hp_plus
      return 0    if @hp_plus.nil?
      return @hp_plus
    end
    def sp_plus
      return 0    if @sp_plus.nil?
      return @sp_plus
    end
  end
end

module RPG
  class Armor
    attr_writer :hp_plus
    attr_writer :sp_plus
    def hp_plus
      return 0    if @hp_plus.nil?
      return @hp_plus
    end
    def sp_plus
      return 0    if @sp_plus.nil?
      return @sp_plus
    end
  end
end


To use it just put something like this in a call script:
Code:
$data_armors[18].hp_plus = 50
$data_armors[16].sp_plus = 25
$data_weapons[4].hp_plus = 500
$data_weapons[6].sp_plus = 20


You can use it where ever you want in the game.
If you have loads to setup to start with you can insert a script like this:
Code:
class WeaponAndArmorSetup
  def self.run
    $data_armors[18].hp_plus = 50
    $data_armors[16].sp_plus = 25
    $data_weapons[4].hp_plus = 500
    $data_weapons[6].sp_plus = -20
  end
end


By default every weapon and armor adds 0 to hp and sp.
Use negative values to decrease the amount.

And put this in a call script:
Code:
WeaponAndArmorSetup.run

It will setup the weapons and armors.
[Image: ZeriabSig.png]
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Weapon Levelling Script GoldenShadow 0 2,102 07-05-2005, 01:00 PM
Last Post: GoldenShadow



Users browsing this thread: