RPG Maker MZ

RPG Maker MZ

Need help with a battle event
Ok, this one is quite tricky! In the game i'm making, there're certain battle events triggered by the hero HP: Basically, at >90%\80\70 and so on, the character will do a certain thing.

Now, it works, but only the first time. If i use a potion to recover energy, the events will not start again: Battle span will work only one time, Turn span will repeat two times in a row the even and Moment span just loop without end...
< >
Showing 1-3 of 3 comments
Squall811 19 Jun @ 12:23pm 
Ok, i was able to make a little step ahead with the script "$gameParty.leader().hp". Now, it kinda works as intended, but when the enemy miss a hit, the game will repeat the event based on how much HP i've.

For example, the hero starts with 10 Hp.

The enemy hit me and i reach 9 Hp. All good! The event where the hero shows pain, works!

Now, the enemy miss and i'm still at 9 Hp... the hero shows pain! XD

If we could solve this, it would be great!
Switches might be your friend here. Since a switch condition can only be used in combat if it is on, you will want a switch for every HP% you want an action to happen at.

Have an event at the start of battle that turns all your HP switches on.

Now, say you want something to happen when your chara hits 75% health. Have the next event have the conditions "Chara is at 75%" health and "75% health event switch is on". As part of this event, turn the 75% switch off. Now the event only meets one of the conditions, so it will not keep repeating.

If you want the event to repeat if the character is healed then dips below 75% again, you will need an event that runs only if the character is over 75% health. All this event will do is turn the 75% switch back on. This will keep turning the switch on every round, but it shouldn't be noticeable to your player if that's all it's doing.

Now say you want another event to happen when the chara hits 50%. Again, as part of this event it should turn the 50% switch off. It should also deactivate the 75% switch, as there could be issues with multiple events happening if your chara takes a heavy hit that takes him from 100% to 50%.


Another solution may be to store your chara's HP in a variable, which the event checks using a conditional branch each round. Set up a branch to check if the chara's HP is the desired amount, then use a second branch to check if the switch is on. If both conditions are OK, then your event will happen. Make sure your conditional branch has an else condition that causes nothing to happen.

I haven't tested all this, but your player should be unaware of all these checks going on in the background.
I was already able to fix it with variables and conditionl branches.
But thank you for your time!
< >
Showing 1-3 of 3 comments
Per page: 1530 50