Parameter = Variable?

Background:

I apologise for asking, but I searched much of Google and didn't find an answer to my question.

I can't program Ruby or the RPG Maker language, but I do understand most things in programming code.

I have two spells.

The first spell creates a "save state," a common event that saves current HP, current MP, current enemy HP, and current ailments to different variables.

The second spell loads that save state. Its purpose is to load your stats and parameters from the turn you've saved those, undoing everything.

Say for instance, at turn 3, you create a save state with having 100 HP, 100 MP and being poisoned, then go on in battle. You cure the poison, and deal lots of damage.

But then at turn 6 or 7, you see that you lost a lot of HP yourself. And your MP is almost depleted. So you go back to the turn 3 save state with better stats, but being poisoned as you were then. And the enemy has as much HP as he had at turn 3. Basically, you traveled back in time. And now you're playing more tactically and win the battle.

My question isn't about the game mechanic design itself, but rather the code.

Question:

In Ace, I can set variables of parameters with no problem. More problematic is getting them back to overwrite them with current HP, MP, ailments.

Change Parameters allows me to increase or decrease a parameter with a variable, but not simply set (overwrite) it with that variable. Likewise for Change HP and Change MP.

Any solution to this problem? Thanks. 🙂
The easiest (and efficient) way I can think of would be to use a scripted method, storing @hp and @mp into variable amounts, "$game_variables[x] = @hp" and just saying "@hp = $game_variables[x]"  Same can be done with an enemy's HP/MP.

This can easily be done with something like Yanfly's Lunatic States. Of course it would take some scripting knowledge.

Trying to event something like this would probably be a pain in the ass.
script use might be the easiest (like the poster above wrote), but if you need to do it in events due to script compatibility issues or other problems, then you need to use several control variable commands.

Assuming 001 is the variable where you stored the value, and 099 is a temporary variable for calculating purposes, you do the following:

control variable 099 = game data: current HP (set)

control variable 001 -= variable 099 (substract current HP from stored HP)

change HP by adding variable 001

(if you want to store 001 for future use of the same return-to-save, then you'll need a second temporary variable for the operation)

Original thread: https://forums.rpgmakerweb.com/threads/parameter-variable.20562/