dott

Villager
Member
Joined
Nov 3, 2014
Messages
7
Reaction score
1
First Language
English
Primarily Uses
I have a script called in a parallel process event that, whenever triggered, runs in its entirety twice before the game moves on. I have tried changing variables in the middle of the script so that it won't trigger again, but it didn't do anything. The script does exactly what it's supposed to both times, except that it happens twice, and I have no idea why. My only idea is that it might be something to do with how VX Ace handles parallel processes, but I don't know how else I would call it.
Common Event 2 sets variable 4. Common Event 1 shows a few text boxes, plays some sound effects, and transports the player elsewhere before turning on the switch to play the parallel process Common Event 3. Common Event 3 is only ever called once, which means that Common Event 1 and the scripts are being called twice before the game checks the parallel process condition for Common Event 3.
>Call Common Event [2]
>Script: [map_7]
def map_7
@var = $game_variables[4]
case @var
when 17..23
if !$game_switches[ 16 + @var ]
spotted( @var )
end
end
end
def spotted ( var )
mr = RPG::MoveRoute.new
mr.repeat = false
mr.wait = true
mr.list = []
mr.list.push( RPG::MoveCommand.new( 25, []) )
mr.list.push( RPG::MoveCommand.new )
$game_map.events[ @var ].force_move_route( mr )
$game_map.events[ @var ].balloon_id = 1
$game_temp.reserve_common_event( 1 )
end
Solutions that didn't work:
  • Changing $game_variables[4] in the if statement of map_7
  • Resetting $game_variables[4] after the script call in the parallel process
While not technically game-breaking, this glitch breaks immersion, and is very annoying. Does anyone have any ideas on how to fix it?
 

MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
388
Reaction score
96
First Language
English
Primarily Uses
So to help you troubleshoot, I would recommend posting screenshots of all your events. You never know when maybe there’s just a setting mismatch or something like that. As for calling twice, my initial guess is that something like this is happening:

The game updates the map, which checks all events.
The parallel process is triggered.
A script/event marks other events to be run but doesn’t actually run them right away.
On the next frame, the game updates the map, which checks all events.
The parallel process is triggered.
The marked events are triggered thereby disabling the parallel process.
The marked events were also re-marked by the parallel process.
On the next frame, the marked events are called again.

I can’t remember exactly the script call but you should be able to print stuff to a console while debugging. That should help you trace the execution of your code.
 

A-Moonless-Night

WINTER IS COMING
Veteran
Joined
Mar 17, 2012
Messages
689
Reaction score
448
First Language
English
Primarily Uses
RMVXA
I have a feeling that common events restart as you change maps, so that could have something to do with it?
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,757
Reaction score
14,517
First Language
English
Primarily Uses
RMVXA
Maybe post what you are trying to do too? Odds are there is a better way to implement it which can avoid this, as I can't think of any reason you would need 3 common events to do one action.
 

dott

Villager
Member
Joined
Nov 3, 2014
Messages
7
Reaction score
1
First Language
English
Primarily Uses
I am doing a stealth segment of a game, and wrote a script and some common events to make the event pages shorter for all the guards.
  1. A parallel process common event finds the region id of the square the player is standing on and runs a script.
  2. A script checks to see if that region id is associated with a guard, and if the guard is still there. If the region id and switch indicate that there is a guard who can see the player, the script specific to that map is called.
  3. A script takes as input the region id which matches the event id of a guard. That guard turns towards the player and a balloon icon appears over them. A common event is called.
  4. A common event shows a bit of dialogue and fades out the screen. A few fighting sound effects play, the player is transported to their cell, and a switch is turned on to trigger a common event.
  5. A common event fades the screen back in and shows dialogue depending on where the player is in the game. The switch to trigger the common event is turned off.
When I originally implemented this, steps 4 and 5 were in the same common event, but for an unknown reason the screen wouldn't fade back in after the transport. Splitting it into two events fixed it. Theoretically I could now put steps 4 and 5 into another script, but I still don't know why the screen wouldn't fade back in, and would rather not mess with it.

The common event of step 1 is written in its entirety in the original post under "Parallel Process". The script of step 2 is in the original post under "map_7 Script". The script of step 3 is in the original post under "spotted Script". The common events of steps 4 and 5 are below and attached as files to this post.

67727-24936ccb4ce25b9b73078e74e1fa23da.jpg


upload_2018-5-4_11-0-17.png
67728-299cb8d0df41193bbebf5878121c05ec.jpg


There are some guards on the same map as the player's cell, and whether or not the player remains on the same map doesn't affect whether or not the script runs twice. As an additional note, if the common events are called through an event page, they only run once.
 

Attachments

  • common event 1.png
    common event 1.png
    27.3 KB · Views: 1
  • common event 2.png
    common event 2.png
    36.4 KB · Views: 1

dott

Villager
Member
Joined
Nov 3, 2014
Messages
7
Reaction score
1
First Language
English
Primarily Uses
After a lot of testing, I ended up combining steps 3 and 4 in a script, which seems to have fixed the problem. I think that Mobius was right, and the parallel process was triggering twice because step 4 happened before the player moved off of the trigger square before the event. Thank you all for your help.
 

Latest Threads

Latest Posts

Latest Profile Posts

So I was kinda recommended a manga to learn a few drawing tips, I dunno if it will actually work, but I'm liking the story lol
M745veO.jpg
RPG Maker News #12 | Control Zooming, Customize Bush Effect, Causality & Happy Bones on Steam
Episode 16 let's go! We're making an RPG in RPG Maker MZ! This week... even more mapping, we're almost done with all the mapping for our first dungeon!

I have big news. I just got hired at a Mexican restaurant! They're like Chipotle but a bit different... and my job will be taking orders some days, delivering food other days, and of course, making customers happy. My orientation is on Tuesday. Once I start, I might disappear from here sometimes, but I'll always try to come back!
Batch converting .mp3 to .ogg files is making my computer soooo slow!

Forum statistics

Threads
110,443
Messages
1,053,365
Members
143,519
Latest member
iahhel
Top