i'm trying to add a new attribute called: stamina
it will raise the actors maxhp depending on his lvl and class.
the code looks like this:
but i'm getting an error in row 66...
it will raise the actors maxhp depending on his lvl and class.
the code looks like this:
Code:
# add stamina
module RPG
class Actor
@parameters = Table.new(7,100)
for i in 1..99
@parameters[6,i] = 1
end
attr_accessor :parameters
end
end
# Game_Battler stuff
class Game_Battler
def clear_extra_values
@maxhp_plus = 0
@maxmp_plus = 0
@atk_plus = 0
@def_plus = 0
@spi_plus = 0
@sta_plus = 0
@agi_plus = 0
end
# def stamina
def sta
n = [[base_sta + @sta_plus, 1].max, 999].min
for state in states do n *= state.sta_rate / 100.0 end
n = [[Integer(n), 1].max, 999].min
return n
end
# set new stamina
def sta=(new_sta)
@sta_plus += new_sta - self.sta
@sta_plus = [[@sta_plus, -999].max, 999].min
end
# stamina life bonus
def stamina_bonus
case actor.class
when 1
n = (sta * actor.lvl) / 12
when 2
n = (sta * actor.lvl) / 10
when 3
n = (sta * actor.lvl) / 11
else
n = (sta * actor.lvl) / 15
end
return n
end
# MAX LIFE
def maxhp
return [[base_maxhp + @maxhp_plus + stamina_bonus, 1].max, maxhp_limit].min
end
end
# ð GAME_BATTLER END
class Game_Actor < Game_Battler
# Basic Ausdaer
def base_sta
n = actor.parameters[6, @level]
for weapon in weapons.compact do n += weapon.sta end
for armor in armors.compact do n+= armor.sta end
return n
end
end
module RPG
class Armor < BaseItem
def initialize
super
@sta = 0
end
attr_accessor :sta
end
end
module RPG
class Weapon < BaseItem
def initialize
super
@sta = 0
end
attr_accessor :sta
end
end
but i'm getting an error in row 66...