<aside> ⚡ script "map_teleportto" (int dest)

</aside>

Event


This script is called by the player whenever they enter a teleporter created by Teleport Entrance.

Usage


This script can replaced by adding a new script in your map of the name, map_teleportto, to add additional behavior to this event, or override the existing behavior.

This script has no expected return value.

Parameters

Default Script


The default teleport script teleports the player, with some protections to keep them from teleporting infinitely.

First, to prevent the player from teleporting recursively, it checks for a short-lived 5 tic long powerup called TeleportFlag. If the player has this powerup, the script is stopped, requiring them to jump on the teleporter again once the powerup fades.

<aside> 🚨 When replacing this script, you must make sure to preserve this powerup behavior! Failure to do so can cause infinite teleport recursion which will crash the game!

</aside>

If the player does not have this powerup, then give them the powerup and actually perform the teleport to the target destination.

// Activator: Player who teleported,
script "map_teleportto" (int dest)
{
if(CheckInventory("TeleportFlag")==0)
    {
    GiveInventory("TeleportFlag", 1);
    Teleport(dest, 0, 0);
    }
}

Example Replacement


The below replacement spawns a Hyper Bomb at the teleporting player’s feet before teleporting. Note that it uses [core_setTIDsPointerToThis](<https://mm8bdm.notion.site/core_setTIDsPointerToThis-8496d0cd20134bc789355e69d21c4ce6>) to set the owner of the Hyper Bomb to the teleporting player.