THISACTOR

From EDukeWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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.