Replacing HP Stat with MP Stat through events

pohutukawa

WRITER.
Member
Joined
Feb 10, 2021
Messages
15
Reaction score
35
First Language
English
Primarily Uses
RMMV
So I have a secret in my game, but it doesn't work. I want to have an event that can occur that will replace the value of their maxHP stat with their maxMP stat. I have no idea if I can even do this, but if I can, please let me know.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,957
Reaction score
5,583
First Language
English
Primarily Uses
RMVXA
Control Variables: Set Variable 19 equal to Actor X's Max MP (you can use any variable you want; I'm using 19 and 20 for this example)
Control Variables: Set Variable 20 equal to Actor X's Max HP
Control Variables: For Variable 19, Subtract the value of Variable 20
Change Parameters: Actor X, Max HP, Add, Amount: Variable 19

This essentially stores the character's Max HP and MP to variables, subtracts one from the other to find the difference, and adds that difference (which might be positive or negative) to their current Max HP to find their new Max HP.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,355
Reaction score
8,081
First Language
German
Primarily Uses
RMMV
yes and no
it can be done like described above, but that may cause problems depending on what and how you use the sequence. And your description doesn't give that info.

for how long should the points remain changed? Can the player change back?
 

pohutukawa

WRITER.
Member
Joined
Feb 10, 2021
Messages
15
Reaction score
35
First Language
English
Primarily Uses
RMMV
yes and no
it can be done like described above, but that may cause problems depending on what and how you use the sequence. And your description doesn't give that info.

for how long should the points remain changed? Can the player change back?
I want this to be a permanent change.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,355
Reaction score
8,081
First Language
German
Primarily Uses
RMMV
then you can use the method described above
 

pohutukawa

WRITER.
Member
Joined
Feb 10, 2021
Messages
15
Reaction score
35
First Language
English
Primarily Uses
RMMV
Control Variables: Set Variable 19 equal to Actor X's Max MP (you can use any variable you want; I'm using 19 and 20 for this example)
Control Variables: Set Variable 20 equal to Actor X's Max HP
Control Variables: For Variable 19, Subtract the value of Variable 20
Change Parameters: Actor X, Max HP, Add, Amount: Variable 19

This essentially stores the character's Max HP and MP to variables, subtracts one from the other to find the difference, and adds that difference (which might be positive or negative) to their current Max HP to find their new Max HP.
YOU'RE LOVELY. The moment I have the opportunity to try this, I will.
 

pohutukawa

WRITER.
Member
Joined
Feb 10, 2021
Messages
15
Reaction score
35
First Language
English
Primarily Uses
RMMV
Control Variables: Set Variable 19 equal to Actor X's Max MP (you can use any variable you want; I'm using 19 and 20 for this example)
Control Variables: Set Variable 20 equal to Actor X's Max HP
Control Variables: For Variable 19, Subtract the value of Variable 20
Change Parameters: Actor X, Max HP, Add, Amount: Variable 19

This essentially stores the character's Max HP and MP to variables, subtracts one from the other to find the difference, and adds that difference (which might be positive or negative) to their current Max HP to find their new Max HP.
So my issue is that my HP now changes, but the MP remains constant.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,957
Reaction score
5,583
First Language
English
Primarily Uses
RMVXA
So my issue is that my HP now changes, but the MP remains constant.
Right - you didn't say you wanted to affect MP in any way.

So if I understand you correctly, you want the actor's HP maximum and his MP maximum to switch with each other? If he had 90 Max HP and 62 Max MP, now he should have 62 Max HP and 90 Max MP?
 

pohutukawa

WRITER.
Member
Joined
Feb 10, 2021
Messages
15
Reaction score
35
First Language
English
Primarily Uses
RMMV
Right - you didn't say you wanted to affect MP in any way.

So if I understand you correctly, you want the actor's HP maximum and his MP maximum to switch with each other? If he had 90 Max HP and 62 Max MP, now he should have 62 Max HP and 90 Max MP?
REPLACE WAS NOT THE BEST WORD. Sorry about that.
Yes, what you described is the effect that I want.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,957
Reaction score
5,583
First Language
English
Primarily Uses
RMVXA
OK, I think that should still be pretty easy. We're fortunate enough that the way we originally approached this problem, we had ended up with the "difference between Max HP and Max MP" in Var #19 after the third event command. So while we add this value to Max HP using a Change Parameters command... we just need to subtract it from Max MP!

Putting that all together, I think the following event command sequence should work for you, doing this once for each Actor you need to swap the values of. I've highlighted the new line you need to add, in Green. Everything else is the same as last time. If this doesn't work, let me know.
  • Control Variables: Set Variable 19 equal to Actor X's Max MP (you can use any variable you want; I'm using 19 and 20 for this example)
  • Control Variables: Set Variable 20 equal to Actor X's Max HP
  • Control Variables: For Variable 19, Subtract the value of Variable 20
  • Change Parameters: Actor X, Max HP, Add (Increase), Amount: Variable 19
  • Change Parameters: Actor X, Max MP, Subtract (Decrease), Amount: Variable 19
 

pohutukawa

WRITER.
Member
Joined
Feb 10, 2021
Messages
15
Reaction score
35
First Language
English
Primarily Uses
RMMV
I tried this, but I did it wrong the first time. This worked. THANK YOU.
I was trying to see if it would switch it back again if I used it a second time, but it doesn't. Is there a reason for this?
 
Last edited:

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,448
Reaction score
697
First Language
indonesian
I tried this, but I did it wrong the first time. This worked. THANK YOU.
I was trying to see if it would switch it back again if I used it a second time, but it doesn't. Is there a reason for this?
maybe because now the maxHP is lower than maxMP... so the difference will be negative value and make it not working...

you can add conditional branch that check variable 19... if the value is lower than 0 (negative value)...then multiply it by -1 to make it positive value... (using Mul operand at change variable).
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,957
Reaction score
5,583
First Language
English
Primarily Uses
RMVXA
maybe because now the maxHP is lower than maxMP... so the difference will be negative value and make it not working...

you can add conditional branch that check variable 19... if the value is lower than 0 (negative value)...then multiply it by -1 to make it positive value... (using Mul operand at change variable).
I checked through the code behind the Change Parameter event command, and I don't think it should matter that you are inputting a variable with a negative value in it (as it calls operateValue which multiplies by -1, and addParam which seems to accept negative values into the addition).

So I'd be surprised if using the same approach I suggested a second time would not swap the values back when used a second time. I could be wrong, but my instinct is that the eventing may be a little off (for example using Add instead of Set for one of the earlier commands). @pohutukawa Can you screenshot the Event(s) you use to swap the values each time, and also let us know what Max HP and Max MP you actually get for the Actor after using it twice (as well as what those values were before using the event once)?
 

pohutukawa

WRITER.
Member
Joined
Feb 10, 2021
Messages
15
Reaction score
35
First Language
English
Primarily Uses
RMMV
The outcome of using it more than once only switches for the first time.
The initial value for the character is 101HP & 99MP. This switches only once, to be 101 MP & 99HP. Using it again changes nothing.
2021-03-04 23.17.05.png
 
Last edited:

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,957
Reaction score
5,583
First Language
English
Primarily Uses
RMVXA
I just set this up myself in my project, and it worked fine no matter how many times I interacted with the event.

Remember that adjusting Max HP/MP will only adjust the current HP/MP (and the number shown on the gauge on the pause menu) if your old current HP is higher than the new Max. So if you're working with 99 and 101, it will look like both gauges are "full" at 99 after using it twice. Try using it with more extreme values (500 HP and 40 MP), and checking the gauges after using it twice... or try adding a Recover All event command after the Parameter changes in order to see what your true Max HP/MP numbers are.

I think that will reveal it's working properly, but if it doesn't, it may be something else about your event page causing the event to not actually trigger twice. You could add a Show Message at the end to confirm the event actually processed, or maybe screenshot the entire event (not just the event command codes) and I can look to see if there's any reason this isn't working for you.
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
604
Reaction score
315
First Language
German
Primarily Uses
You are generally using current HP/MP values in your first two commands where you should be using maxHP/maxMP values. Otherwise it will indeed only work correctly if the actors HP/MP are full.

You might also have to make sure your actors stats are not influenced by "parameter rate" traits or buffs at the time of swapping.
 

pohutukawa

WRITER.
Member
Joined
Feb 10, 2021
Messages
15
Reaction score
35
First Language
English
Primarily Uses
RMMV
YES, my issue was I was using the regular HP/MP parameter rather than the MHP/MMP. The issue is completely solved. Thanks so much for being patient with me.
2021-03-05 11.43.11.png
 

Latest Threads

Latest Profile Posts

A good way to practice writing is to write "flash fiction"; very short stories. Link
[CM]
5VaUMjAFpz1I6fSsgDrfJc.jpg

Title is star.
Dam, does the night get to me, I sound and look like a monster. Its 3:54 am right now...I need sleep...or...coffee.
It has nothing to do with my project, but I'm in love with voxels

Forum statistics

Threads
110,487
Messages
1,053,665
Members
143,580
Latest member
Legend958
Top