MV Action Sequence, Multiple party members attack.

I want to have a skill that forces party members to attack IF they have a certain status effect on them. (like stieners charge from ff9 (but with a state))

I have it working somewhat, but the script does not wait for the attack to end before running the rest of the script.
So what ends up happing is only the last eligible party member attacks.
(script is in the follow up action)

```

JavaScript:
<Counter Name: Counter>

[SIZE=12px] <setup action>

      clear battle log

      display action

      immortal: targets, true

      perform start

      wait for movement

      cast animation

      wait for animation

    </setup action>



    <whole action>

    </whole action>



    <target action>

      wait: 6

      motion attack: user

      wait: 6



      action animation: target

      animation wait: 6

      shake screen: 7, 6, 35

      wait for animation

      action effect

      wait for effect

    </target action>



    <follow action>

      CHANGE VARIABLE 1 = 1

      ACTION COMMON EVENT

             CHANGE VARIABLE 1 = 2

      ACTION COMMON EVENT
      CHANGE VARIABLE 1 = 3

      ACTION COMMON EVENT

    </follow action>



    <finish action>

      immortal: targets, false

      wait for new line

      clear battle log

      perform finish

      wait for movement

      wait for effect[/SIZE]

    </finish action>
```
and the common event is.

```
JavaScript:
$gameTemp._actorId = $gameVariables.value(1)

console.log($gameTemp._actorId);

    if($gameParty.battleMembers().contains($gameActors.actor($gameParty.battleMembers()[$gameTemp._actorId-1].actorId()))&& $gameParty.battleMembers()[$gameTemp._actorId-1]._passiveStatesRaw.includes(26))

    {

    //$gameActors.actor(2).forceAction(46, 1);

    //BattleManager.forceAction($gameActors.actor(2));

    $gameActors.actor($gameTemp._actorId).forceAction(1, 1);

    BattleManager.forceAction($gameActors.actor($gameTemp._actorId));

    }
That's curious, since the documentation says it should wait for the common event to finish. However...

Have you tried simply putting in a wait command if you want it to wait? You're doing it above, when you wait for animation and wait for effect, but then you're calling this common event that does stuff and you're not telling it to wait 😛

Just time how long the other skill takes to resolve, and put a wait: x command in, where x is seconds * 60.
Right? The documentation says it’ll wait.
Even putting a wait between common event calls gives the same weird response.
Have you tried taking the code out of a common event and just doing it with action sequence commands?
doing the following still only has the last target attack. so in this case, actor 2.
<follow action>

CHANGE VARIABLE 1 = 3
eval: $gameActors.actor($gameVariables.value(1)).forceAction(1, 1); BattleManager.forceAction($gameActors.actor($gameVariables.value(1)));
wait: 120
CHANGE VARIABLE 1 = 2
eval: $gameActors.actor($gameVariables.value(1)).forceAction(1, 1); BattleManager.forceAction($gameActors.actor($gameVariables.value(1)));
</follow action>
So it looks like one of the main issues i was running into was testing it via a force action and not as a skill attack.
So the next issue is, after forcing an actor to attack, it counts as a turn and all buffs and ailments tick.
Im just gonna have them swing there weapon and say its an attack>
It there an easy way in action sequence to check if an actor is able to move / attack?
So when I suggested putting it into your action sequence, I meant the entirety of whatever those other skills you're forcing them to do.

If you try to do two force actions like that at the same time, they go into a queue and only the last one resolves, as you observed. I'd just duplicate what those other skills are supposed to be doing within this action sequence.

It there an easy way in action sequence to check if an actor is able to move / attack?
Yes? What would prevent the actor from moving or attacking? If you have states that do so, you'd just check whether the actor has any of those states. That's pretty easy.
I meant if there was a catch all function that checked if an actor was able to move.
I got it figured out now thanks. This can be closed.

//this checks if a party member has a current state, if so swing there weapon to 'attack' with everybody else.
//Game variable 1 is used in lue of nested if statements and game variable 2 counts how many users are in the checked state.
//This variable is used in the damage calculation.
//This is the script unminified.
$gameVariables.value(1) < $gameParty.members().length && $gameParty.battleMembers()[$gameVariables.value(1)]._passiveStatesRaw.includes(26)
? (console.log("true"), $gameVariables.setValue(2, $gameVariables.value(2) + 1), $gameVariables.setValue(1, 1))
: $gameVariables.setValue(1, 0);

//setupaction code.
JavaScript:
<setup action>
     clear battle log
      display action
      MOTION STANDBY: user
      immortal: targets, true


CHANGE VARIABLE 1 = 0
CHANGE VARIABLE 2 = 1
eval: $gameVariables.value(1)<$gameParty.members().length&&$gameParty.battleMembers()[$gameVariables.value(1)]._passiveStatesRaw.includes(26)?(console.log("true"),$gameVariables.setValue(2,$gameVariables.value(2)+1),$gameVariables.setValue(1,1)):$gameVariables.setValue(1,0);
     if $gameVariables.value(1) > 0
     MOTION SWING: actor 0
     end
CHANGE VARIABLE 1 = 1
eval: $gameVariables.value(1)<$gameParty.members().length&&$gameParty.battleMembers()[$gameVariables.value(1)]._passiveStatesRaw.includes(26)?(console.log("true"),$gameVariables.setValue(2,$gameVariables.value(2)+1),$gameVariables.setValue(1,1)):$gameVariables.setValue(1,0);
     if $gameVariables.value(1) > 0
     MOTION SWING: actor 1
     end
     CHANGE VARIABLE 1 = 2
eval: $gameVariables.value(1)<$gameParty.members().length&&$gameParty.battleMembers()[$gameVariables.value(1)]._passiveStatesRaw.includes(26)?(console.log("true"),$gameVariables.setValue(2,$gameVariables.value(2)+1),$gameVariables.setValue(1,1)):$gameVariables.setValue(1,0);
     if $gameVariables.value(1) > 0
     MOTION SWING: actor 2
     end
     CHANGE VARIABLE 1 = 3
eval: $gameVariables.value(1)<$gameParty.members().length&&$gameParty.battleMembers()[$gameVariables.value(1)]._passiveStatesRaw.includes(26)?(console.log("true"),$gameVariables.setValue(2,$gameVariables.value(2)+1),$gameVariables.setValue(1,1)):$gameVariables.setValue(1,0);
     if $gameVariables.value(1) > 0
     MOTION SWING: actor 3
     end
    </setup action>

Original thread: https://forums.rpgmakerweb.com/threads/action-sequence-multiple-party-members-attack.147794/