Doing something with an Action Sequence... and it's just not working.

Ok, so I'm trying to create an attack where the boss fires off 6 attacks, randomly assigned.
Can't hit dead people.
[Although, no one dies until after the attack, which is kind of a breather.]

I'm using a common event to pick a number between 1 and 4 and if a character is dead at the processing of the event, to exclude them.
This much works. I can reliably generate a random 1-4 and have it exclude results.

And even failing that, I have another event that simply sets the variable random between 1 and 4.

Problem is, no matter the way try to work this, it keeps flopping.
 

Here's the current action sequence.

In the if statements, I've used =, == and ===. None work.  [At this point, I'm throwing code at the wall and seeing if something will stick]
Originally I was getting it hit one or 2 targets but only ever fired off 3 charges, despite there being 6 possibles. [AND it only ever hit actors in slot 2 or 3, even defying the value from the event (no way it was returning 2 or 3 that often)]
Swapped it to "all enemies", and it suddenly clobbered ONE target 6 times in addition to one swipe to the whole party.

Moved the target action to whole action, nothing changed, unless it was scope all targets, where no exceptions, it thwacked the whole party 6 times.

<target action>

hide Battle Hud

tint screen: -255, -255, -255, 255, 30

opacity all members: 0, 30

wait for opacity

action common event

wait: 1

if $gameVariables.value(45)==1

action effect: opponent 1

animation 16: opponent 1

else if $gameVariables.value(45)==2

action effect: opponent 2

animation 16: opponent 2

else if $gameVariables.value(45)==3

action effect: opponent 3

animation 16: opponent 3

else if $gameVariables.value(45)==4

action effect: opponent 4

animation 16: opponent 4

end

wait for animation

action common event

wait: 1

if $gameVariables.value(45)==1

action effect: opponent 1

animation 16: opponent 1

else if $gameVariables.value(45)==2

action effect: opponent 2

animation 16: opponent 2

else if $gameVariables.value(45)==3

action effect: opponent 3

animation 16: opponent 3

else if $gameVariables.value(45)==4

action effect: opponent 4

animation 16: opponent 4

end

wait for animation

action common event

wait: 1

if $gameVariables.value(45)==1

action effect: opponent 1

animation 16: opponent 1

else if $gameVariables.value(45)==2

action effect: opponent 2

animation 16: opponent 2

else if $gameVariables.value(45)==3

action effect: opponent 3

animation 16: opponent 3

else if $gameVariables.value(45)==4

action effect: opponent 4

animation 16: opponent 4

end

wait for animation

action common event

wait: 1

if $gameVariables.value(45)==1

action effect: opponent 1

animation 16: opponent 1

else if $gameVariables.value(45)==2

action effect: opponent 2

animation 16: opponent 2

else if $gameVariables.value(45)==3

action effect: opponent 3

animation 16: opponent 3

else if $gameVariables.value(45)==4

action effect: opponent 4

animation 16: opponent 4

end

wait for animation

action common event

wait: 1

if $gameVariables.value(45)==1

action effect: opponent 1

animation 16: opponent 1

else if $gameVariables.value(45)==2

action effect: opponent 2

animation 16: opponent 2

else if $gameVariables.value(45)==3

action effect: opponent 3

animation 16: opponent 3

else if $gameVariables.value(45)==4

action effect: opponent 4

animation 16: opponent 4

end

wait for animation

action common event

wait: 1

if $gameVariables.value(45)==1

action effect: opponent 1

animation 16: opponent 1

else if $gameVariables.value(45)==2

action effect: opponent 2

animation 16: opponent 2

else if $gameVariables.value(45)==3

action effect: opponent 3

animation 16: opponent 3

else if $gameVariables.value(45)==4

action effect: opponent 4

animation 16: opponent 4

end

wait for animation

</target action>

<follow action>

tint screen: normal, 30

opacity all members: 100%, 30

show battle Hud

wait for opacity

</follow action>
I can say that I've seen the same thing while creating a rapid-fire attack for an actor. Has anyone been able to use this type of stuff successfully?

In terms of setting it to "All enemies," you need to make sure your code is within the <whole action> section. If it's 1 target, use <target action>. That's what I've found to work, anyway.
Please give a link to the plugin you're using to enable action sequences - they don't exist in default, and their coding depends on which plugin you're using for them.

If you're using Yanfly's plugins, make sure that you have the latest versions and explain which addons you've installed.
Sorry about that, I didn't have my information on me at the time.

I'm using Yanfly's plugins, specifically:

  • YEP_CoreEngine          1.10
  • YEP_MessageCore       1.07
  • YEP_BattleEngineCore 1.25a
  • YEP_X_ActSeqPack1    1.09
  • YEP_X_ActSeqPack2    1.05
  • YEP_X_ActSeqPack3    1.02a
  • YEP_SkillCore               1.06a
They're installed in that order. 

My action sequence is as follows: 

<whole action>motion attack: usercommon event: 1if $gameVariables.value(1) == 0 action effect: enemy 1else if $gameVariables.value(1) == 1 action effect: enemy 2else if $gameVariables.value(1) == 2 action effect: enemy 3else if $gameVariables.value(1) == 3 action effect: enemy 4else if $gameVariables.value(1) == 4 action effect: enemy 5else if $gameVariables.value(1) == 5 action effect: enemy 6else if $gameVariables.value(1) == 6 action effect: enemy 7else action effect: enemy 8end</whole action><target action></target action>The issue in my case is that, unless the variable's value is equal to 0, it always targets enemy #2. In the case of 0 it hits enemy #1.

Some notes:

  • Common event 1 sets variable 1 to a random number between 0 and 7. I make sure that it's within the size of the troop's enemies, but the issue isn't with the number generated, it's with the if statements.
  • I output the damage as the variable's value and I've done various "debugging" to make 100% sure that the numbers are being generated correctly
  • I've tested this with any number of enemies between 1 and 8 in a troop and it behaves the same no matter what.
  • The skill is set to affect all enemies, but changing that doesn't really affect anything because of the way I have the sequence written.
I hope that explains the situation well, and sorry again for not being more clear. I appreciate any help that anyone can offer!
I haven't checked anything special, but one possible problem comes to mind: your variable.

Please change the code to use a different variable, at best one with an ID>100 (so that you'll need to add more variables.

The reason is that there are several plugins that needs variables by default, and their default configuration often uses variables 1 following.

If the sequence suddenly works with different variables, you'll know that you have forgotten to configure your other plugins correctly.
This might be weird for me, but when I used the following sequence, I always proc state 131 regardless being affected by state 135 or not.

<follow action>if user.isStateAffected(135)  add state 131: user, showelse if (Math.randomInt(99) < 15)  add state 131: user, showend</follow action>But when I switch to using just if...end, it worked normally.

<follow action>if user.isStateAffected(135)  add state 131: user, showendif (Math.randomInt(99) < 15)  add state 131: user, showend</follow action>It does seem like, similar to yours, if the first condition isnt met, the first else..if will always be true.

Maybe you can switch to using just if...end? You can try this as well, instead of calling a common event to assign the random variable:

Code:
<whole action>motion attack: userchange variable 1 = Math.randomInt(7)if $gameVariables.value(1) == 0  action effect: enemy 1endif $gameVariables.value(1) == 1  action effect: enemy 2endif $gameVariables.value(1) == 2  action effect: enemy 3endif $gameVariables.value(1) == 3  action effect: enemy 4endif $gameVariables.value(1) == 4  action effect: enemy 5endif $gameVariables.value(1) == 5  action effect: enemy 6endif $gameVariables.value(1) == 6  action effect: enemy 7endif $gameVariables.value(1) == 7  action effect: enemy 8end</whole action>
Awesome! That workaround totally works. I changed the variable I use to 101 just in case it would affect anything else, but the if...else definitely doesn't seem to be working correctly. if...end definitely got it working though! Thanks so much!

FYI, the reason I used a common event to generate the number was so that I could check it against which enemies are alive with javascript so that none of the shots get "wasted".

Original thread: https://forums.rpgmakerweb.com/threads/doing-something-with-an-action-sequence-and-its-just-not-working.51392/