MZ Need help fixing an item that aborts battle and teleports player to safe location.

There is an item in my game that when used, is supposed to abort the ongoing battle and then teleport the player to a different location.
1771344431225.png


Initially, it was just the common event. I removed the abort battle command later,(ignore the wait commands, they're just leftovers from playtesting)
1771344383770.png

It takes two uses to actually teleport. One use for exiting battle, other for teleportation.

So I added in the escape command to the item effects and removed the abort battle command. Didnt work.


From the screenshots, can you tell me what's wrong?
Or maybe suggest as alternative way of doing this?
Hey,

You didn't do anything wrong, by default the game will ignore map related event commands during battle and battle related event commands while on the map.

This might be a bit tricky to work around, but one solution would be to replace the "Teleport" with a script command (Archeia has maintained a list of script call equivalents here).

Another solution could be to set a switch and have a parallel common event execute the teleport when the player returns to the map (although this might look a bit off)
You could also use a common event and have that Switch trigger it, so you don't need to have a para event on every map.

So I would set it up as, make a common Event, make the trigger a switch, Teleport player to church.

then when you use the item, turn Switch X on, -> Abort battle, then soon as you enter the map, the common event should trigger and teleport you back to the church.
As already mentioned above, Battlescreen and Mapscreen use different interpreters for processing event code.

Due to this, you will need two different events, one to run during battle and one to run on the map.

The easiest way to connect them is with a switch for a parallel common event.

1) Have the in-Battle common event trigger the switch and then abort battle
2) Have the on-map common event be parallel and activated by that switch. It should then teleport the player to the safe location and turn off the switch.


Unless you modify the engine, parallels will not work during battlescreen. This means the activation by the switch is delayed until the map becomes active.

Original thread: https://forums.rpgmakerweb.com/threads/need-help-fixing-an-item-that-aborts-battle-and-teleports-player-to-safe-location.182495/