Make Wait commands work without blocking everything

So I'm having a snake shoot a poison porjectile at the player. This is meant to deal ticks of damage to him, and make him have to stop for a few frames for every tick of damage. My idea was to make a moveroute for the player after every tick of damage and then a regular wait command, since I assumed the wait command is event internal. But instead of only waiting for the event, everything stops moving and the hero is paralyzed for way too long for this to be considered balanced. Help would be appreciated.
Here is my code:
it's because you got the "Wait for completion" on it. Untick that in your movements.
your problem is that you use different waits, and that messes everything up.

if you remove the "wait for completion" from the set move route command, it should work as you intended

edit: ninja'd
your problem is that you use different waits, and that messes everything up.

if you remove the "wait for completion" from the set move route command, it should work as you intended

edit: ninja'd
It still isn't working. Thanks for the suggestion. I think it can't be that, because waiting for those 10 frames is actually intended and will always happen regardless of if i wait for completion. The problem is the wait 90 frames, in which the player can't move for some reason. I need an alternative command kind of that handles event internal wait time.
you're wrong - if that happens then there has to be a different reason why the player is stopped.

in a parallel process, the regular wait means "skip processing this event for x frames" and is used to reduce lag exactly because the player can move during that time.
the move route "wait for completion" on the other hand tells the engine "block and wait until all commands inside the move route are completed".

you can easily see this if you try to have several events move at the same time in a cutscene - you'll need to remove the wait on the first several set move route commands but keep it on the last one to synchronise everything.

So either you have a plugin that messed up everything with the internal wait command (very unlikely), or there is a different event blocking the player movement.

First suspicion in those cases is always to check if switch 22 triggers something else, either in a different event (use event search to find out) or in a plugin (check all configurations for the use of number 22)
The Common Event command runs the contents of the specified common event as a sub-process of the event that called it: I imagine that's the problem here.

Do not use the Common Event command for this. Just have your map event turn on switch 22.

You should probably turn off the switch at the end of the common event, too. Active Parallel/Autorun events trigger every frame they are not already running: if you never turn off the switch then the poison will continue indefinitely.

Also, note that if the player changes map while the switch is on, any active Parallel event will restart from its first command. To work around this, you can use a variable to count the damage ticks, then end when appropriate, e.g.
Spoiler: event example
◆Comment:Initialise poison tick counter. : :(Could alternatively do this in the "calling" event). ◆Control Variables:#0001 Snakehit Poison = 0 ◆Loop ◆Comment:Advance tick counter. ◆Control Variables:#0001 Snakehit Poison += 1 ◆If:Snakehit Poison = 1 ◆Comment:Initial strike. ◆Show Animation:Player, Poison 1 ◆Wait:110 frames ◆ :Else ◆If:Snakehit Poison = 2 ◆Comment:Poison sets in. ◆Show Animation:Player, Poison 2 ◆ :End ◆Comment:Apply damage. ◆Change HP:Komoi, - 20 ◆If:Snakehit Poison ≥ 6 ◆Comment:This was the final tick. ◆Break Loop ◆ :Else ◆Comment:Stun for 10 frames, wait until next tick. ◆Set Movement Route:Player : :◇Wait:10 frames ◆Wait:100 frames ◆ :End ◆ :End ◆ :Repeat Above ◆Comment:Do once per poisoning. ◆Control Switches:#0022 Snakehit = OFF
[Edit: changed where counter variable gets increased in event example. Before it only increased immediately after damage was dealt, meaning it never progressed because the first tick doesn't deal damage. 😴]
The Common Event command runs the contents of the specified common event as a sub-process of the event that called it: I imagine that's the problem here.

Do not use the Common Event command for this. Just have your map event turn on switch 22.

You should probably turn off the switch at the end of the common event, too. Active Parallel/Autorun events trigger every frame they are not already running: if you never turn off the switch then the poison will continue indefinitely.

Also, note that if the player changes map while the switch is on, any active Parallel event will restart from its first command. To work around this, you can use a variable to count the damage ticks, then end when appropriate, e.g.
Spoiler: event example
◆Comment:Initialise poison tick counter.
: :(Could alternatively do this in the "calling" event).
◆Control Variables:#0001 Snakehit Poison = 0
◆Loop
◆If:Snakehit Poison = 0
◆Comment:Initial strike.
◆Show Animation:Player, Poison 1
◆Wait:110 frames
◆
:Else
◆If:Snakehit Poison = 1
◆Comment:Poison sets in.
◆Show Animation:Player, Poison 2
◆
:End
◆Comment:Apply damage.
◆Change HP:Komoi, - 20
◆Comment:Advance tick counter.
◆Control Variables:#0001 Snakehit Poison += 1
◆If:Snakehit Poison ≥ 6
◆Comment:This was the final tick.
◆Break Loop
◆
:Else
◆Comment:Stun for 10 frames, wait until next tick.
◆Set Movement Route:Player
: :◇Wait:10 frames
◆Wait:100 frames
◆
:End
◆
:End
◆
:Repeat Above
◆Comment:Do once per poisoning.
◆Control Switches:#0022 Snakehit = OFF
Thanks so much!
It was because the projectile was manually running the event instead of turning the switch on, resulting in the common event now taking priority instead of remaining a subprocess. I fixed it and now it works. Also thanks for the extra tip concerning map switching, that might come in handy.
@PhiSt - you're welcome! 👋

(Just so you know: I updated the event example in my previous post, because it had a logic error.)
@PhiSt - you're welcome! 👋

(Just so you know: I updated the event example in my previous post, because it had a logic error.)
Yeah i noticed, fixed it before you changed it.
That being said, i noticed that when you hit esc to access the menu and then exit it again, while the damage is still deducted with everything working, the animation is interrupted. Meaning i stop hearing damage sounds or visually seeing the poison effect anymore. Do you know a fix?
when you hit esc to access the menu and then exit it again, while the damage is still deducted with everything working, the animation is interrupted.
Oh, that's awkward. It's because the engine doesn't retain persistent references for playing animations: the animation ends and is discarded when the map scene is replaced by the pause menu.

Some possible workarounds:
  1. Swap the long animation for a series of shorter animation(s), played more frequently.
  2. Forbid menu access during the animation, using the Change Menu Access command.
  3. Find a suitable plugin, e.g. one that lets you set looping animations for states on the map?
Someone else may have a better idea~
Oh, that's awkward. It's because the engine doesn't retain persistent references for playing animations: the animation ends and is discarded when the map scene is replaced by the pause menu.

Some possible workarounds:
  1. Swap the long animation for a series of shorter animation(s), played more frequently.
  2. Forbid menu access during the animation, using the Change Menu Access command.
  3. Find a suitable plugin, e.g. one that lets you set looping animations for states on the map?
Someone else may have a better idea~
Yeah I intend to make an evented custom menu anyway, so I'll need to disable menu access regardless. That being said, I'll still need to make my evented menu pause the game so i might shorten the animation and play it after each tick

Yeah I intend to make an evented custom menu anyway, so I'll need to disable menu access regardless. That being said, I'll still need to make my evented menu pause the game so i might shorten the animation and play it after each tick
Yeah, just making the animation one fifth of the lenght and replaying it after each tick is not only simpler to code, but solves my problem.
Great, happy RPG Making! 👋

Original thread: https://forums.rpgmakerweb.com/threads/make-wait-commands-work-without-blocking-everything.168261/