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.

How to temporarily increase stats via scripts?

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!
 
I'm pretty sure you can add a percentage of the agility through the use of states.
326d2fa663.png

This will give the character 125% agility (base + 1/4base).

Because you need it to be based from the damage, I'd suggest making new variables in the game Game_Battler initialize like @bonus_agi, @bonus_def, etc.
Then when you go to read the agi value (returned by a method, not a stand alone variable, luckily!), edit the method to also take @bonus_agi into account as well.
 

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