Author: Heeeeres Johnny
Author Website:

Requirements: No addons required

Version: 2.1

Short description: Executes the given functions whenever the trigger's list changes.

Date: 2015-10-02 10:25

Comments: (0)


Trigger List Changed

Heeeere's johnny!

This script is about handling units which enter or leave a trigger's list. This is different from handling "thisList" or "all units inside/outside the trigger".
It's easy to handle units in the trigger's "thisList", but handling only those which just entered or just left is a different story.

Such distinction might be important for instance if a certain value/operation should be added/reduced/applied/executed only on such units or when a unit enters in the very same 0.5 seconds as another unit leaves, which would let the number of units in thisList remain unchanged while one unit is actually different.

Installation / Usage:
Execution: call

0 OBJECT	_trigger		a trigger having at least an activation statement
		1 SCRIPT	_fnc_enteringUnits	the function to be execution for each entering unit
		2 SCRIPT	_fnc_leavingUnits	the function to be execution for each leaving unit

OBJECT		_trigger		the "augmented" trigger

Example to use this script as a function:
_someTrigger = createTrigger ["EmptyDetector", getPosATL player];
_someTrigger setTriggerActivation ["ANY", "PRESENT", true];
_someTrigger setTriggerArea [10, 10, 0, false];
_someTrigger = [
    {hintSilent format ["%1 entered", name _x];},
    {hintSilent "You shall not pass!!!"; _x setDamage 1;}
] call fnc_triggerListChanged;

License / Disclaimer:
Feel free to use, adapt, expand (and maybe give credit if you consider it useful, I'd be grateful :)).

- added "isCall" parameter -> if true, trigger statements will be called, else they will be spawned
- hardcoded the generated functions into the trigger statements (no setVariable/getVariable anymore)

- v2.0 is a drastically overhauled script which has no need for global variables anymore and can now be called like a function.

Forum topic:
- BI forums

Enable javascript to be able to download from Armaholic please!

Tags: No tags