TagWait

From ZDoom Wiki
Jump to navigation Jump to search

void TagWait (int tag);

Usage

Delays the script TagWait is called from until the sector with the tag specified by tag has stopped moving (make sure you do not do this with a waggling sector or one that is in perpetual motion, because the script will delay forever). TagWait will always wait 1 tic even if the sector is not moving.

Parameters

  • tag: The sector tag to wait for.

Examples

This script causes a tagged door to open, and prints a message to all players when this is complete.

script 1 (int sector)
{
    PrintBold (s:"Opening the hangar doors...");
    Door_Open (sector, 5, 0);
    TagWait (sector);
    PrintBold (s:"Hangar doors now open!");
}

The first two lines start the door opening and tell the player(s) this is happening. Note that the door is opening at a speed of 5, which is quite slow (what you might expect for a large hangar door). The script then uses TagWait to wait an unspecified amount of time before the door really opens. Once it does, this is reported.

The advantage of TagWait here is that you can use the same script on many hangar doors despite a different in height and therefore opening time. Or, you can modify your own hangar door's size or the script's speed and the “opened” message will always arrive at the exact time.

Note that when using this with a lift, the script will wait until the lift has completely finished its moving sequence, that is, until the lift has successfully returned to its starting position.