SetActivatorToTarget
From ZDoom Wiki
int SetActivatorToTarget (int tid)
Usage
This changes the activator of the script to the current target of the first actor found with the specified tid. Using a tid of 0 uses the current activator's target.
The search pattern works like this:
- If the tid being referenced is currently a player and the player is alive, the new activator is first thing the player is aiming at. Otherwise, for monsters it is the monster's target.
- If the tid referenced is something that has died, the new activator is its killer.
- If this functions is used for a player-run script, and the player is alive, it sets the activator to the actor the player is aiming at.
- If the tid is a projectile, the new activator is the actor who fired it.
- If the actor has no target, the activator is the actor itself.
- If there are no actors with the given tid, the function returns 0 and leaves the current activator unchanged.
Parameters
- tid: TID of the actor whose target will become the activator.
Return value
1 (TRUE) if the new activator exists. If there were no actors with the supplied tid, this function returns 0 (FALSE) and the activator is left unchanged.
Examples
This example will destroy the first non-player actor that the player aims at.
script 1 enter
{
while (PlayerNumber() >= 0)
{
SetActivatorToTarget(0);
delay(1);
}
Thing_Destroy(0, YES);
}