Ah, right. I see the logic issue. (I think.)
I was attempting to set a dynamic trigger that, when the trigger was created, any unit within the trigger area would get the eventhandler. So, the set of units getting the eh would be finite, and known at the time the trigger was created. My trigger activations are:
_fireTrig setTriggerActivation ["ANY", "PRESENT", true];
I expect the trigger to usually have a short duration.
You raise another possibility, though. Basically, "nested" triggers. Very early in the script, establish a larger trigger area, and assign the eh to the units in that trigger. Later, when needed, create the smaller trigger of the area I want, and then count the "fireds."
Does that make more sense?
Edit:
Used a workaround.
Put the eventhandler in a script, and made the variable public:
{_x addEventHandler ["fired", {count = count + 1}];} foreach thislist;
And the trigger statement:
_fireTrig setTriggerStatements ["this", "execVM 'firedEH.sqf'", "deleteVehicle _Boss"];
Edit - more digging, and I think this is what I really want.
list trigger
Operand types:
trigger: Object
Type of returned value:
Array
Description:
List of units that would activate given trigger.
For trigger of type "Not present" the list is the same as that returned for "present".
Used In:
OFP/ArmA
Example:
_tlist = list triggerOne
Once I generate the list in the trigger, I can add the eventhandler in the same script. (I think.)
Edit.
Ok, riddle me this, gurus.
I set up the trigger, then use:
_fireList = list fireTrig
(Yes, I took the underscore off of the name throughout.)
But then the addeventhandler doesn't work.
If I use the
{_x addEventHandler ["fired", {count = count + 1}];} foreach thislist;
in a separate sqf, it works.
But, if I put
{_x addEventHandler ["fired", {count = count + 1}];} foreach _fireList;
it doesn't.
No error console or anything, it just doesn't increment it.
Is this the scope monster coming to bite me? I initially set _count outside any loops.
Thanks for any ideas.