Needing help with a proccing state

I am using a skill called Narcolepsy.

It inflicts its own state and what I want it to do is to have a 25% chance every time the afflicted's turn comes to put them into the sleep state.

I have another skill that attempts the same thing with stun.

So I'm needing to know how I can roll that chance on their turn and, if applicable, put the state on them before their attack.
meh, looks like I'll just have to revise this skill into something much less unique. :/
Would this work?

Skill

img-7.png

State

img-6.png # EDIT: ignore the parameter set here, this can just as easily be empty.

Insert this scriptlet below materials, replacing 28 and 6 with the ids of the Narcolepsy state and Sleep state respectively:

class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # * Start Turn #-------------------------------------------------------------------------- def turn_start @party_command_window.close @actor_command_window.close @status_window.unselect @subject = nil ###################### $game_party.members.each do |actor| # iterate through all members in the party states = actor.states states.each do |state| # iterate through states applied on all actors if state.id == 28 # id of Narcolepsy state chance = rand(max=100) # random number between 1 and 100 actor.add_state(6) if chance > 75 # 6 is the Sleep state id end end end ###################### BattleManager.turn_start @log_window.wait @log_window.clear endend # class Scene_Battle < Scene_BaseNote that this is a pretty primitive solution, feel free to experiment and see if you can come up with a more elegant way of accomplishing the same result 🙂 .

Original thread: https://forums.rpgmakerweb.com/threads/needing-help-with-a-proccing-state.17641/