ZDoom Line Specials

229:Thing_SetGoal

Name

Thing_SetGoal — sends a monster on a patrol route.

Synopsis

Thing_SetGoal (tid, goal, delay);
Thing_SetGoal (
  tid,       // Thing ID of monster to send to a patrol point
  goal,      // Thing ID to send the monster to
  delay      // Tics before the monster starts moving toward the patrol point
);

Parameters

tid
Thing ID of monster to send to the patrol point. If this is 0, then the monster that activated it is affected. If there is more than one monster with this TID, then they will all move toward the same patrol point.
goal
Thing ID of the patrol point the monster should move toward. If there is more than one patrol point with this TID, only one of them will be used. Although currently only the first matching patrol point will be used, this may be randomized in the future. You should avoid creating patrol routes that contain multiple patrol points with the same TID.
delay
The time, in tics, that the monster waits after this special has been executed before it starts moving toward its goal. Set this to 0 to make the monster immediately leave for the goal point.

ACS

This special's function is the same whether you activate it on a line or use it in a script.

Remarks

This special has a special activation mode that can be used by assigning it to a monster's special. If you give a monster the Thing_SetGoal special with tid set to 0, then this special will be activated for that monster immediately when the level is first loaded. This allows you to create monsters that automatically start on a patrol without using any scripting.

If the monster sees anything it considers an enemy, such as a player or another monster (thanks to Thing_Hate), it will leave its patrol to attack its new target. Once its enemy has been dispatched and it can see no more foes, the monster will resume its patrol where it left off.

Examples

Set the current monster moving toward the patrol point with TID 50 immediately:

Thing_SetGoal (0, 50, 0);

Set any monsters with TID 1 moving toward the patrol point with TID 40 after two seconds:

Thing_SetGoal (1, 40, 70);

First Available In

ZDoom 1.16

See Also