Common event in battle problem...

hi i was looking for the answer on the net and in the forum, but i can find it...
the question is:

how do you stop a common event from happening if the enemy misses the attack
example:

Goblin uses triple slash and this attack has a common event that will destroy the helmet of the hero, BUT if he misses, the event shouldn't ocurr, but that doesn't happen.

the attack call the common event even if he misses, how do i stop that?

i hope you can understand my pseudo english thanks!
My game doesn't use the battle system, so I'm purely guessing from a logical concept...

Could you run an event before the goblin's turn to record the hp each party member before the goblin's action? Then after the action, check the hp values, and if it is less, execute destroy helmet?
the common event and the skill effects are independently of each other, you need to manually add your own check.

Easiest way is probably to add a damage formula command to turn on a switch (damage formula is executed on hit only), and check that switvch in the common event. However, you need to remember to turn off the switch or it will always execute on next skill use.
From Andar's answer, the formula would be something like this for the Switch with ID 1:

Code:
$gameSwitches.setValue(1, true); a.atk * 4 - b.def * 2
thanks i will try that 😀
it worked! thanks to all!

Original thread: https://forums.rpgmakerweb.com/threads/common-event-in-battle-problem.79217/