So what I did was place OPFOR present trigger, make it run repeatedly, name it "pmc_opfor_list".
Then launch our script, call it recon.sqf which looks like this:
Code: Select all
/*
Player knows about all units in specific trigger, simultaneously
or one by one over time.
*/
private
[
"_l",
"_t"
];
// small delay so the trigger will initiate
sleep 3;
// our list of units at the mission start
_l = list pmc_opfor_list;
// _t array is the units at mission start (some may board vehicles etc).
_t = _l;
// loop until we know, or have known/seen each and every one of them
while {count _t > 0} do
{
// no point of making it cpu intensive
sleep 2;
// just debug for monitoring
hint format["pmc_opfor_list: %1\n\n_t: %2", list pmc_opfor_list, _t];
/*
this checks if player knows anyone in the pmc_opfor_list trigger.
if he does, that unit will be deducted from the _t array.
the main while loop will then exit when _t array reaches 0, ie empty.
*/
{
/*
the 0 value can be adjusted, zero is the basic essential
detection, its very relaxed.
*/
if (player knowsAbout _x > 0) then
{
_t = _t - [_x];
};
} count _t;
};
// we know all of the units, exiting from the script.
player sidechat "Congratulations, I now know each and every unit in pmc_opfor_list!";
I posted this here as I have had to look up my script dirs so many time when I've done this exact same type of "check all units in array" thing, that maybe this topic would be more easier to find or someone might help me to improve it a bit etc.
Feel free to post questions or feedback or improvements.