Skip to content

Instantly share code, notes, and snippets.

@Neefay
Last active August 29, 2015 14:12
Show Gist options
  • Select an option

  • Save Neefay/b00933d5f71fc3e285d3 to your computer and use it in GitHub Desktop.

Select an option

Save Neefay/b00933d5f71fc3e285d3 to your computer and use it in GitHub Desktop.
Check for explosives/other objects
/*
Functionality:
Detects any kind of object then executes an event.
Arguments:
0 - object you want to check
1 - type of object you're checking for
2 - how far are you checking
3 - the amount necessary
Example:
[car1, "ATMine_Range_Ammo", 5, 2] execVM "fn_checkObjs.sqf";
2 AT mines must be placed at least 5 meters from the car1 object.
*/
if (!isServer) exitWith {};
private["_ref","_type","_dist","_amount","_objs"];
_ref = _this select 0;
_type = _this select 1;
_dist = _this select 2;
_amount = _this select 3;
while {(true)} do {
_objs = _ref nearobjects [_type, _dist];
if (count _objs >= _amount) exitWith {
// =====================================================================
// THIS WILL HAPPEN WHEN THE OBJECTS HAVE BEEN DETECTED!
// =====================================================================
hint "Enough objects for this area!";
// =====================================================================
};
sleep 1;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment