[ACS] SetActivator extended with AAPTR

Moderator: GZDoom Developers

Post Reply
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

[ACS] SetActivator extended with AAPTR

Post 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
Attachments
DEVZ.pk3
Test of special 84 (ACS_ExecuteWithResult) from strife dialogue (lump CMONSTR) with SetActivator and AAPTR_PLAYER_GETCONVERSATION.

Use it to give some clips to the archvile when it isn't busy burning badasses on your behalf. Sorry about the mess. (Load with Doom II IWAD and run new game.)
(3.38 KiB) Downloaded 36 times
setactivator.zip
Diff for ACC and ZDOOM
(1.2 KiB) Downloaded 39 times
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”