Thing_ChangeTID

From ZDoom Wiki
Jump to navigation Jump to search

176:Thing_ChangeTID (oldtid, newtid)


  • oldtid: The current TID of the thing whose TID will be changed.
  • newtid: The new TID that the thing will be changed to.

If oldtid is zero, then whatever activated the script will have its TID changed to newtid. If oldtid is non-zero, then everything with the TID oldtid will have their TID changed to newtid.

Examples

One of the primary uses for this special is to give a player a TID using a script like this:

script 100 enter
{
    Thing_ChangeTID (0, 1337+PlayerNumber());
}

This will give player 1 the TID 1337, player 2 the TID 1338, player 3 the TID 1339, and so on.

Use this script for multiplayer levels:

script 256 respawn
{
    Thing_ChangeTID(0, PlayerNumber()+256);
}

script 257 death
{
    Thing_ChangeTID(0, 0);
}

script 258 enter
{
    Thing_ChangeTID(0, PlayerNumber()+256);
}

This will give player 1 the TID 256, player 2 TID 257, etc. It will cause each player not to have a TID during death.

Use this script for multiplayer levels and players to retain their TID during death:

script 256 respawn
{
    Thing_ChangeTID(0, 0);
    Thing_ChangeTID(0, PlayerNumber()+256);
}

script 258 enter
{
    Thing_ChangeTID(0, PlayerNumber()+256);
}

This will give player 1 the TID 256, player 2 TID 257, etc. It will cause each player to keep their TID during death.

For multiplayer, it is very important to change the player's TID to 0 in DEATH or RESPAWN. Otherwise, there will be multiple players (corpses) using the same TID, which will eventually result in a crash.

External links