Page 1 of 1

[ACS] SetActivator extended with AAPTR

Posted: Wed Jun 08, 2011 2:50 pm
by FDARI
This suggestion/submission is duplicated and extended here: http://forum.zdoom.org/viewtopic.php?f=34&t=29995

Original function: bool SetActivator(int tid)
New function: bool SetActivator(int tid[, int pointer_selector]);

Using only a single parameter, or passing AAPTR_DEFAULT as the second parameter, performs the same operation as the original function:
Setting activator to NULL (world) for TID 0. (Return false)
Setting activator to NULL (world) for TID not found. (Return false)
Setting activator to first instance of TID found. (Return true)

If a non-default second parameter is passed:

Step 1

* Setting origin to SELF for TID 0.
* Setting origin to NULL for tid not found.
* Setting origin to first instance of TID found.

Step 2

* Setting activator according to the pointer selector, using the selected origin. (If AAPTR_TARGET were used, set activator to origin's target.)

Step 3

* return activator != NULL

This extends the behaviour of SetActivator, but cannot exactly duplicate SetActivatorToTarget, because I chose non-existence-handling to be consistent with SetActivator.

"SetActivator(sometid, AAPTR_PLAYER_GETTARGET|AAPTR_TARGET)" most closely duplicates "SetActivatorToTarget(sometid)". The difference occurs when a non-null activator without a valid target makes the call: Both functions will return false, but SetActivator will change the activator to NULL (world). For some reason, this has been carefully avoided in SetActivatorToTarget, and explicitly depended on in SetActivator.
Spoiler: AAPTR-recap
Purposes of this extension
  • Extending the activator-changing to entail MASTER and TRACER
  • Allowing explicit selection of any player as the activator of a script (returns false and sets activator to null if the player is not in the game)
  • Could be extremely useful in Strife-dialogues (I'll try to make use of it)
  • Prepare ACS to benefit from any future improvements of the pointer selectors.
Spoiler: Very simple usage demonstration
Spoiler: Minor internal change