Skip actor's turn via script

I'm using Yanfly's CTB system and I need to make so if a player as a certain state (stunned for example) the code automatically ends its turn. I tried calling a few BattleManager and Scene_Battle methods, I also tried to force the actor to use a spell that does nothing if he's stunned but when I try to call it in my plugin the best I could get is him starting to use it and the game locking before the animation.

Anyone can help?
Thank you
Wouldn't the actor's turn be skipped automatically if stunned or inflicted with a "can not move" state?
Yes, but the plugin doesn't work with that unfortunately, also Yanfly stopped supporting it. It just simply ignores the cannot move state

Original thread: https://forums.rpgmakerweb.com/threads/skip-actors-turn-via-script.79828/