Streamline coding Build 235

This commit is contained in:
Chris Cardozo 2020-11-16 13:31:00 -05:00
parent 6abfb94813
commit 388a3bc95d
14 changed files with 63 additions and 167 deletions

View File

@ -12,13 +12,5 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_chancePara"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_chancePara = blck_chanceParaBlue};
case "red": {_chancePara = blck_chanceParaRed};
case "green": {_chancePara = blck_chanceParaGreen};
case "orange": {_chancePara = blck_chanceParaOrange};
default {_chancePara = blck_chanceParaRed};
};
_chancePara
private _chancePara = missionNamespace getVariable[format["blck_chancePara%1",_aiDifficultyLevel],0];
_chancePara

View File

@ -12,13 +12,5 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_backpacks"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_backpacks = blck_backpacks_blue};
case "red": {_backpacks = blck_backpacks_red};
case "green": {_backpacks = blck_backpacks_green};
case "orange": {_backpacks = blck_backpacks_orange};
default {_backpacks = blck_backpacks};
};
_backpacks
private _backpacks = missionNamespace getVariable[format["blck_backpacks_%1",_aiDifficultyLevel],[]];
_backpacks

View File

@ -12,13 +12,5 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_headgear"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_headGear = blck_headgear_blue};
case "red": {_headGear = blck_headgear_red};
case "green": {_headGear = blck_headgear_green};
case "orange": {_headGear = blck_headgear_orange};
default {_headGear = blck_headgear};
};
_headgear
private _headgear = missionNamespace getVariable [format["blck_headgear_%1",_aiDifficultyLevel],[]];
_headgear

View File

@ -16,14 +16,6 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_weaponList","_missionColor"];
_missionColor = _this select 0;
switch (_missionColor) do {
case "blue": {_weaponList = blck_WeaponList_Blue;};
case "red": {_weaponList = blck_WeaponList_Red;};
case "green": {_weaponList = blck_WeaponList_Green;};
case "orange": {_weaponList = blck_WeaponList_Orange;};
default {_weaponList = blck_WeaponList_Blue;};
};
params["_missionColor"];
private _weaponList = missionNamespace getVariable [format["blck_WeaponList_%1",_missionColor],[]];
_weaponList

View File

@ -13,13 +13,5 @@
params["_aiDifficultyLevel"]; //[["_aiDifficultyLevel",selectRandom["Red","Green"]]];
private["_sideArms"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_sideArms = blck_Pistols_blue};
case "red": {_sideArms = blck_Pistols_red};
case "green": {_sideArms = blck_Pistols_green};
case "orange": {_sideArms = blck_Pistols_orange};
default {_sideArms = blck_Pistols};
};
_sideArms
private _sideArms = missionNamespace getVariable[format["blck_Pistols_%1",_aiDifficultyLevel],[]];
_sideArms

View File

@ -12,13 +12,5 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_uniforms"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_uniforms = blck_SkinList_blue};
case "red": {_uniforms = blck_SkinList_red};
case "green": {_uniforms = blck_SkinList_green};
case "orange": {_uniforms = blck_SkinList_orange};
default {_uniforms = blck_SkinList};
};
_uniforms
private _uniforms = missionNamespace getVariable [format["blck_SkinList_%1",_aiDifficultyLevel],[]];
_uniforms

View File

@ -12,13 +12,5 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_vests"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_vests = blck_vests_blue};
case "red": {_vests = blck_vests_red};
case "green": {_vests = blck_vests_green};
case "orange": {_vests = blck_vests_orange};
default {_vests = blck_vests};
};
_vests
private _vests = missionNamespace getVariable [format["blck_vests_%1",_aiDifficultyLevel],[]];
_vests

View File

@ -12,13 +12,5 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_chanceHeliPatrol"];
switch (toLower(_aiDifficultyLevel)) do
{
case "blue": {_chanceHeliPatrol = blck_chanceHeliPatrolBlue};
case "red": {_chanceHeliPatrol = blck_chanceHeliPatrolRed};
case "green": {_chanceHeliPatrol = blck_chanceHeliPatrolGreen};
case "orange": {_chanceHeliPatrol = blck_chanceHeliPatrolOrange};
default {_chanceHeliPatrol = 0};
};
_chanceHeliPatrol
private _chanceHeliPatrol = missionNamespace getVariable[format["blck_chanceHeliPatrol%1",_aiDifficultyLevel],[]];
_chanceHeliPatrol

View File

@ -12,13 +12,5 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_missionHelis"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_missionHelis = blck_patrolHelisBlue};
case "red": {_missionHelis = blck_patrolHelisRed};
case "green": {_missionHelis = blck_patrolHelisGreen};
case "orange": {_missionHelis = blck_patrolHelisOrange};
default {_missionHelis = blck_patrolHelisBlue};
};
_missionHelis
private _missionHelis = missionNamespace getVariable[format["blck_patrolHelis%1",_aiDifficultyLevel],[]];
_missionHelis

View File

@ -12,13 +12,5 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_noChoppers"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_noChoppers = blck_noPatrolHelisBlue};
case "red": {_noChoppers = blck_noPatrolHelisRed};
case "green": {_noChoppers = blck_noPatrolHelisGreen};
case "orange": {_noChoppers = blck_noPatrolHelisOrange};
default {_noChoppers = 0};
};
_noChoppers
private _noChoppers = missionNamespace getVariable [format["blck_noPatrolHelis%1",_aiDifficultyLevel],0];
_noChoppers

View File

@ -12,13 +12,5 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"];
private["_noPara"];
switch (toLower (_aiDifficultyLevel)) do
{
case "blue": {_noPara = blck_noParaBlue};
case "red": {_noPara = blck_noParaRed};
case "green": {_noPara = blck_noParaGreen};
case "orange": {_noPara = blck_noParaOrange};
default {_noPara = 0};
};
_noPara
private _noPara = missionNamespace getVariable [format["blck_noPara%1",_aiDifficultyLevel],0];
_noPara

View File

@ -11,13 +11,5 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_diff"];
private ["_count"];
switch (toLower(_diff)) do
{
case "blue": {_count = blck_vehCrew_blue};
case "red": {_count = blck_vehCrew_red};
case "green": {_count = blck_vehCrew_green};
case "orange": {_count = blck_vehCrew_orange};
};
private _count = missionNamespace getVariable [format["blck_vehCrew_%1",_diff],0];
_count

View File

@ -70,31 +70,23 @@ _unit allowDammage true;
_unit setBehaviour "COMBAT";
_unit setunitpos "AUTO";
_unit forceAddUniform (selectRandom _uniforms);
if !(_headGear isEqualTo []) then
{
_unit addHeadgear (selectRandom _headGear);
if !(_uniforms isEqualTo []) then {_unit forceAddUniform (selectRandom _uniforms)};
if !(_headGear isEqualTo []) then {_unit addHeadgear (selectRandom _headGear)};
if !(_vests isEqualTo []) then {_unit addVest (selectRandom _vests)};
if (_weaponList isEqualTo []) then {
_weap = selectRandom _weaponList;
_unit addWeaponGlobal _weap;
_ammoChoices = getArray (configFile >> "CfgWeapons" >> _weap >> "magazines");
_unit addMagazines[selectRandom _ammochoices,3];
if (random 1 < blck_chanceMuzzle) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 101] call BIS_fnc_compatibleItems))}; // muzzles
if (random 1 < blck_chanceOptics) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 201] call BIS_fnc_compatibleItems))}; // optics
if (random 1 < blck_chancePointer) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 301] call BIS_fnc_compatibleItems))}; // pointers
if (random 1 < blck_chanceUnderbarrel) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 302] call BIS_fnc_compatibleItems))}; // underbarrel
if ((count(getArray (configFile >> "cfgWeapons" >> _weap >> "muzzles"))) > 1) then
{
_unit addMagazine "1Rnd_HE_Grenade_shell";
};
};
if !(_vests isEqualTo []) then
{
_unit addVest (selectRandom _vests);
};
if (_weaponList isEqualTo []) then {_weaponList = call blck_fnc_selectAILoadout};
_weap = selectRandom _weaponList;
_unit addWeaponGlobal _weap;
_ammoChoices = getArray (configFile >> "CfgWeapons" >> _weap >> "magazines");
_unit addMagazines[selectRandom _ammochoices,3];
if (random 1 < blck_chanceMuzzle) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 101] call BIS_fnc_compatibleItems))}; // muzzles
if (random 1 < blck_chanceOptics) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 201] call BIS_fnc_compatibleItems))}; // optics
if (random 1 < blck_chancePointer) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 301] call BIS_fnc_compatibleItems))}; // pointers
if (random 1 < blck_chanceUnderbarrel) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 302] call BIS_fnc_compatibleItems))}; // underbarrel
if ((count(getArray (configFile >> "cfgWeapons" >> _weap >> "muzzles"))) > 1) then
{
_unit addMagazine "1Rnd_HE_Grenade_shell";
};
if !(_sideArms isEqualTo []) then
{
_weap = selectRandom _sideArms;
@ -102,17 +94,21 @@ if !(_sideArms isEqualTo []) then
_ammoChoices = getArray (configFile >> "CfgWeapons" >> _weap >> "magazines");
_unit addMagazines [selectRandom _ammoChoices, 2];
};
for "_i" from 1 to (1+floor(random(4))) do
if !(blck_ConsumableItems isEqualTo []) then
{
_unit addItem (selectRandom blck_ConsumableItems);
for "_i" from 1 to (1+floor(random(4))) do
{
_unit addItem (selectRandom blck_ConsumableItems);
};
};
// Add First Aid or Grenade 50% of the time
if (round(random 10) <= 5) then
if !(blck_specialItems isEqualTo []) then
{
_unit addItem selectRandom blck_specialItems;
// Add First Aid or Grenade 50% of the time
if (round(random 10) <= 5) then
{
_unit addItem selectRandom blck_specialItems;
};
};
if !(_backpacks isEqualTo []) then
{
if (_Launcher isEqualTo "none") then
@ -132,18 +128,18 @@ if !(_backpacks isEqualTo []) then
_roundsAdded pushBack _lr;
_unit addItemToBackpack _lr;
};
_unit setVariable["Launcher",[_launcher,_roundsAdded],true];
_unit setVariable["Launcher",[_launcher,_roundsAdded]];
};
};
if(sunOrMoon < 0.2 && blck_useNVG)then
{
_unit addWeapon selectRandom blck_NVG;
_unit setVariable ["hasNVG", true,true];
_unit setVariable ["hasNVG", true];
}
else
{
_unit setVariable ["hasNVG", false,true];
_unit setVariable ["hasNVG", false];
};
_unit addWeapon selectRandomWeighted["",4,"Binocular",3,"Rangefinder",1];
@ -153,20 +149,12 @@ _unit addEventHandler ["Reloaded", {_this call blck_EH_unitWeaponReloaded;}];
_unit addMPEventHandler ["MPKilled", {[(_this select 0), (_this select 1)] call blck_EH_AIKilled;}];
_unit addMPEventHandler ["MPHit",{[_this] call blck_EH_AIHit;}];
switch (_skillLevel) do
{
case "blue": {_index = 0;_aiSkills = blck_SkillsBlue;};
case "red": {_index = 1;_aiSkills = blck_SkillsRed;};
case "green": {_index = 2;_aiSkills = blck_SkillsGreen;};
case "orange": {_index = 3;_aiSkills = blck_SkillsOrange;};
default {_index = 0;_aiSkills = blck_SkillsBlue;};
};
[_unit,_aiSkills] call blck_fnc_setSkill;
_unit setVariable ["alertDist",blck_AIAlertDistance select _index,true];
_unit setVariable ["intelligence",blck_AIIntelligence select _index,true];
_unit setVariable ["GMS_AI",true,true];
[_unit, missionNamespace getVariable[format["blck_Skills%1",_skillLevel],blck_SkillsRed]] call blck_fnc_setSkill;
_index = missionNamespace getVariable[format["blck_skillsIndex_%1",_skillLevel],1];
_unit setVariable ["alertDist",blck_AIAlertDistance select _index];
_unit setVariable ["intelligence",blck_AIIntelligence select _index];
_unit setVariable ["GMS_AI",true];
//diag_log format["_spawnUnit: _index = %1 | _aiSkills = %2",_index,_aiSkills];
_unit

View File

@ -57,6 +57,10 @@ blck_activeMonitorThreads = 0;
blck_validEndStates = ["allUnitsKilled", "playerNear", "allKilledOrPlayerNear","assetSecured"];
blck_validLootSpawnTimings = ["atMissionSpawnGround","atMissionSpawnAir","atMissionEndGround","atMissionEndAir"];
blck_validLootLoadTimings = ["atMissionCompletion", "atMissionSpawn"];
blck_skillsIndex_Blue = 0;
blck_skillsIndex_Red = 1;
blck_skillsIndex_Green = 2;
blck_skillsIndex_Orange = 3;
if (blck_debugOn) then {diag_log "[blckeagls] Variables Loaded"};