MZ Action Sequence pulling id from actor who used skill?

tl;dr: What script do I need to write into a Conditional Branch in an Action Sequence to have it detect if the user of the skill is affected by a state?

------------------------

So I'm currently working on a skill that toggles a state. Let's call this state Tank Stance. The skill uses an Visustella Action Sequence to check if the actor already has Tank Stance applied and toggles it: if they have that state, the Sequence removes the state, if they don't it applies the state. This behavior works resulting in a toggleable state that buffs the actor it is applied to.

However, with the way things currently work, I have to create a unique Action Sequence and respective skill for each character that I want to have this kind of behavior. ie: Actor A and Actor B both have unique skills, sequences and states that do the exact same thing. Actor B can't use Actor A's skill because it will check if Actor A has the state before applying, not Actor B.

I know that Conditional Branches have an option for a scripted condition, and there is code to check if an actor is affected by a state. However, my skills with Javascript are practically null, so what would I need to write for script to have the conditional branch check for the user of the skill that triggers the Action Sequence? The mechanical commands in action sequences have an option for detecting the user of a skill, so that won't be an issue for me.
If you can get the user, then it's just user.isStateAffected(x) where x is the ID of the state.
Moved to: Plugin Support
If you can get the user, then it's just user.isStateAffected(x) where x is the ID of the state.
I do know about that bit of script; I've used it in damage formulas. The main issue is how to get the user of a skill for the action sequence. I think you can get the actor id into a variable and reference that in script, but the issue is how to get that in the first place.
Oh.
The mechanical commands in action sequences have an option for detecting the user of a skill, so that won't be an issue for me.

The main issue is how to get the user of a skill for the action sequence.
These statements seem contradictory. That's why my answer was going off of what you said in your first post.
Oh.



These statements seem contradictory. That's why my answer was going off of what you said in your first post.
Sorry, I guess they do seem a little contradictory. What I'm trying to get is a reference to the id of an actor for use in a conditional branch in an Action Sequence. In the Plugin Commands of Visustella's Battle Core that are used for Action Sequences, certain commands, like 'Add State' have a field that lets you select who is getting targeted by the mechanics of that specific command (Continuing with the example, 'Add State' has the target field, which can be set to the user of the skill, and the field that contains the id of the state you want to apply). What I was trying to accomplish is getting an actor's id (the user of the skill) as a reference so that I could use it in a Conditional Branch inside the Action Sequence for checking if the user was affected by the state the Sequence applies. By default, a conditional Branch can only be set to detect a specific actor, not check an actor based on a variable declaring their id

I did a little digging and found two ways I could set an actor's Id to a variable: one is just using MZ's Eventing, the other was (at least it looked like it was) the script line

$gameVariables.setValue(1,user.actorId)

I thought running that code in a Pre-Start Action notetag from Battle Core would would, and that the scripting for the conditional branch would be

$gameActors.actor($gameVariable.value(1)).isStateAffected(#)

where the '#' would be the number of the state being checked. But when I tried using the skill, using both methods to try and get the user's id, I get the same error in the console:

ReferenceError: $gameVariable is not defined

So, I think I'm on the right track, since it seems to be checking the variable, but I have no idea what I might be doing wrong in getting the reference.
Try it again, using $gameVariables.value(1) instead of $gameVariable.value(1)
ReferenceError: $gameVariable is not defined

So, I think I'm on the right track, since it seems to be checking the variable, but I have no idea what I might be doing wrong in getting the reference.
Exactly what it says in the error - you typed Variable instead of Variables.
I did a little digging and found two ways I could set an actor's Id to a variable: one is just using MZ's Eventing, the other was (at least it looked like it was) the script line

$gameVariables.setValue(1,user.actorId)
That all depends on whether "user" is a valid reference to the current actor (which it isn't, unless the VisuStella system has modified it).

But setting the variable via event command and then doing what you were doing before, but with the correct syntax, should work.
Exactly what it says in the error - you typed Variable instead of Variables.

That all depends on whether "user" is a valid reference to the current actor (which it isn't, unless the VisuStella system has modified it).

But setting the variable via event command and then doing what you were doing before, but with the correct syntax, should work.
It was literally the fact that I forgot the 's' at the end of 'Variables'. I hate how my mind skips things sometimes. :hswt:

Thanks for the help!

Original thread: https://forums.rpgmakerweb.com/threads/action-sequence-pulling-id-from-actor-who-used-skill.140408/