Problem with Player Touch events

I've encountered an interesting issue with player touch events that I've been banging my head against:

I have a room with multiple identical NPC's, and I want them to play a SE from a set of several SE's when touched.

So currently I have them all running a common event when touched. This common event sets a variable to random number between 0-9. Then I'm keeping it very basic by doing 10 conditional branches that check the variable and then play a different SE for each.

However, when I touch the event with the player, it triggers the CE several times instantaneously. If I use the mouse pointer to trigger the event however, it only triggers the event once, and the common event runs correctly.

So it seems like the keyboard-initiated contact is triggering the CE many times in succession, whereas forcing just a single contact works properly.

Is there any way I can fix this issue with simple eventing, either in the CE or the player touch events themselves? The events need to be infinitely repeatable, so I don't want to use self-switches. But I'm super open to suggestions :LZSgrin: :LZSjoy: :LZSgrin:

Thank you!
touching event to repeat or not working directly was my side issue
on a game event as well, but not with sounds though.

there are 2 methodes that "might" help you to test.
either make a "wait" in between or end of the event (mostly 25-30 frames)
for rendering process so it doesn't repeat directly (as this isn't a parallel process).

or, create a self-switch:

call common event
SS A = ON

on page 2
wait x frames
SS A = OFF

x frames is the amount or same amount of the length + 5 extra
so each SE can play, than turning it off to replay if needed.

both methodes should work. as in my ocarina event is the problem
as well and require a buffer of at least 25 frames to render/buffer it nicely.

you can try both and see which one works best in your case.
there are 2 methodes that "might" help you to test.
either make a "wait" in between or end of the event (mostly 25-30 frames)
for rendering process so it doesn't repeat directly (as this isn't a parallel process).

Thanks ShadowDragon just this simple wait at the end of the event solves everything. I actually can get the wait down to a small number which doesn't affect gameplay at all. Just the simple humble wait solves so many problems!

Solved 🙂 Thank you so much!! Though I'm still weirdly curious about why the issue happens ...
Thanks ShadowDragon just this simple wait at the end of the event solves everything. I actually can get the wait down to a small number which doesn't affect gameplay at all. Just the simple humble wait solves so many problems!

Solved 🙂 Thank you so much!! Though I'm still weirdly curious about why the issue happens ...
That's really odd as the common event should only run as long as you're "running into" the event. Does it repeat if you change the SE to a message window?
wait for sounds or pictures can be powerfull if something dont work
or skips things, wait is mostly used as a small buffer to render things.

good luck on your project further 🙂
That's really odd as the common event should only run as long as you're "running into" the event. Does it repeat if you change the SE to a message window?

It really IS odd!

I tested it real quick with msg windows, and no it doesn't reproduce the problem.

But go ahead and try it yourself! If a player touch event triggers a common event with a sound effect, it will play several times.

It would seem to be a bug -- like the engine isn't handling the touch as 1 frame. I tried tapping the arrow key against the event as quickly as possible and it still triggered like 6 times.
It really IS odd!

I tested it real quick with msg windows, and no it doesn't reproduce the problem.

But go ahead and try it yourself! If a player touch event triggers a common event with a sound effect, it will play several times.

It would seem to be a bug -- like the engine isn't handling the touch as 1 frame. I tried tapping the arrow key against the event as quickly as possible and it still triggered like 6 times.
I did try it on my end and the sound effect only played once.

Edit: Ah yeah, I see what you meant now. It's basically because the event interpreter updates every frame if page conditions are met. Since sound effects don't pause execution, if that's all you have in the event it'll just run it every frame.

Original thread: https://forums.rpgmakerweb.com/threads/problem-with-player-touch-events.145235/