Hello everyone, I am still working on my commercial tactical rpg project which will be similar to famous tactical rpgs such as Final Fantasy Tactics. In FFT, there is are states called Speed Save and PA Save, ect. When a unit has Speed Save, for example, when they take damage, they gain a temporary increase to their speed stat which goes away after the battle ends. I'm trying to figure out how I can make a state like this. Here's what I have so far:
#if Agility Save State
if self.state?(214) #< Agility Save State ID
self.animation_id = 635 #< Agility Save State Animation ID
self.agi += self.damage / 4 #< Agility increases by 1/4th the damage dealt to the unit
end
And this works, but of course this PERMANENTLY increases the unit's agility stat, and I only want to temporarily increase it and have this temporary stat increase removed when the battle ends, or preferably, when the Agility Save state is no longer applied to the unit. Here is how I think I could do this:
#if Agility Save State
if self.state?(214)
self.animation_id = 635
self.tempagiplus += self.damage / 4
self.agi += self.tempagiplus
else
self.agi -= self.tempagiplus
end
But of course, tempagiplus is not a variable in the script that I can use and I get an error when trying to use this. I need some sort of local variable that applies to ALL units, both actors and enemies, just like their stat variables, in order do this properly, but I have no idea how to make new local variables like this. Could anyone help me figure out how I can make this work? Any advice would be greatly appreciated, thanks!
#if Agility Save State
if self.state?(214) #< Agility Save State ID
self.animation_id = 635 #< Agility Save State Animation ID
self.agi += self.damage / 4 #< Agility increases by 1/4th the damage dealt to the unit
end
And this works, but of course this PERMANENTLY increases the unit's agility stat, and I only want to temporarily increase it and have this temporary stat increase removed when the battle ends, or preferably, when the Agility Save state is no longer applied to the unit. Here is how I think I could do this:
#if Agility Save State
if self.state?(214)
self.animation_id = 635
self.tempagiplus += self.damage / 4
self.agi += self.tempagiplus
else
self.agi -= self.tempagiplus
end
But of course, tempagiplus is not a variable in the script that I can use and I get an error when trying to use this. I need some sort of local variable that applies to ALL units, both actors and enemies, just like their stat variables, in order do this properly, but I have no idea how to make new local variables like this. Could anyone help me figure out how I can make this work? Any advice would be greatly appreciated, thanks!