Change the scope of the Recover All function

So I have a very basic item. Use it and it will give you a status effect that doubles your HP. Not an uncommon ability in JRPGs and it works perfectly fine using the basic status effect parameters. My one issue, however, is that this effect disappears when using the "recover all" function. I specifically want to be able to use the item outside of battle so you can use it in advance to prepare for a difficult boss (it automatically vanishes after one battle).

It's obvious what's happening. The recover all function is detecting it as a status effect and is "healing" it. But given this is a purely positive effect, I don't want it heal. So is there any way to create a list of exceptions to the recover all function (I also have an item that halves SP use that is in the same situation).
The default engine has no options for this, you'll need to use a script to change the engine to get this function.
But I have no knowledge about RMXP scripts, you'll have to search for this yourself.
So I have a very basic item. Use it and it will give you a status effect that doubles your HP. Not an uncommon ability in JRPGs and it works perfectly fine using the basic status effect parameters. My one issue, however, is that this effect disappears when using the "recover all" function. I specifically want to be able to use the item outside of battle so you can use it in advance to prepare for a difficult boss (it automatically vanishes after one battle).

It's obvious what's happening. The recover all function is detecting it as a status effect and is "healing" it. But given this is a purely positive effect, I don't want it heal. So is there any way to create a list of exceptions to the recover all function (I also have an item that halves SP use that is in the same situation).
Hi,
yeah, your described behavior sounds right. I suppose you are referring to the "recover all" function on page 3 in the event functions? Then it's an easy fix.

1. Open Script Editor
2. Go to script Game_Battler 1 and there to line 250
3. change the code in the for loop from
Ruby:
remove_state(i)

to

Ruby:
i == X ? i += 1 : remove_state(i)

The "X" should be the ID of your specific state, that doubles the HP. The first state in the Database starts with 1. What the change does is simpy skip the "remove_state" method for your specific state, in your case the state that doubles the HP, and jumps directly to the next state id in the "recover_all" method. If you want to check more than one states then you can simply modify it with an "OR" check like this for example:

Ruby:
i == X || Y || Z ? i += 1 : remove_state(i)

It's a simple and not very sophisticated fix but it should be enough for your case. When you get to the point where you have a big list of states with similar situations arising then it would be best to create another solution. For example creating an additional parameter that is false by default and automatically true for specific state id's of your choice defined in the Script Editor. The "recover_all" method would then check it the state has the new parameter set to true before deciding to start the "remove_state" method.
Hi,
yeah, your described behavior sounds right. I suppose you are referring to the "recover all" function on page 3 in the event functions? Then it's an easy fix.

1. Open Script Editor
2. Go to script Game_Battler 1 and there to line 250
3. change the code in the for loop from
Ruby:
remove_state(i)

to

Ruby:
i == X ? i += 1 : remove_state(i)

The "X" should be the ID of your specific state, that doubles the HP. The first state in the Database starts with 1. What the change does is simpy skip the "remove_state" method for your specific state, in your case the state that doubles the HP, and jumps directly to the next state id in the "recover_all" method. If you want to check more than one states then you can simply modify it with an "OR" check like this for example:

Ruby:
i == X || Y || Z ? i += 1 : remove_state(i)

It's a simple and not very sophisticated fix but it should be enough for your case. When you get to the point where you have a big list of states with similar situations arising then it would be best to create another solution. For example creating an additional parameter that is false by default and automatically true for specific state id's of your choice defined in the Script Editor. The "recover_all" method would then check it the state has the new parameter set to true before deciding to start the "remove_state" method.
Works like a dream. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/change-the-scope-of-the-recover-all-function.150613/