RPG Maker VX ACE: Encountering a state glitch with a common event attached to a skill

Hey.

Software: RPG Maker VX ACE
Scripts: Yanfly core, battle, life bars

Hope you are doing well. I came across a rather odd occurrence with a specific skill I made. I will break down the skill first and then explain what went wrong:

This skill is suppose to attack two random enemies for A.Atk * 3 - B.Def * 2 and in addition to attacking the enemies, it also gives the Actor a state buff that grants +30% EVA for 4 Turns.

State name: Vanishing
Features: +30% EVA
goes away at end of battle
lasts 4 ~ 4
Action End

When creating the skill in the database, under features, the software wouldn't allow me to add this state to the Actor using the Skill (it only lets you add the state to the enemies you hit)

So as a work around, I created a Common Event that that automatically gives this particular actor that has this skill, a 100% chance to add the vanishing state and I attached the "call Common Event" to the Vanishing Slice Skill features. I tested it in the battle tester and also in the play test and it seemed to work as intended 90% of the time.

But this one time in the Playtest, the Vanishing state was still on this actor even after the battle ended (or at least the icon was)

It hasn't happened again yet, so i'm thinking maybe it was just an odd glitch with something, but would like to verify if there is something wrong with how I did it.

In addition, out of curiosity, is there an alternate way to have an attack skill that targets enemies also give the skill user a positive state?

I thank you in advanced for reading and responding. Much appreciated!
1) your way of doing it is rather roundabout and can cause timing issues, for example the common event attached to a skill is usually called at the end of turn, not on the skill action itself. and if for example that happened in the last battleturn after all enemies are already killed...

2) yes, there is a much better way to do this - check the Ace areas for a topic "how to use the damage formula" and read there. This topic is also linked in my starting point tutorial because it shows you how to use ruby code inside the damage formula for a lot of effects, including adding user effects to a skill targeted on an enemy.
For adding a state to the user while dealing damage to the enemy, you can use the damage formula.

a.add_state(x); a.atk * 4 - b.def * 2

where x is the id of the state you want to give to the user. The actual damage will be whatever you put after the semi-colon.
1) your way of doing it is rather roundabout and can cause timing issues, for example the common event attached to a skill is usually called at the end of turn, not on the skill action itself. and if for example that happened in the last battleturn after all enemies are already killed...

2) yes, there is a much better way to do this - check the Ace areas for a topic "how to use the damage formula" and read there. This topic is also linked in my starting point tutorial because it shows you how to use ruby code inside the damage formula for a lot of effects, including adding user effects to a skill targeted on an enemy.

Wow. What an informative thread. Definitely book marking it to read through on my down-time. Well done. Thank you, sir!


For adding a state to the user while dealing damage to the enemy, you can use the damage formula.

a.add_state(x); a.atk * 4 - b.def * 2

where x is the id of the state you want to give to the user. The actual damage will be whatever you put after the semi-colon.

Excellent. That is a lot more smoother than I had. Thanks! Works like a charm.

Original thread: https://forums.rpgmakerweb.com/threads/rpg-maker-vx-ace-encountering-a-state-glitch-with-a-common-event-attached-to-a-skill.90420/