I'm trying to figure out how to implement a frame wait in a bit of code and struggling to get it to function the way I want. Specifically, I'm trying to modify CGMZ's Fast Travel plugin to play a common event prior to transferring the player (essentially a teleportation animation I made) but I can't figure out why it's not working and wanted to ask for help.
By default, the code is:
I've modified to to be:
What I expected to happen was for the interpreter to run common event 15 and then wait for 65 frames before transferring the player. Instead what happens is that the player is immediately transferred, common event 15 is played after they arrive on the destination map, and then the game waits 65 frames. I'm not sure what I'm missing and why the transfer is still initiating before the wait, though I've sure it's something obvious to anyone that actually knows what they're doing.
For reference, the common event is:
By default, the code is:
JavaScript:
$gamePlayer.reserveTransfer(fastTravel._mapId, fastTravel._x, fastTravel._y, fastTravel._dir, 0);
SceneManager.goto(Scene_Map);
I've modified to to be:
JavaScript:
$gameMap._interpreter.command117([15]); //also tried $gameTemp.reserveCommonEvent(15); with same result
$gameMap._interpreter.setWaitMode('route'); //common event triggers a movement route, set wait mode accordingly
$gameMap._interpreter.wait(65);
$gamePlayer.reserveTransfer(fastTravel._mapId, fastTravel._x, fastTravel._y, fastTravel._dir, 0);
SceneManager.goto(Scene_Map);
What I expected to happen was for the interpreter to run common event 15 and then wait for 65 frames before transferring the player. Instead what happens is that the player is immediately transferred, common event 15 is played after they arrive on the destination map, and then the game waits 65 frames. I'm not sure what I'm missing and why the transfer is still initiating before the wait, though I've sure it's something obvious to anyone that actually knows what they're doing.
For reference, the common event is:
Code:
Show Animation: Player, Teleport Charge (Wait)
Show Animation: Player, Teleport Up
Set Movement Route: Player (Wait)
Wait: 5 frames
Transparent ON
Wait: 60 frames