Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added function to ban ai dismount for crew #1064

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cScripts/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ class cScripts {
class init_aceTagging {};
class init_aceItemReplace {};

class init_skillAdjustment {};
class init_ai {};

class init_vehicle {};
class init_staging {};

Expand Down
22 changes: 15 additions & 7 deletions cScripts/cScripts_preInit.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "script_component.hpp";
/*
* Author: CPL.Brostrom.A
* Author: SGT.Brostrom.A
* This is the rules set for the mission using the cba XEH. Each setting here is alterd via cbaSettings
*/

Expand Down Expand Up @@ -37,19 +37,29 @@ private _cScriptSettings = "cScripts Mission Settings";
{},
true
] call CBA_fnc_addSetting;
[ // Ai setting
[ // AI setting
QEGVAR(Settings,setAiSystemDifficulty),
"LIST",
["AI Setting", "This adjustes the ai and make them less godlike and more arcade to play against."],
["AI Setting", "This adjusts the ai and make them less godlike and more arcade to play against."],
[_cScriptSettings, "1; Mission"],
[[0,1,2], ["Arma Default", "Adjusted", "Faction Based"], 2],
true,
{},
true
] call CBA_fnc_addSetting;
[ // AI dismount
QEGVAR(Settings,setAiBanDismountOfCrew),
"LIST",
["(Experimental) Allow AI dismount", "This allow or disallow ai crew to dismount vehicles."],
[_cScriptSettings, "1; Mission"],
false,
true,
{},
true
] call CBA_fnc_addSetting;


//2; Radios
// 2; Radios
[ // Enable
QEGVAR(Settings,enableRadios),
"CHECKBOX",
Expand Down Expand Up @@ -370,9 +380,7 @@ call EFUNC(init,chatCommands);

call EFUNC(init,zenModuels);

if (EGVAR(Settings,setAiSystemDifficulty) >= 1 ) then {
call EFUNC(init,skillAdjustment);
};
call EFUNC(init,ai);

call EFUNC(init,eventHandlers);

Expand Down
114 changes: 114 additions & 0 deletions cScripts/functions/init/fn_init_ai.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#include "..\script_component.hpp";
/*
* Author: SGT.Brostrom.A
* This function changes AI behaviours
*
* Example:
* call cScripts_fnc_init_ai
*
* Public: No
*/

if (!isServer) exitWith {};
INFO("AI", "Applying AI Custom AI...");

// AI Behavior
if (EGVAR(Settings,setAiBanDismountOfCrew)) then {
SHOW_WARNING("AI Experimental", "Vehicle AI dismount ban system applied to all vehicles.");
["AllVehicles", "init", {
params ["_vehicle"];
_vehicle setUnloadInCombat [true, false];
_vehicle allowCrewInImmobile [false, true];
}, true, ["man"], true] call CBA_fnc_addClassEventHandler;
};

// AI Skills
if (EGVAR(Settings,setAiSystemDifficulty) >= 1 ) then {
["CAManBase", "init", {
params ["_unit"];

if !(isPlayer _unit) then {
if (EGVAR(Settings,setAiSystemDifficulty) == 1) then {
_unit setSkill ["aimingspeed", 0.420];
_unit setSkill ["aimingaccuracy", 1.000];
_unit setSkill ["aimingshake", 0.360];
_unit setSkill ["spottime", 1.000];
_unit setSkill ["spotdistance", 1.000];
_unit setSkill ["commanding", 1.0];
_unit setSkill ["general", 1.0];
};
if (EGVAR(Settings,setAiSystemDifficulty) == 2) then {
if (getLighting select 1 <= 5) then {
if (hmd _unit != "") then {
_unit setSkill ["spottime", 0.015];
_unit setSkill ["spotdistance", 0.015];
} else {
_unit setSkill ["spottime", 0.520];
_unit setSkill ["spotdistance", 0.520];
};
} else {
_unit setSkill ["spottime", 1.000];
_unit setSkill ["spotdistance", 1.000];
};

switch (faction _unit) do {
case "rhs_faction_msv";
case "rhs_faction_rva";
case "rhs_faction_tv";
case "rhs_faction_vdv_45";
case "rhs_faction_vdv";
case "rhs_faction_vmf";
case "rhs_faction_vpvo";
case "rhs_faction_vv";
case "rhs_faction_vvs_c";
case "rhs_faction_vvs": {
_unit setSkill ["general", 1.000];
_unit setSkill ["commanding", 0.950];
_unit setSkill ["courage", 1.000];
_unit setSkill ["aimingspeed", 0.720];
_unit setSkill ["aimingaccuracy", 0.920];
_unit setSkill ["aimingshake", 0.260];
_unit setSkill ["reloadSpeed", 1.000];
};
default {
_unit setSkill ["general", 0.900]; // Bad <=> Good
_unit setSkill ["commanding", 0.750]; // Bad <=> Good
_unit setSkill ["courage", 0.750]; // Bad <=> Good
_unit setSkill ["aimingspeed", 0.620]; // Bad <=> Good
_unit setSkill ["aimingaccuracy", 0.830]; // Bad <=> Good
_unit setSkill ["aimingshake", 0.360]; // Good <=> Bad
_unit setSkill ["reloadSpeed", 0.750]; // Bad <=> Good
};
};

// Role adjusted
if (getText (configfile >> "CfgVehicles" >> typeOf _unit >> "textSingular") == "machinegunner") then {
_unit setSkill ["aimingspeed", 0.820];
_unit setSkill ["aimingaccuracy", 0.820];
_unit setSkill ["aimingshake", 0.350];
_unit setSkill ["reloadSpeed", 0.800];
};
if (getText (configfile >> "CfgVehicles" >> typeOf _unit >> "textSingular") == "sniper") then {
_unit setSkill ["aimingspeed", 0.600];
_unit setSkill ["aimingaccuracy", 0.950];
_unit setSkill ["aimingshake", 0.100];
_unit setSkill ["reloadSpeed", 0.800];
};

// For logging
private _skillArray = [
["general", _unit skill "general", _unit skillFinal "general"],
["commanding", _unit skill "commanding", _unit skillFinal "commanding"],
["courage", _unit skill "courage", _unit skillFinal "courage"],
["aimingspeed", _unit skill "aimingspeed", _unit skillFinal "aimingspeed"],
["aimingaccuracy", _unit skill "aimingaccuracy", _unit skillFinal "aimingaccuracy"],
["aimingshake", _unit skill "aimingshake", _unit skillFinal "aimingshake"],
["reloadSpeed", _unit skill "reloadSpeed", _unit skillFinal "reloadSpeed"],
["spottime", _unit skill "spottime", _unit skill "spottime"],
["spotdistance", _unit skill "spotdistance", _unit skillFinal "spotdistance"]
];
INFO_3("AI","Unit %1 (%2) have skill levels %3.", _unit, typeOf _unit, _skillArray);
};
};
}, true, [], true] call CBA_fnc_addClassEventHandler;
};
102 changes: 0 additions & 102 deletions cScripts/functions/init/fn_init_skillAdjustment.sqf

This file was deleted.