THISACTOR: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Plugwash (talk | contribs)
No edit summary
mNo edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
THISACTOR is a [[gamevar]] that refers to the current [[actor]].
THISACTOR is a [[gamevar]] that refers to the current [[actor]].


HOWEVER it is [[special case]]d in get/set[[Player Member Functions|player]]/[[Sector Member Functions|sector]] to refer to the current player and sector (it is also special cased in [[getactor|get]]/[[setactor]] though this special casing shouldn't make any difference to behaviour).
HOWEVER it is [[special case]]d in get/set[[Player Member Functions|player]]/[[Sector Member Functions|sector]] to refer to the current player and sector (it is also special cased in [[getactor|get]]/[[setactor]] though this special casing shouldn't make any difference to behaviour).   Specifically:
 
When used with get/setactor inside of actor code, THISACTOR refers to the actor you're manipulating.
 
When used with get/setplayer inside of actor code, THISACTOR refers to the nearest player.
 
When used with get/setsector inside of actor code, THISACTOR refers to the current actor's sector.
 
When used in a player event (as opposed to the special actor events like [[EVENT_GAME]], [[EVENT_EGS]], [[EVENT_SPAWN]], et cetera), THISACTOR typically refers to the APLAYER sprite (or rather, it refers to whatever sprite has the sprite number contained in the value for the "i" member of the player struct).
 
When used in an actor event, such as the ones listed above, THISACTOR works as it does in actor code.
 
[[Category:Pre-defined gamevars]]

Latest revision as of 14:06, 21 April 2008

THISACTOR is a gamevar that refers to the current actor.

HOWEVER it is special cased in get/setplayer/sector to refer to the current player and sector (it is also special cased in get/setactor though this special casing shouldn't make any difference to behaviour). Specifically:

When used with get/setactor inside of actor code, THISACTOR refers to the actor you're manipulating.

When used with get/setplayer inside of actor code, THISACTOR refers to the nearest player.

When used with get/setsector inside of actor code, THISACTOR refers to the current actor's sector.

When used in a player event (as opposed to the special actor events like EVENT_GAME, EVENT_EGS, EVENT_SPAWN, et cetera), THISACTOR typically refers to the APLAYER sprite (or rather, it refers to whatever sprite has the sprite number contained in the value for the "i" member of the player struct).

When used in an actor event, such as the ones listed above, THISACTOR works as it does in actor code.