MZ [SOLVED] Help with trying to make a skill like yawn from pokemon.

I've been try to create a skill like yawn from pokemon. (After 3 turns the target of the the yawn falls asleep.)
I have hit a roadblock when it come to the the code of the state however, and cannot seem to get the sleep state to trigger on the target of the droway state.

I believe the error is coming from the on Erase State, I cannot figure out how to get it so the sleep effect isn't instantly removed.

If anyone knows away to fix this or has an easier way please let me know.

JavaScript:

<JS On Add State>

user.clearActions();

let text = `<CENTER>${target.name()} will fall Asleep in 3 turns.`;

SceneManager._scene._logWindow._lines.push(text);

SceneManager._scene._logWindow.refresh();

</JS On Add State>



<JS On Erase State>

console.log("Applying state 10 to", target.name());

target.addState(10);

</JS On Erase State>

**EDIT**
I figured out the issue had to do with the fact I had remove by restriction selected on my sleep state, which was causing an automatic removal effect.
you havent mentioned it and this isnt the plugin support section so I have to ask to be sure - you are using visustella's skills and states plugin, right?
you havent mentioned it and this isnt the plugin support section so I have to ask to be sure - you are using visustella's skills and states plugin, right?

I am using Visustella, i have resolved my issue though.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-help-with-trying-to-make-a-skill-like-yawn-from-pokemon.178771/