Add config for the chance of various attachments

This commit is contained in:
Chris Cardozo 2020-10-31 09:53:17 -04:00
parent d6b433d2e3
commit 99621912f6
3 changed files with 26 additions and 36 deletions

View File

@ -13,7 +13,7 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_i","_weap","_unit","_skillLevel","_aiSkills","_launcherRound","_index","_ammoChoices","_optics","_pointers","_muzzles","_underbarrel","_legalOptics"];
params["_pos","_aiGroup",["_skillLevel","red"],["_uniforms", []],["_headGear",[]],["_vests",[]],["_backpacks",[]],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]],["_scuba",false],["_garrison",false]];
params["_pos","_aiGroup",["_skillLevel","red"],["_uniforms", []],["_headGear",[]],["_vests",[]],["_backpacks",[]],["_launcher","none"],["_weaponList",[]],["_sideArms",[]],["_scuba",false],["_garrison",false]];
if (_weaponList isEqualTo []) then {_weaponList = [_skillLevel] call blck_fnc_selectAILoadout};
if (_sideArms isEqualTo []) then {_sideArms = [_skillLevel] call blck_fnc_selectAISidearms};
@ -92,17 +92,11 @@ _weap = selectRandom _weaponList;
_unit addWeaponGlobal _weap;
_ammoChoices = getArray (configFile >> "CfgWeapons" >> _weap >> "magazines");
_unit addMagazines[selectRandom _ammochoices,3];
/*
_optics = getArray (configfile >> "CfgWeapons" >> _weap >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems");
_pointers = getArray (configFile >> "CfgWeapons" >> _weap >> "WeaponSlotsInfo" >> "PointerSlot" >> "compatibleItems");
_muzzles = getArray (configFile >> "CfgWeapons" >> _weap >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems");
_underbarrel = getArray (configFile >> "CfgWeapons" >> _weap >> "WeaponSlotsInfo" >> "UnderBarrelSlot" >> "compatibleItems");
*/
if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 101] call BIS_fnc_compatibleItems))}; // muzzles
if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 201] call BIS_fnc_compatibleItems))}; // optics
if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 301] call BIS_fnc_compatibleItems))}; // pointers
if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 302] call BIS_fnc_compatibleItems))}; // underbarrel
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";
@ -126,23 +120,6 @@ if (round(random 10) <= 5) then
_unit addItem selectRandom blck_specialItems;
};
/*
if ( !(_Launcher isEqualTo "none") && !(_backpacks isEqualTo [])) then
{
_unit addWeaponGlobal _Launcher;
_unit addBackpack (selectRandom _backpacks);
for "_i" from 1 to 3 do
{
_unit addItemToBackpack (getArray (configFile >> "CfgWeapons" >> _Launcher >> "magazines") select 0); // call BIS_fnc_selectRandom;
};
_unit setVariable["Launcher",_launcher,true];
} else {
if ( random (1) < blck_chanceBackpack && !(_backpacks isEqualTo [])) then
{
_unit addBackpack selectRandom _backpacks;
};
};
*/
if !(_backpacks isEqualTo []) then
{
if (_Launcher isEqualTo "none") then
@ -152,14 +129,17 @@ if !(_backpacks isEqualTo []) then
_unit addBackpack selectRandom _backpacks;
};
} else {
_unit addWeaponGlobal _Launcher;
_unit addWeaponGlobal _launcher;
_unit addBackpack (selectRandom _backpacks);
private _roundsAdded = [];
private _mags = getArray (configFile >> "CfgWeapons" >> _Launcher >> "magazines");
for "_i" from 1 to 3 do
{
_unit addItemToBackpack (_mags select 0); // call BIS_fnc_selectRandom;
private _lr = selectRandom _mags; // call BIS_fnc_selectRandom;
_roundsAdded pushBack _lr;
_unit addItemToBackpack _lr;
};
_unit setVariable["Launcher",_launcher,true];
_unit setVariable["Launcher",[_launcher,_roundsAdded],true];
};
};

View File

@ -439,6 +439,12 @@
blck_maxMoneyRed = 15;
blck_maxMoneyBlue = 10;
// Define the chance of attachments
blck_chanceOptics = 0.4;
blck_chanceMuzzle = 0.3;
blck_chancePointer = 0.25;
blck_chanceUnderbarrel = 0.25;
#ifdef GRGserver
blck_AIAlertDistance = [250,450,650,800]; // Radius within which AI will be notified of enemy activity. Depricated as a group-sed system is used now. The group is informed of the enemy location when a group member is hit or killed.
//blck_AIAlertDistance = [150,225,400,500];

View File

@ -24,13 +24,13 @@
3) A time acceleration module.
*/
blck_spawnMapAddons = true; // When true map addons will be spawned based on parameters define in custum_server\MapAddons\MapAddons_init.sqf
blck_spawnStaticLootCrates = true; // When true, static loot crates will be spawned and loaded with loot as specified in custom_server\SLS\SLS_init_Epoch.sqf (or its exile equivalent).
blck_spawnMapAddons = false; // When true map addons will be spawned based on parameters define in custum_server\MapAddons\MapAddons_init.sqf
blck_spawnStaticLootCrates = false; // When true, static loot crates will be spawned and loaded with loot as specified in custom_server\SLS\SLS_init_Epoch.sqf (or its exile equivalent).
blck_simulationManager = blck_useBlckeaglsSimulationManagement;
blck_hideRocksAndPlants = true; // When true, any rocks, trees or bushes under enterable buildings will be 'hidden'
// Note that you can define map-specific variants in custom_server\configs\blck_custom_config.sqf
blck_useTimeAcceleration = true; // When true, time acceleration will be periodically updated based on amount of daylight at that time according to the values below.
blck_useTimeAcceleration = false; // When true, time acceleration will be periodically updated based on amount of daylight at that time according to the values below.
blck_timeAccelerationDay = 2; // Daytime time accelearation
blck_timeAccelerationDusk = 4; // Dawn/dusk time accelearation
blck_timeAccelerationNight = 8; // Nighttim time acceleration
@ -78,7 +78,7 @@
//Minimum distance between missions
blck_MinDistanceFromMission = 2000;
blck_minDistanceToBases = 800;
blck_minDistanceToBases = 500;
blck_minDistanceToPlayer = 500;
blck_minDistanceFromTowns = 300;
blck_minDistanceFromDMS = 500; // minimum distance for a blackeagls mission from any nearby DMS missions. set to -1 to disable this check.
@ -420,7 +420,11 @@
blck_maxMoneyGreen = 40;
blck_maxMoneyRed = 30;
blck_maxMoneyBlue = 20;
// Define the chance of attachments
blck_chanceOptics = 0.4;
blck_chanceMuzzle = 0.3;
blck_chancePointer = 0.25;
blck_chanceUnderbarrel = 0.25;
if (toLower(blck_modType) isEqualTo "epoch") then
{
[format[" Loading Mission System using Parameters for %1 for militarized servers",blck_modType]] call blck_fnc_log;