MV Yanfly Action Sequence multiple IF conditions?

i was just wondering if you can add multiple if conditions on an action sequence, had the idea of adding small animation flourishes to some of the skills but i wanted to them to trigger into certain conditions

for example the first one im working i want it to trigger if the skill kills the enemy while a certain status effect is applied on said enemy, but im not actually not that knowledgeable on scripts, only "if" condition i used was one for a chance apply a status effect on a skill that has multiple hits

1759354627392.png


what'd be the best approach to do multiple conditions?
Short answer.... Yes, you can

This is my normal attack sequence:

<setup action>
display action
wait: 25
CLEAR BATTLE LOG
CAMERA FOCUS: user, CENTER, 75
ZOOM: 150%, 75
wait: 40
</setup action>
<target action>
face user: target
ZOOM: 200%, 75
CAMERA FOCUS: target, center, 30
MOTION WALK: user
move user: target, front, 30
face user: target
wait for movement
face user: target
motion attack: user
wait: 1
if $gameActors.actor(2).isStateAffected(44) || $gameActors.actor(2).isStateAffected(16)
animation 469: target
else if $gameActors.actor(2).isStateAffected(45) || $gameActors.actor(2).isStateAffected(17)
animation 470: target
else if $gameActors.actor(2).isStateAffected(46) || $gameActors.actor(2).isStateAffected(18)
animation 471: target
else if $gameActors.actor(2).isStateAffected(47) || $gameActors.actor(2).isStateAffected(19)
animation 472: target
else if $gameActors.actor(2).isStateAffected(48) || $gameActors.actor(2).isStateAffected(20)
animation 473: target
else if $gameActors.actor(2).isStateAffected(49) || $gameActors.actor(2).isStateAffected(21)
animation 474: target
else
action animation: target
end
wait for animation
action effect
face user: target
wait: 10
</target action>
<finish action>
move user: home
wait for movement
face user: forward
reset camera
reset zoom
wait for zoom
show battle hud
</finish action>
Short answer.... Yes, you can

This is my normal attack sequence:
i see, so to do multiple conditions do i gotta add || per condition?
also how would i check if an enemy died to the attack in the action sequence
i see, so to do multiple conditions do i gotta add || per condition?
Yanfly's AS system isnt JS, but certain commands read JS - like IFs. logical operations like OR (||) and AND (&&) can be used in them.
a restriction to keep in mind is that you cant nest IFs without a separate plugin.
also how would i check if an enemy died to the attack in the action sequence
if your skills hit once, you can just check if the target's hp hit 0. targets arent killed immediately with yanfly's battle core is active, so you cant directly check if they died mid skill
Yanfly's AS system isnt JS, but certain commands read JS - like IFs. logical operations like OR (||) and AND (&&) can be used in them.
a restriction to keep in mind is that you cant nest IFs without a separate plugin.

if your skills hit once, you can just check if the target's hp hit 0. targets arent killed immediately with yanfly's battle core is active, so you cant directly check if they died mid skill
so would my formula look something like this?


Code:
if  b.isStateAffected(0) && b.isStateAffected(11)  
    wait: 32
    animation 902: target
    wait for animation
    animation 220: character 1
    animation 220: character 3
    wait for animation
i know little to nothing about script stuff so i dont know what's amiss since rn this isnt doing anything when i test the skill, tried to make it check the dead status effect along the other one since i dont know what i gotta write to check if the enemy has 0 hp
If I'm not mistaken, you might not be able to check for the knockout state, since that state basically removes the enemy.

What you can do is what yanfly recommends: Put
Code:
Immortal: targets, true
somewhere at the start of your sequence. With this the enemy will not die, even when at 0 HP.

You condition can then just check for the 0 hp instead of the death state and you can just use
Code:
Immortal: targets, false
whenever you want the enemy to then die. (Like somewhere in that condition)

I don't remember if a. and b. actually worked in action sequencing, so if my suggestion doesn't work, you can then try and use
Code:
target.isStateAffected(x)
instead and see if that helps.

if your skills hit once, you can just check if the target's hp hit 0. targets arent killed immediately with yanfly's battle core is active, so you cant directly check if they died mid skill
That is incorrect. They will die the moment their HP hits zero, and depending on whether or not you used the death break command, the sequence will just keep flailing on the corpse. You have to use immortal targets as described above.

Edit: Not quite incorrect. Apparently there is a default setup action that automatically turns enemies immortal, so if you don't have your own <setup action> in your sequence, enemies are actually immortal automatically.
isnt doing anything when i test the skill, tried to make it check the dead status effect along the other one
yeah, i avoided mentioning checking for the death state (state 1 btw, not 0) because the default setup action makes targets immortal and immune to it. It slipped my mind that you could just turn it off though, so you could use the command SGHarlekin shared to turn it off or make a setup effect that doesnt make the targets immortal and then check if they have state 1 at some point afterwards once the damage is done.

that being said, a battler loses all of their states when they die without additional plugins, so checking for state 1 AND state 11 shouldnt be able to give you a true result.

i dont know what i gotta write to check if the enemy has 0 hp
im also not sure if action sequences recognize a and b as the user and the target, but it would just be target.hp === 0
If I'm not mistaken, you might not be able to check for the knockout state, since that state basically removes the enemy.

What you can do is what yanfly recommends: Put
Code:
Immortal: targets, true
somewhere at the start of your sequence. With this the enemy will not die, even when at 0 HP.

You condition can then just check for the 0 hp instead of the death state and you can just use
Code:
Immortal: targets, false
whenever you want the enemy to then die. (Like somewhere in that condition)

I don't remember if a. and b. actually worked in action sequencing, so if my suggestion doesn't work, you can then try and use
Code:
target.isStateAffected(x)
instead and see if that helps.


That is incorrect. They will die the moment their HP hits zero, and depending on whether or not you used the death break command, the sequence will just keep flailing on the corpse. You have to use immortal targets as described above.

Edit: Not quite incorrect. Apparently there is a default setup action that automatically turns enemies immortal, so if you don't have your own <setup action> in your sequence, enemies are actually immortal automatically.
yeah, i avoided mentioning checking for the death state (state 1 btw, not 0) because the default setup action makes targets immortal and immune to it. It slipped my mind that you could just turn it off though, so you could use the command SGHarlekin shared to turn it off or make a setup effect that doesnt make the targets immortal and then check if they have state 1 at some point afterwards once the damage is done.

that being said, a battler loses all of their states when they die without additional plugins, so checking for state 1 AND state 11 shouldnt be able to give you a true result.


im also not sure if action sequences recognize a and b as the user and the target, but it would just be target.hp === 0
alright, after reading all of this and messing with the action sequence plenty i ended with something like this:

<setup action>
display action
immortal: targets, true
camera clamp on
camera focus: target, center, 5
camera offset: down, 48
zoom: 110%, 5
</setup action>

<target action>
opacity not focus: 10%, 5
animation 42: target
animation 43: target
zoom: 120%, 5
wait: 20
zoom: 130%, 5
wait: 32
zoom: 140%, 5
wait: 32
zoom: 150%, 5
wait: 20
shake screen: 20, 23, 10
if target.isStateAffected(12)
action effect: target
reset camera: 5
reset zoom: 5
if target.hp === 0
immortal: targets, false
wait: 32
animation 902: target
wait: 32
shake screen: 6, 23, 10
wait for animation
animation 220: character 1
animation 220: character 3
wait for animation
else
action effect: target
reset camera: 5
reset zoom: 5
end
wait for animation
opacity not focus: 100%, 5
</target action>

<finish action>
clear battle log
</finish action>

i tried to experiment putting multiple if's in sequence worked and im glad it turned out well (also another error was me indicating the wrong state whoops), the lil extra flair doesnt play when the state is not applied nor the skill kills the enemy so i managed to get it how i wanted

bandicam_2025-10-02_07-44-56-216_online-video-cutter.com.gif


thank you for the help! though i do have one last question, how do i find conditions for all these scripts? i dont wanna ask each time im stuck not finding a condition so i wonder if theres somewhere in rpg maker documentation where i can find checks like these in case i need something like "oh i gotta check if enemy has a certain skill, etc."

Stuff like this, cuz it doesnt come in yanfly's action sequence, only tells me i can do IF statements wich is how i tried doing this
target.isStateAffected(12)
target.hp === 0
i know little to no scripting, im much more of an artist so i struggle with a lot of programming stuff but i need to know some of this if i want to keep having strong visual stuff like i want for my game so itd be a lot of help.
thank you for the help! though i do have one last question, how do i find conditions for all these scripts? i dont wanna ask each time im stuck not finding a condition so i wonder if theres somewhere in rpg maker documentation where i can find checks like these in case i need something like "oh i gotta check if enemy has a certain skill, etc."
the script call list is pinned in this section and is a large list of calls you can use anywhere JS is allowed. theres examples of them being used, but these are all stuff thats in the base engine.

since youre using them in conjunction with yanfly's plugins, theres some yanfly specific stuff that wouldnt be there and may be relevant to what youre doing though. like, yanfly notetags generally provide user and target references that you can use in place of battler, $gameParty.members()[x], $gameParty.leader(), $gameActors.actor(x), or whatever else is shown in the examples on the sheet

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-action-sequence-multiple-if-conditions.180374/