Skip to content

Instantly share code, notes, and snippets.

@patroza
Created July 6, 2011 09:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patroza/1066932 to your computer and use it in GitHub Desktop.
Save patroza/1066932 to your computer and use it in GitHub Desktop.
// Returns true if conditions are met to activate trigger. false if not.
// Compile somewhere: fnc_MyFunc = compile preProcessFileLineNumbers "fnc_myFunc.sqf";
#define MIN_PLAYERS 3
if (d_no_more_observers) exitWith { false };
if ({((getposATL _x) select 2) > 3} count _this > 0) exitWith { false }; // Flying vehicles in trigger area, exit.
// Might misunderstand the requirement, perhaps needs to move to the vehicle / player check below?
private ["_playerCount"];
_playerCount = 0;
{
if (_x isKindOf "Man") then {
if (isPlayer _x) then { _playerCount = _playerCount + 1 };
} else {
{ if (isPlayer _x) then { _playerCount = _playerCount + 1 } } forEach (crew _x);
};
if (_playerCount >= MIN_PLAYERS) exitWith {}; // exit loop scope
} forEach _this;
if (_playerCount < MIN_PLAYERS) exitWith { false };
true;
_t_iedtrigger = createTrigger ["EmptyDetector", [_t_xpos, _t_ypos]];
_t_iedtrigger setTriggerArea[5, 5, 0, false];
_t_iedtrigger setTriggerActivation["ANY", "PRESENT", false];
_t_strinf = format ["_tankylargeied%1 = createVehicle [""SEK_TR_GUE_largebomb"", [%2,%3], [], 0, ""NONE""];",_t_largeiedcount,_t_xpos,_t_ypos];
// in a vehicle or 3 or more players in the trigger, under 3m height and
// arty observers alive - d_no_more_observers <boolean> - d_nr_observers <number>
_t_iedtrigger setTriggerStatements ["thisList call fnc_MyFunc", _t_strinf, ""];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment