fnc_emp_disableVehicle.sqf 914 B

12345678910111213141516171819202122232425262728293031323334
  1. params["_vehicle"];
  2. if!(local _vehicle) exitWith { };
  3. _vehicle allowCrewInImmobile true;
  4. _vehicle lock 2;
  5. {
  6. _x setBehaviour "CARELESS";
  7. _x setCombatMode "BLUE";
  8. _x disableAI "TARGET";
  9. _x disableAI "AUTOTARGET";
  10. _x disableAI "MOVE";
  11. _x disableAI "FSM";
  12. } forEach crew _vehicle;
  13. (getAllHitPointsDamage _vehicle) params [["_allHitPoints", []], ["", []], ["", []]];
  14. {
  15. private _isEngineLower = (_x find "engine") != -1;
  16. private _isEngineUpper = (_x find "Engine") != -1;
  17. if(_isEngineLower || _isEngineUpper) then {
  18. _vehicle setHitPointDamage [_x, 1, true];
  19. diag_log format["[RD501][Vehicle EMP] Damaging %1", _x];
  20. };
  21. private _isTurretLower = (_x find "turret") != -1;
  22. private _isTurretUpper = (_x find "Turret") != -1;
  23. if(_isEngineLower || _isEngineUpper) then {
  24. _vehicle setHitPointDamage [_x, 1, true];
  25. diag_log format["[RD501][Vehicle EMP] Damaging %1", _x];
  26. };
  27. } forEach _allHitPoints;