Repeating event error, can't figure out a fix!

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
The lovely Shaz provided me with a script to help cut down on the hundreds of events I was trying to use to for terrain events, such as puddles making splashing sound effects and walls of thorns damaging you.

Map notes for such events look like this: regevt: reg_id on/face/bump common_event_id

She recently added "bump," which is what works perfectly for the damage walls I was looking for. However, for some reason bump events repeat twice. She has been unable to find a fix for this, so I have come to this forum to ask for help.

Here's her script.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
A note on this script - 'face' is if you step onto a tile and the tile in front of you has a region id (you don't have to try walking into the tile). 'bump' is for when you actually try walking into a tile but can't because of passability. It works, but it repeats.


Koi, do you want it to repeat, but with a delay (so if they hold down the arrow key your common event is run every second or something)? Or do you want it to play only once and not again unless they move away?
 

Mithran

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
404
Reaction score
217
First Language
English
Primarily Uses
@Koi

Bump is "repeating" because as long as you are attempting to move against the wall, you will trigger another event, so even if you do a rattlesnake strike on the key you will more than likely get two triggers. However..

@Shaz

There is another issue at work here. Events aren't getting set up until two frames after the player move. This is because you are reserving the common event after Game_Map updates, and within this update is when the main interpreter sets up reserved common events. Map update also takes place just before player update in Scene progression.

So the sequence goes

frame 1 > map & interpreter > player (region trigger) > frame 2 > map & interpreter > reserve event > player > frame 3 > map & interpreter (start event)

This should be fixed by just reversing the order of the reserve and the alias method you have in your Game_Map#update

alias shaz_re_game_map_update update def update(main = false) $game_temp.reserve_common_event(@req.shift) if !$game_temp.common_event_reserved? && @req.size > 0 shaz_re_game_map_update(main) endThen it would goframe 1 > map & interpreter > player (region trigger) > reserve event > frame 2 > map & interpreter (start event)

Triggering the event also consumes a frame, making it slightly easier to not retrigger the bump (you have 1/30 of a second to take your hand off the key instead of 1/60). If it is set up like this, waits can be added to the common event to keep it from constantly retriggering, as necessary, so you shouldn't need to manually hardcode a retrigger delay.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Thanks Mithran! It's a pretty easy issue to reproduce, so I'll try your suggestion in the morning and see if it resolves the issue.
 

Koi

Veteran
Veteran
Joined
Aug 8, 2013
Messages
358
Reaction score
14
First Language
English
Primarily Uses
RMVXA
Koi, do you want it to repeat, but with a delay (so if they hold down the arrow key your common event is run every second or something)? Or do you want it to play only once and not again unless they move away?
Okay so let's say the thorns are on the left side of the screen. You're walking left. You hit into one of the thickets, and that first moment of "bumping" contact hurts you, once. And every time you press left again, you will get hurt.

@Koi

Bump is "repeating" because as long as you are attempting to move against the wall, you will trigger another event, so even if you do a rattlesnake strike on the key you will more than likely get two triggers...
When I used events it worked perfectly and only hit once per arrow click, so I'm guessing that it indeed can also be perfect with this script. Someone told me almost anything can be done with RGSS3.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,040
Members
137,569
Latest member
Shtelsky
Top