TeleportOther

From ZDoom Wiki
Jump to navigation Jump to search

76:TeleportOther (tid, destination_tid, fog)


  • tid: TID of the thing to teleport.
  • destination: TID of the map spot to teleport to.
  • fog: Teleport with or without fog. (0 = no fog, 1 = fog)

Teleports a thing. The special's main usage is to teleport something else besides the activator.


Example

This script will teleport the player to the coordinates of the thing that is identified by tag 1 similarly to SetActorPosition, possibly telefragging if the thing will try to block.

#include "zcommon.acs"

function void SetActorPositionForced(int tag, int x, int y, int z, bool fog)
{
  if (tag == 0) tag = ActivatorTID();
  int t = UniqueTID();
  SpawnForced("TeleportDest2", x, y, z, t, 0);
  int t2 = tag;
  if (t2 == 0)
  {
    t2 = UniqueTID();
    Thing_ChangeTID(0, t2);
  }

  TeleportOther(t2, t, fog);

  if (t2 != tag)
    Thing_ChangeTID(t2, tag);
  Thing_ChangeTID(t, 0);
}

script 1 ENTER
{
    SetActorPositionForced(0, GetActorX(1), GetActorY(1), GetActorZ(1), true);
}