MZ Cast a skill at the end of the turn.

Hi. Sry for bad English. I am using Visu Atb plugin,
and I am trying to create a skill that: create a field damage that damage all enemies at the end of the turn, last 5 turns.
My way of doing this for now is : apply a state to the user, and force action at the end of each turn using state notetag.
My problem is that: 1)this extra cast will comsumes a turn
2)any notetag i find force an action at the start of the turn instead of the end of the turn.
this create a effect that this extra cast will keep repeat itself until all 5 turn of the state is used up.
Note tag that I have tried are : <JS Post-End Action> <JS Post-End Turn> from visu battle core, <Turn End Eval> <Action After Eval> from Eval tags.
I have also tried using 2 instant cast plugin but they all dont seems to work under atb.
I have though of play animation and deal damage directly from state notetag but i am not sure how to do that. Any idea why all notetag i use trigger at the start of the turn? or any other way I can do this skill? thanks.
I'm not quite sure if I get what you are asking for, but I'll answer what I think you are asking.

You want a skill that will apply a state to the user that will last for 5 turns. For fun let's call the state Damage Aura. This Damage Aura state will damage all enemies at the end of the users turn.

First we'll need the state. I'll use spot 35 in the database. With the auto removal timing set to 'Action End' and Duration set to '5' ~ '5'.

Next we need a skill that will add the Damage Aura state to the user. Let's create a skill called Miasma. Making sure that the skill is set to Scope: 'The User' and under effects we have Add State: '35 Damage Aura' at 100%.

Now the way I did this was to add the javascript <JS Pre-End Turn> to the Class of the user. So in this example Class '0001 Swordsman' has the Miasma skill added at Level 1. And in the note field I added the following:
Code:
<JS Pre-End Turn>
//Check for Damage Aura State
if (user.isStateAffected(35))
{
  //Add immortal State to all enemies for proper collapse effect
  $gameTroop.members().forEach(enemy => {enemy.addState(3)});
  //Damage Mechanic
  $gameTroop.members().forEach(enemy => {enemy.gainHp(-100)});
  //Check For enemies that have been killed by the Damage Aura and collapse them
  for (var i=0; i<$gameTroop.aliveMembers().length; i++)
  {
    if ($gameTroop.aliveMembers()[i].hp<=0) {$gameTroop.aliveMembers()[i].performCollapse();}
  }
  //Remove immortal state from all enemies
  $gameTroop.members().forEach(enemy => {enemy.removeState(3)});
}
</JS Pre-End Turn>

Now upon entering battle and using the skill Miasma you'll find that at the end of the turn, all enemies will have their hp decreased by 100. If the state kills them, the normal collapse effect will happen as well.

I'm currently unaware of how to make this instant cast using Visustella's ATB battle system. Some of their other Systems like OTB have the instant cast function. But with this example, you'll only lose the one turn to casting this skill and will be able to do regular battle actions once having the state.

Of course you may want to play with the damage mechanic and possibly add an animation or something. But this gives a starting point.

Edit: Fixed copy paste error and added comments to Javascript Code
I'm not quite sure if I get what you are asking for, but I'll answer what I think you are asking.

You want a skill that will apply a state to the user that will last for 5 turns. For fun let's call the state Damage Aura. This Damage Aura state will damage all enemies at the end of the users turn.

First we'll need the state. I'll use spot 35 in the database. With the auto removal timing set to 'Action End' and Duration set to '5' ~ '5'.

Next we need a skill that will add the Damage Aura state to the user. Let's create a skill called Miasma. Making sure that the skill is set to Scope: 'The User' and under effects we have Add State: '35 Damage Aura' at 100%.

Now the way I did this was to add the javascript <JS Pre-End Turn> to the Class of the user. So in this example Class '0001 Swordsman' has the Miasma skill added at Level 1. And in the note field I added the following:
Code:
<JS Pre-End Turn>
//Check for Damage Aura State
if (user.isStateAffected(35))
{
  //Add immortal State to all enemies for proper collapse effect
  $gameTroop.members().forEach(enemy => {enemy.addState(3)});
  //Damage Mechanic
  $gameTroop.members().forEach(enemy => {enemy.gainHp(-100)});
  //Check For enemies that have been killed by the Damage Aura and collapse them
  for (var i=0; i<$gameTroop.aliveMembers().length; i++)
  {
    if ($gameTroop.aliveMembers()[i].hp<=0) {$gameTroop.aliveMembers()[i].performCollapse();}
  }
  //Remove immortal state from all enemies
  $gameTroop.members().forEach(enemy => {enemy.removeState(3)});
}
</JS Pre-End Turn>

Now upon entering battle and using the skill Miasma you'll find that at the end of the turn, all enemies will have their hp decreased by 100. If the state kills them, the normal collapse effect will happen as well.

Of course you may want to play with the damage mechanic and possibly add an animation or something. But this gives a starting point.

Edit: Fixed copy paste error and added comments to Javascript Code
This is exactly what I am asking and the code works very well! The only problem left is that the damage stills happen at the start of the turn. Probably because i am using atb system but it's good enough for now. Thanks very much!
This is exactly what I am asking and the code works very well! The only problem left is that the damage stills happen at the start of the turn. Probably because i am using atb system but it's good enough for now. Thanks very much!
Whoops, some how the project I was testing on didn't use the ATB plugin properly.
On testing a new project, what you want is to switch
Code:
<JS Pre-End Turn>
 code
 code
 code
</JS Pre-End Turn>

for

Code:
<JS Post-End Action>
 code
 code
 code
</JS Post-End Action>

This should make it work at the end of the users turn. Or at least it did for me
Whoops, some how the project I was testing on didn't use the ATB plugin properly.
On testing a new project, what you want is to switch
Code:
<JS Pre-End Turn>
 code
 code
 code
</JS Pre-End Turn>

for

Code:
<JS Post-End Action>
 code
 code
 code
</JS Post-End Action>

This should make it work at the end of the users turn. Or at least it did for me
It works. Thanks very much!
Glad it works!

One last thing. If you still want to make it instant cast simply add
Code:
<ATB After Gauge: +100%>
to the skill's Note area
I'm not quite sure if I get what you are asking for, but I'll answer what I think you are asking.

You want a skill that will apply a state to the user that will last for 5 turns. For fun let's call the state Damage Aura. This Damage Aura state will damage all enemies at the end of the users turn.

First we'll need the state. I'll use spot 35 in the database. With the auto removal timing set to 'Action End' and Duration set to '5' ~ '5'.

Next we need a skill that will add the Damage Aura state to the user. Let's create a skill called Miasma. Making sure that the skill is set to Scope: 'The User' and under effects we have Add State: '35 Damage Aura' at 100%.

Now the way I did this was to add the javascript <JS Pre-End Turn> to the Class of the user. So in this example Class '0001 Swordsman' has the Miasma skill added at Level 1. And in the note field I added the following:
Code:
<JS Pre-End Turn>
//Check for Damage Aura State
if (user.isStateAffected(35))
{
  //Add immortal State to all enemies for proper collapse effect
  $gameTroop.members().forEach(enemy => {enemy.addState(3)});
  //Damage Mechanic
  $gameTroop.members().forEach(enemy => {enemy.gainHp(-100)});
  //Check For enemies that have been killed by the Damage Aura and collapse them
  for (var i=0; i<$gameTroop.aliveMembers().length; i++)
  {
    if ($gameTroop.aliveMembers()[i].hp<=0) {$gameTroop.aliveMembers()[i].performCollapse();}
  }
  //Remove immortal state from all enemies
  $gameTroop.members().forEach(enemy => {enemy.removeState(3)});
}
</JS Pre-End Turn>

Now upon entering battle and using the skill Miasma you'll find that at the end of the turn, all enemies will have their hp decreased by 100. If the state kills them, the normal collapse effect will happen as well.

I'm currently unaware of how to make this instant cast using Visustella's ATB battle system. Some of their other Systems like OTB have the instant cast function. But with this example, you'll only lose the one turn to casting this skill and will be able to do regular battle actions once having the state.

Of course you may want to play with the damage mechanic and possibly add an animation or something. But this gives a starting point.

Edit: Fixed copy paste error and added comments to Javascript Code

I'm trying to do something similar in my game and am kinda new to plugins so sorry if this is a dumb question.

One of the characters I'm trying to make has sort of a "ward" gimmick. She can place wards on allies that will give positive benefits at the end of each turn (heal HP, cure status effects, etc) or place ones on enemies that hurt them, namely by activating a skill at end of turn (for example, let's say the enemy ward will make them get hit by the Fire 1 skill at end of each turn, with the character who placed the ward being referenced for m.atk stat in damage calculation).

Will this work for that? I'd want the skill animation and damage effect to play at this time for all enemies affected by the skill so simply making the state have a negative HP regen affect wouldn't work.

@TheSib, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/cast-a-skill-at-the-end-of-the-turn.178068/