[XP]Temporary stat boost

0 Members and 1 Guest are viewing this topic.

Level 67
"I am the Lord, thy Super Cow..."
Anyone know how to do this? Here's what I'm looking to do:
When sleeping at inns, the character has the option of sleeping in a normal room, or paying extra and getting a nice suite. When the character sleeps in the suite, I want to give them a boost, most likely to HP. So say the suite gives them an extra 200 HP. They'll only have that until they lose it in battle. Potions and such will only restore them to their normal max, and have no effect if they're still over that normal max. That's just an example.
I know how to adjust stats permanently via variables and events, but this one is escaping me.

Level 82
We learn by living...
in my game "Reality Hackers", I have a global called "$life", which can be edited at any time by typing "$life = 9" or "$life = 9999", for instance, in the event script editor.

A simple series of switches allows this variable to be turned on and off. Above Game_Temp, I set the variable to 0, by stating:

$life = 0

Now, in game actor, I have the following:

Code: [Select]
  # * Get Maximum HP
  def maxhp
  #reality Hack #001: life hack 
    n = [[base_maxhp + @maxhp_plus, 1].max, 9999].min
    for i in @states
      n *= $data_states[i].maxhp_rate / 100.0
    n = [[Integer(n) + $life, 1].max, 9999].min
    return n

What you then do is set a variable that records the actor's max hp before the life hack, say 775, for instance.

Then you switch on the hp bonus, of say, +25, and that pushes them to 800. Then, and only then, do you "heal all" party members. Otherwise your max will be up but your current will still be lower.

Whenever the character is damaged, you can compare the variable to their current, if the variable is greater, then you switch off the hack and set $life = 0.

Naturally this only works well with one actor. If you want to do this to all four actors, you will need to make $life into @life as an attr_accessor of actors. Honestly doing this through script+eventing is the fastest way I know, because you could add a line in battle script to immediately check current hp to max hp and if the current was less, switch off the bonus for that actor, right there.