MZ Script call if targeting ally change skill action sequence

As for the title. i am using Visustella battle core and making my custom action sequence. so when my character party is on confusion state i want it when attacking ally party member using different action sequence i made and not using default attack action sequence when attacking enemies. is there any way to make it work. do i have to make attack sequence using branch when targeting ally ?
Well yeah, if you want to have 2 distinct sequences depending on the target, you'll need a conditional branch in your sequence. I think you should be able to just use a conditional branch, using the script option and putting
Code:
target.isActor()
Greetings,

So I don't believe action sequences have access to user or target unfortunately (for example, user.isStateAffected(39), I tested them both and it always returns undefined when using them in a conditional branch, and then the action sequence fails to execute after that. I'm sure there is a way to do this, and maybe someone will hop in and share their knowledge here, as I am still very much a padawan when it comes to coding.

Do you need a whole new action sequence for a normal attack while a character is confused?

One thing you could do is use a JS notetag provided by the battle core in the notetag box of the skill you use for Attack, to do what you want.

For example, you could do this:

<JS Pre-Start Action>
if (user.isStateAffected(39)) {
user.addState(40);
}
</JS Pre-Start Action>

This will apply a a new state to the user if they have another state already applied. So, for example, you could apply "Rampaging" (40) if a user tries to attack while "Confused" (39), or something like that.
I'm sure there is a way to do this
iirc, VS action sequences have $subject and $target as references to the user and target
iirc, VS action sequences have $subject and $target as references to the user and target
That's what it is! Now that you say that I am 100% experiencing deja vu, I believe I ran into a very similar issue earlier in development and had a conversation about what I thought was a bug, but turned out I needed the $.
iirc, VS action sequences have $subject and $target as references to the user and target
So how to use the script call. for example when my character is affected by confusion state and when randomly attacking any enemies it will use normal attack action sequence i made. but when attacking ally member it will using another sequence i prepared when attacking ally so it not used normal attack like when attacking enemies ?. sorry for making a fuss i really had a dense knowledge about scripting 😅

Original thread: https://forums.rpgmakerweb.com/threads/script-call-if-targeting-ally-change-skill-action-sequence.180869/