Changing skill animation each time it's used?

Hi everyone i'm making a skill that con only be used three times in battle and each time it's used it changes the animation progressively, so not randomly picking between some, how can i do this? i tought about simply doing a common event that forgets the skill and learns a copy of it with a different animation, but that re-arranges it in the skill list and it's a bit ugly 😩
Yanfly action sequences
Yanfly action sequences
How would you go about this? i do have the plugin and kind of understand it, but a whole action notetag can't change the skill's animation on the next time it is used i think
Instead of using the action animation, can't you put a conditional there to use an animation depending on a variable? Increase a variable at the start, if it's 1->anim1, 2->anim2, 3->anim3 + set it to 0
Instead of using the action animation, can't you put a conditional there to use an animation depending on a

What you mean is i i'd replace the action animation part with a line that checks a variable, that variable would have a number from 1 to 3 based on how many times the skill was used since the start of the battle, and depending on the number, play the corresponding animation?

<WholeAction>

perform action

motion wait: user

action animation

action effect

death break

</WholeAction>

sorry i really only know the basic commands, and i've never really used variables, if it's not too much to ask, what should i write in the note tag?
i tought about simply doing a common event that forgets the skill and learns a copy of it with a different animation, but that re-arranges it in the skill list and it's a bit ugly
I think this is how I'd do it, but along with something to make it not be rearranged in the spell list. I generally use my plugin SFG_SortKeys to control what order skills are listed in.
You can simply increase a variable inside the sequence via:
Code:
eval: $gameVariables.setValue(ID, $gameVariables.value(ID) + 1);
and use animation x: target instead of action animation to define a specific one.
Then you'd put a conditional branch in your sequence, checking for the value of said variable like:
Code:
eval: $gameVariables.setValue(ID, $gameVariables.value(ID) + 1);
if $gameVariables.value(ID) === 1
    animation X: target
end
if $gameVariables.value(ID) === 2
    animation Y: target
end
if $gameVariables.value(ID) === 3
    animation Z: target
    $gameVariables.setValue(ID, 0);
end
action effect

On your final variation you then simply reset the variable to 0, so the next time the skill is used it will start over from the first animation.
You can simply increase a variable inside the sequence via:
Code:
eval: $gameVariables.setValue(ID, $gameVariables.value(ID) + 1);
and use animation x: target instead of action animation to define a specific one.
Then you'd put a conditional branch in your sequence, checking for the value of said variable like:
Code:
eval: $gameVariables.setValue(ID, $gameVariables.value(ID) + 1);
if $gameVariables.value(ID) === 1
    animation X: target
end
if $gameVariables.value(ID) === 2
    animation Y: target
end
if $gameVariables.value(ID) === 3
    animation Z: target
    $gameVariables.setValue(ID, 0);
end
action effect

That way the variable, and therefore the animation that will be played changes depending on the value. On your final variation you then simply reset the variable to 0, so the next time the skill is used it will start over from the first animation.
Works flawlessly thank you 😀
Works flawlessly thank you 😀
Keep in mind that this variable will be persistent across multiple battles. If you want the skill to reset after each battle, you will have to reset it to 0 after each battle.
Keep in mind that this variable will be persistent across multiple battles. If you want the skill to reset after each battle, you will have to reset it to 0 after each battle.
Actually i wanted it just like this, and then be able to make a save point that resets it, also i didn't mention i needed to seal the skill after the 3 animations, i've managed to do it, so that when you go to this save point the skill is unsealed again, tough after that for some reason it doesen't play the animation anymore:
Skill tag
Code:
<Target Action>
perform action
motion wait: user
eval: $gameVariables.setValue(1, $gameVariables.value(1) + 1);
if $gameVariables.value(1) === 1
    common event: 13 (these only call for animations)
end
if $gameVariables.value(1) === 2
    common event: 13
end
if $gameVariables.value(1) === 3
    common event: 13
    common event: 14 (these calls for the seal state, it stayes even afte battle)
    $gameVariables.setValue(1, 0);
end
wait: 145
action effect
action effect
death break
</Target Action>

Save point that resets:
1772357579947.png

I believed putting the - 3 would reset the valuable so that the animations play in order again next time, tough maybe this isn't how it should be written
Skill tag
Code:
<Target Action>
perform action
motion wait: user
eval: $gameVariables.setValue(1, $gameVariables.value(1) + 1);
if $gameVariables.value(1) === 1
    common event: 13 (these only call for animations)
end
if $gameVariables.value(1) === 2
    common event: 13
end
if $gameVariables.value(1) === 3
    common event: 13
    common event: 14 (these calls for the seal state, it stayes even afte battle)
    $gameVariables.setValue(1, 0);
end
wait: 145
action effect
action effect
death break
</Target Action>

Save point that resets:
View attachment 361845
I believed putting the - 3 would reset the valuable so that the animations play in order again next time, tough maybe this isn't how it should be written
Why would you use a script for that? and why reduce it by a fixed number instead of setting the value straight to 0?

While technically doing -3 would work, it's not a good practice. If anything ever goes wrong with the variable and it somehow ends up being 4 for example, doing -3 will only set it back to 1 and now the skill can only be used twice. It's better practice to actually reset it.
1772368969537.png


In terms of sealing the skill, you could use yanfly's skill core plugin to make a custom requirement notetag based on that variable so that the skill will just become unavailable as soon the the variable is 3. May be a more elegant solution than whatever you evented. Something to condsider.
1772369178641.png

The notetag should then be something like:
Code:
<Custom Requirement>
value = $gameVariables.value(X) !== 3;
</Custom Requirement>
Why would you use a script for that? and why reduce it by a fixed number instead of setting the value straight to 0?

While technically doing -3 would work, it's not a good practice. If anything ever goes wrong with the variable and it somehow ends up being 4 for example, doing -3 will only set it back to 1 and now the skill can only be used twice. It's better practice to actually reset it.
View attachment 361850

In terms of sealing the skill, you could use yanfly's skill core plugin to make a custom requirement notetag based on that variable so that the skill will just become unavailable as soon the the variable is 3. May be a more elegant solution than whatever you evented. Something to condsider.
View attachment 361851
The notetag should then be something like:
Code:
<Custom Requirement>
value = $gameVariables.value(X) !== 3;
</Custom Requirement>
Yeah not sure why i used the script, the variable switch just flew over my mind, and it is way tidier with the custom requirement, apprecciate the tip 👍

Original thread: https://forums.rpgmakerweb.com/threads/changing-skill-animation-each-time-its-used.182639/