Script in Conditional Branch for Common Event

Hiya, I’m not really sure if this is the right place to post this, since it’s a scripting question, but not a plugin one. Anyway…

I’m trying to make a conditional branch in a common event called by a skill, that checks for which actor is using the skill. I’m not 100% sure what I should put as the script call for this specifically.

If it helps any, I’m specifically using the common event on the “Guard” skill that is used when you use the guard command in battle.
Hiya!

Would storing the 'Last Actor to act' ID into a variable and then using that in the conditional branch help in this instance? You find that in Control Variable, and then Game Data, and then Last.
have the skill add an invisible target state in addition of all other effects.
with invisible I mean no messages, no icon, no effect.

then have the common event check which target has the state, and do to it what you want in the branch of that check.

or you can use control variable to check for skill user or skill target (it's one of the new options in MZ)
Thank you both so much! I ended up using “Last Actor to Act” in Control Variables, and it works perfectly. I should really thoroughly look through all of the event commands, as I’m so used to using rm2k3 and XP, and it looks like a lot has changed in almost 20 years 😅
Glad you got it working how you wanted!

And haha, yeah, there's a lot of stuff you can assign to variables these days it's pretty handy and minimises the need to go immediately into scripts as much! Even the jump from MV to MZ added a few as Andar says.

Original thread: https://forums.rpgmakerweb.com/threads/script-in-conditional-branch-for-common-event.168781/