SetActivator

From ZDoom Wiki
Jump to: navigation, search


int SetActivator (int tid[, pointer_selector])

Usage

This changes the activator of the script to the first actor found with the specified tid.

Parameters

  • tid: TID of the new activator.
  • pointer_selector: The pointer of the TID to set as the new activator.
Pointer Values

Priority 1, player-only selectors (used if specified with a player origin):

  • AAPTR_PLAYER_GETTARGET: Gets the actor under the crosshair.
  • AAPTR_PLAYER_GETCONVERSATION: Gets the actor the player is speaking to.

Priority 2, any-actor selectors (used if specified with any non-null origin):

  • AAPTR_TARGET
  • AAPTR_MASTER
  • AAPTR_TRACER
  • AAPTR_FRIENDPLAYER

Priority 3, any static selectors (used if specified)

  • AAPTR_PLAYER1, AAPTR_PLAYER2, AAPTR_PLAYER3, AAPTR_PLAYER4, AAPTR_PLAYER5, AAPTR_PLAYER6, AAPTR_PLAYER7, AAPTR_PLAYER8
  • AAPTR_NULL

Minimum-priority

  • AAPTR_DEFAULT: Returns the origin, be it null or an actor

Selectors from different levels are combined using bitwise OR. Only one selector can be specified for each priority level

Return value

1 (TRUE) if the activator exists. If there were no actors with the supplied tid, or the pointer is NULL, this function returns 0 (FALSE) and the activator is set to the world.

Examples

Sets player 1 as the activator, regardless of who activated the script, and then gives him ammo.

Script 1 (void)
{
	SetActivator(0, AAPTR_PLAYER1);
	GiveInventory("Clip", 50);
}

See also