Skill effect common event playing even on miss.

I'm trying to create a skill similar to the escape skill where you can knock out an enemy instead of killing them. Which puts them in an immobile state outside of battle, Unless you interact with them, which re-initiates the battle. I have the skill set up with Victor's Hit Formula, so that the lower the hp of the enemy, the higher chance of succeeding in the knockout.

Everything works as intended, the only problem I'm running into is that whether the skill misses or not, the common event still plays, which ends the battle. If I don't use the script and just set the success rate to 0% it still happens, and if I sub out the common event for a status effect, it doesn't proc. Which tells me it's something to do with the way RPG maker handles common events.

All I need is to turn on a switch and abort the battle if the skill hits, and to do nothing if it misses. Any suggestions would be awesome. TY

1711513571225.png
What other plugins are you using?

By default, the command to execute the action's Effects is within a conditional that checks whether it hit.
1711564254121.png


So either your skill is hitting when you don't think it should be, or one of your plugins is changing Game_Action.prototype.apply()
Interesting, I'll try disabling certain plugins and testing to try to find the culprit but in the meantime, here is the plugin list I'm currently using:
xhmfghk.JPG

jhfhj.JPG


EDIT:
After turning off every plugin and re-testing I found that the common event is still playing, I've set the success rate to 0% and it displays, "miss" when the actor tries to use the skill. So unless I'm missing something it's not a plugin.

I've pasted the common event below just to provide all the info:

1711578862361.png
Hey,

The "Common Event" effect is a special case. It is indeed designed to trigger once every time you use the skill, regardless of how many targets you hit (or whether the skill even has targets in the first place).

An easy way to work around that might be to make your skill inflict a custom state on your target, and then check in your common event if any enemy got afflicted with it.
You can either check every possible enemy separately or use a script call in a conditional branch to go through all enemies at once:
$gameTroop.aliveMembers().some(enemy => enemy.isStateAffected(17))
or
$gameTroop.aliveMembers().every(enemy => enemy.isStateAffected(17))
to check if any or all living enemies are afflicted with state 17.
The "Common Event" effect is a special case. It is indeed designed to trigger once every time you use the skill, regardless of how many targets you hit (or whether the skill even has targets in the first place).
Nice, I never noticed there was a separate call for that.

If you want to remove that functionality without having to put conditionals in all your events, just paste this into a text editor, save as a *.js file, and include as a plugin.

Code:
Game_Action.prototype.applyGlobal = function() {};

Game_Action.prototype.itemEffectCommonEvent = function(target, effect) 
{
    $gameTemp.reserveCommonEvent(effect.dataId);
};
I tried saving the text as a plugin but that didn't seem to do anything. But, I used the conditional and that worked so it should be fine to just use that as it's the only event that will need it. Thank you both v much!
This thread is being closed due to being solved. If you need it reopened, report it to let us know why. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/skill-effect-common-event-playing-even-on-miss.167203/