MZ Passive States Condition Once Per Battle

Hi! I'd like to know if there's a way to do the following:


I have a passive skill (applied through a state) that activates only when certain conditions are met. For example: it activates only when the player has 50% HP or less.


I know how to do that (I saw it in this post and it worked), but I’d like to know if it’s possible to make that effect trigger only once per battle.


I'm using VisuStella Battle Core and Skills and States.


Any ideas? Thanks a lot in advance!!
If it's ok to get rid of the passive state, you can add it like this (then make the skill add user._passiveSpent = 1)

<JS Passive Condition>
condition = user.hpRate() <= 0.5 && !user._passiveSpent;
</JS Passive Condition>
If it's ok to get rid of the passive state, you can add it like this (then make the skill add user._passiveSpent = 1)

<JS Passive Condition>
condition = user.hpRate() <= 0.5 && !user._passiveSpent;
</JS Passive Condition>
Thank you very much for your response! That could work!

Now, I think I forgot an important detail: those passive skills are always present on the characters (they learn them through leveling up), so ideally, there should be a way to keep the state but only have it activate once per battle, if it activates at all. I imagine something like “tags” or some kind of indicator showing it has been triggered in that battle.


If not, I could use your method by adding the passive skills at the start of each battle through a common event triggered at the beginning.


I'll see if someone comes up with a more optimized solution before I try yours — thanks anyway! =)
So, if I understand correctly, "activate once" means that the state should disappear once you use the skill it provides (as opposed to after a number of turns or after the battler gets back above the HP threshold)?

Especially if you want the skill to always be there, you could use the <JS Skill Visible> or <JS Skill Enable> tags to determine when that skill can be used (instead or in addition to a passive state):
JavaScript:
<JS Skill Enable>
  enabled = (user.hpRate() <= 0.5 && user.superskillXYlastUse !== $gameSystem.battleCount())
</JS Skill Enable>

<JS Pre-Start Action>
  // Only works for skills used in battle:
  user.superskillXYlastUse = $gameSystem.battleCount()
</JS Pre-Start Action>
So, if I understand correctly, "activate once" means that the state should disappear once you use the skill it provides (as opposed to after a number of turns or after the battler gets back above the HP threshold)?

Especially if you want the skill to always be there, you could use the <JS Skill Visible> or <JS Skill Enable> tags to determine when that skill can be used (instead or in addition to a passive state):
JavaScript:
<JS Skill Enable>
  enabled = (user.hpRate() <= 0.5 && user.superskillXYlastUse !== $gameSystem.battleCount())
</JS Skill Enable>

<JS Pre-Start Action>
  // Only works for skills used in battle:
  user.superskillXYlastUse = $gameSystem.battleCount()
</JS Pre-Start Action>
A thousand apologies for the delay!! That’s exactly what I needed! I haven’t had the chance to test it yet, but as soon as I do, I’ll let you know how it went! Thank you so much for your help!!!!!!!!

Original thread: https://forums.rpgmakerweb.com/threads/passive-states-condition-once-per-battle.179051/