Skip to content

Commit

Permalink
Added way to immobilise vehicle by disabling the drivers AI
Browse files Browse the repository at this point in the history
  • Loading branch information
cineafx committed May 21, 2022
1 parent ba53e43 commit a133488
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 1 deletion.
2 changes: 1 addition & 1 deletion addons/main/script_version.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define MAJOR 2
#define MINOR 1
#define MINOR 2
#define PATCHLVL 0
#define BUILD 0
2 changes: 2 additions & 0 deletions addons/vehicles/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ PREP(moduleAllowCrew);
PREP(moduleClearAllInventories);
PREP(moduleClearInventory);
PREP(moduleDisableCookoff);
PREP(moduleImmobiliseVehicle);

// Module code
PREP(allowCrew);
PREP(clearInventory);
PREP(disableCookoff);
PREP(immobiliseVehicle);
1 change: 1 addition & 0 deletions addons/vehicles/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
[] call FUNC(moduleClearAllInventories);
[] call FUNC(moduleClearInventory);
[] call FUNC(moduleDisableCookOff);
[] call FUNC(moduleImmobiliseVehicle);
31 changes: 31 additions & 0 deletions addons/vehicles/functions/fnc_immobiliseVehicle.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "script_component.hpp"
/*
* Author: cineafx
* Disable the ai of a drivers of vehicles.
*
* Arguments:
* 0: Vehicles to clear the inventory of. <Array> (default: [])
*
* Return Value:
* nothing
*
* Example:
* [_units] call CINE_addizeus_vehicles_fnc_immobiliseVehicle
*
* Public: [No]
*/

params [["_units", []]];

TRACE_1("params",_units);

{
if (_x isKindOf "AllVehicles") then {
if !(isPlayer _x) then {
(driver _x) disableAI "all";
//(driver _x) setBehaviour "CARELESS";
}
}
} forEach _units;

true;
44 changes: 44 additions & 0 deletions addons/vehicles/functions/fnc_moduleImmobiliseVehicle.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include "script_component.hpp"
/*
* Author: cineafx
* Adds a zeus module which disables the ai of a driver.
* Automatically detects Ares Achilles and ZEN.
*
* Arguments:
* none
*
* Return Value:
* nothing
*
* Example:
* [] call CINE_addizeus_vehicles_fnc_moduleImmobiliseVehicle
*
* Public: [No]
*/

if (isClass (configFile >> 'cfgPatches' >> "achilles_modules_f_achilles")) then {
[
"CINE vehicles",
"Immobilise vehicle (disable Driver AI)",
{
params ["_pos", "_attachedObject"];

[_attachedObject, DFUNC(immobiliseVehicle), "Immobilised vehicle.",[], "Vehicles"] call EFUNC(common,moduleHandler);
}
] call Ares_fnc_RegisterCustomModule;
};

if (isClass (configFile >> 'cfgPatches' >> "zen_modules")) then {
[
"CINE vehicles",
"Immobilise vehicle (disable Driver AI)",
{
params ["_pos", "_attachedObject"];

[_attachedObject, DFUNC(immobiliseVehicle), "Immobilised vehicle.",[], "Vehicles"] call EFUNC(common,moduleHandler);
},
"\a3\missions_f_oldman\Data\img\HoldActions\holdAction_follow_stop_ca.paa"
] call zen_custom_modules_fnc_register;
};

true;

0 comments on commit a133488

Please sign in to comment.