Skip to content

Instantly share code, notes, and snippets.

@Starfox64
Created August 5, 2015 02:23
Show Gist options
  • Save Starfox64/89d9692103aa71c3d1ab to your computer and use it in GitHub Desktop.
Save Starfox64/89d9692103aa71c3d1ab to your computer and use it in GitHub Desktop.
BIS_hideUnits = {
private ["_units", "_mode"];
_units = [_this, 0, objNull, [objNull, []]] call BIS_fnc_param;
_mode = [_this, 1, 0, [0]] call BIS_fnc_param; // 0 - hide (default), 1 - unhide
if (_mode == 0) then {
// Hide
{
{
private ["_unit"];
_unit = _x;
_unit hideObjectGlobal true;
_unit enableSimulationGlobal false;
_unit allowDamage false;
//_unit setCaptive true;
{_unit disableAI _x} forEach ["ANIM", "AUTOTARGET", "FSM", "MOVE", "TARGET"];
} forEach ([vehicle _x, commander _x, gunner _x, driver _x, _x] + crew _x);
} forEach _units;
} else {
// Unhide
{
{
private ["_unit"];
_unit = _x;
_unit hideObjectGlobal false;
_unit enableSimulationGlobal true;
_unit allowDamage true;
//_unit setCaptive false;
{_unit enableAI _x} forEach ["ANIM", "AUTOTARGET", "FSM", "MOVE", "TARGET"];
} forEach ([vehicle _x, commander _x, gunner _x, driver _x, _x] + crew _x);
} forEach _units;
};
true
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment