diff --git a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit - Copy.sqf b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit - Copy.sqf new file mode 100644 index 0000000..efaad09 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit - Copy.sqf @@ -0,0 +1,191 @@ +/* + blck_fnc_spawnUnit + Original Code by blckeagls + Modified by Ghostrider + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +private ["_i","_weap","_skin","_unit","_skillLevel","_aiSkills","_launcherRound","_index","_ammoChoices","_modType","_optics","_pointers","_muzzles","_underbarrel","_legalOptics"]; +params["_pos","_aiGroup",["_skillLevel","red"],["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]],["_scuba",false]]; + +#ifdef blck_debugMode +if (blck_debugLevel >= 2) then +{ + private _params = ["_pos","_aiGroup","_skillLevel","_uniforms","_headGear","_vests","_backpacks","_Launcher","_weaponList","_sideArms","_scuba"]; //"_weaponList", "_Launcher" + { + diag_log format["_fnc_spawnUnit::-> _this select %1 (%2) = %3",_forEachIndex, _params select _forEachIndex, _this select _forEachIndex]; + }forEach _this; +}; +#endif +if (isNull _aiGroup) exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnUnit"}; + +_unit = ObjNull; +_modType = call blck_fnc_getModType; +if (_modType isEqualTo "Epoch") then +{ + "I_Soldier_EPOCH" createUnit [[0,0,0], _aiGroup, "_unit = this", blck_baseSkill, "COLONEL"]; + _unit setVariable ["LAST_CHECK",28800,true]; + switch(_skillLevel) do + { + case "blue":{_unit setVariable["Crypto",2 + floor(random(blck_maxMoneyBlue)),true];}; + case "red":{_unit setVariable["Crypto",4 + floor(random(blck_maxMoneyRed)),true];}; + case "green":{_unit setVariable["Crypto",6 + floor(random(blck_maxMoneyGreen)),true];}; + case "orange":{_unit setVariable["Crypto",8 + floor(random(blck_maxMoneyOrange)),true];}; + }; +}; +if (_modType isEqualTo "Exile") then +{ + "i_g_soldier_unarmed_f" createUnit [[0,0,0], _aiGroup, "_unit = this", blck_baseSkill, "COLONEL"]; + switch(_skillLevel) do + { + case "blue":{_unit setVariable["ExileMoney",2 + floor(random(blck_maxMoneyBlue)),true];}; + case "red":{_unit setVariable["ExileMoney",4 + floor(random(blck_maxMoneyRed)),true];}; + case "green":{_unit setVariable["ExileMoney",6 + floor(random(blck_maxMoneyGreen)),true];}; + case "orange":{_unit setVariable["ExileMoney",8 + floor(random(blck_maxMoneyOrange)),true];}; + }; +}; +// findEmptyPosition [minDistance, maxDistance, vehicleType] +_unit setPos ( _pos findEmptyPosition [0.1,3,(typeOf _unit)]); +#ifdef blck_debugMode +if (blck_debugLevel >= 2) then +{ + diag_log format["_fnc_spawnUnit::-->> unit spawned = %1",_unit]; +}; +#endif +[_unit] call blck_fnc_removeGear; +if (_scuba) then +{ + _unit swiminDepth (_pos select 2); + #ifdef blck_debugMode + if (blck_debugLevel >= 2) then + { + diag_log format["_fnc_spawnUnit:: -- >> unit depth = %1 and underwater for unit = %2",_pos select 2, underwater _unit]; + }; + #endif +}; +_skin = ""; +_counter = 1; +//diag_log format["_fnc_spawnUnit: _uniforms = %1",_uniforms]; +while {_skin isEqualTo "" && _counter < 10} do +{ + _unit forceAddUniform (selectRandom _uniforms); + _skin = uniform _unit; + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log format["_fnc_spawnUnit::-->> for unit _unit % uniform is %2",_unit, uniform _unit]; + }; + #endif + _counter =+1; +}; +//Sets AI Tactics +_unit enableAI "ALL"; +_unit allowDammage true; +_unit setBehaviour "COMBAT"; +_unit setunitpos "AUTO"; + +if (_headGear isEqualTo []) then {_unit addHeadgear (selectRandom _headGear)}; +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"); +_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"); +_legalOptics = _optics - blck_blacklistedOptics; + +_unit addMagazines [selectRandom _ammoChoices, 3]; + +if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom _muzzles)}; +if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom _legalOptics)}; +if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom _pointers)}; +if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom _muzzles)}; +if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom _underbarrel)}; +if ((count(getArray (configFile >> "cfgWeapons" >> _weap >> "muzzles"))) > 1) then +{ + _unit addMagazine "1Rnd_HE_Grenade_shell"; +}; + +if !(_sideArms isEqualTo []) then +{ + _weap = selectRandom _sideArms; + //diag_log format["[spawnUnit.sqf] _weap os %1",_weap]; + _unit addWeaponGlobal _weap; + _ammoChoices = getArray (configFile >> "CfgWeapons" >> _weap >> "magazines"); + _unit addMagazines [selectRandom _ammoChoices, 2]; +}; +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 +{ + //diag_log format["spawnUnit.sqf] -- Item is %1", _item]; + _unit addItem selectRandom blck_specialItems; +}; +//diag_log format["_spawnUnit: _Launcher = %1",_Launcher]; +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(sunOrMoon < 0.2 && blck_useNVG)then +{ + _unit addWeapon selectRandom blck_NVG; + _unit setVariable ["hasNVG", true,true]; +} +else +{ + _unit setVariable ["hasNVG", false,true]; +}; + +#ifdef blck_debugMode +if (blck_debugLevel > 2) then +{ + diag_log format["_fnc_spawnUnit:: --> unit loadout = %1", getUnitLoadout _unit]; +}; +#endif + +_unit addEventHandler ["Reloaded", {_this call compile preprocessfilelinenumbers blck_EH_unitWeaponReloaded;}]; +_unit addMPEventHandler ["MPKilled", {[(_this select 0), (_this select 1)] call compile preprocessfilelinenumbers blck_EH_AIKilled;}]; // changed to reduce number of concurrent threads, but also works as spawn blck_AIKilled; }]; +_unit addMPEventHandler ["MPHit",{ [_this] call compile preprocessFileLineNumbers 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 + + diff --git a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit.sqf b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit.sqf index 51494f9..3d0da1f 100644 --- a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit.sqf +++ b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit.sqf @@ -30,7 +30,7 @@ _unit = ObjNull; _modType = call blck_fnc_getModType; if (_modType isEqualTo "Epoch") then { - "I_Soldier_EPOCH" createUnit [_pos, _aiGroup, "_unit = this", blck_baseSkill, "COLONEL"]; + "I_Soldier_EPOCH" createUnit [[0,0,0], _aiGroup, "_unit = this", blck_baseSkill, "COLONEL"]; _unit setVariable ["LAST_CHECK",28800,true]; switch(_skillLevel) do { @@ -42,7 +42,7 @@ if (_modType isEqualTo "Epoch") then }; if (_modType isEqualTo "Exile") then { - "i_g_soldier_unarmed_f" createUnit [_pos, _aiGroup, "_unit = this", blck_baseSkill, "COLONEL"]; + "i_g_soldier_unarmed_f" createUnit [[0,0,0], _aiGroup, "_unit = this", blck_baseSkill, "COLONEL"]; switch(_skillLevel) do { case "blue":{_unit setVariable["ExileMoney",2 + floor(random(blck_maxMoneyBlue)),true];}; @@ -51,6 +51,8 @@ if (_modType isEqualTo "Exile") then case "orange":{_unit setVariable["ExileMoney",8 + floor(random(blck_maxMoneyOrange)),true];}; }; }; +// findEmptyPosition [minDistance, maxDistance, vehicleType] +_unit setPos ( _pos findEmptyPosition [0.1,3,(typeOf _unit)]); #ifdef blck_debugMode if (blck_debugLevel >= 2) then { @@ -89,8 +91,17 @@ _unit allowDammage true; _unit setBehaviour "COMBAT"; _unit setunitpos "AUTO"; -if (_headGear isEqualTo []) then {_unit addHeadgear (selectRandom _headGear)}; -if (_vests isEqualTo []) then {_unit addVest (selectRandom _vests)}; +if !(_headGear isEqualTo []) then +{ + _unit addHeadgear (selectRandom _headGear); + diag_log format["Headgear for unit %1 = %2",_unit, headgear _unit]; +}; +if !(_vests isEqualTo []) then +{ + _unit addVest (selectRandom _vests); + diag_log format["Vest for unit %1 = %2",_unit, vest _unit]; +}; + if (_weaponList isEqualTo []) then {_weaponList = call blck_fnc_selectAILoadout}; _weap = selectRandom _weaponList; _unit addWeaponGlobal _weap; diff --git a/@GMS/addons/custom_server/Compiles/blck_variables.sqf b/@GMS/addons/custom_server/Compiles/blck_variables.sqf index ec691b9..54f562a 100644 --- a/@GMS/addons/custom_server/Compiles/blck_variables.sqf +++ b/@GMS/addons/custom_server/Compiles/blck_variables.sqf @@ -12,8 +12,8 @@ */ #include"\q\addons\custom_server\Configs\blck_defines.hpp"; -blck_debugON = false; -blck_debugLevel = 0; // Sets level of detail for debugging info - WIP. +blck_debugON = true; +blck_debugLevel = 2; // Sets level of detail for debugging info - WIP. blck_minFPS = 8; //////////////////////////////////////////////// diff --git a/@GMS/addons/custom_server/init/build.sqf b/@GMS/addons/custom_server/init/build.sqf index 1ffb20b..53d2d16 100644 --- a/@GMS/addons/custom_server/init/build.sqf +++ b/@GMS/addons/custom_server/init/build.sqf @@ -1,6 +1,6 @@ private ["_version","_versionDate"]; -blck_version = "6.81 Build 129"; +blck_version = "6.81 Build 130"; _blck_version = blck_version; -_blck_versionDate = "5-15-18 4:00 PM"; +_blck_versionDate = "5-28-18 4:00 PM"; blck_pvs_version = _blck_version; publicVariable blck_pvs_version; diff --git a/changeLog.sqf b/changeLog.sqf index 3c3bbb2..b455d38 100644 --- a/changeLog.sqf +++ b/changeLog.sqf @@ -8,7 +8,14 @@ Ideas or code from that by Vampire and KiloSwiss have been used for certain func Significant Changes: ===================== -Version 1.81 Build 126 (EXPERIMENTAL). +Version 1.81 Build 130 (EXPERIMENTAL). +Added: Male and Female uniforms are separated and can be used alone or together for specific missiosn (Epoch Only). + +Added: Loot tables updated to include food and supplies as of Epoch 1.1.0. + +Added: Setting that configures vehicles to be sold at Black Market Traders. + blck_allowSalesAtBlackMktTraders = true; // Allow vehicles to be sold at Halvjes black market traders. + Added: Support for hostage rescue missions. The hostage can be spawned at any location relative to the mission center. The mission aborts if the hostage is killed; all loot is deleted. @@ -25,16 +32,25 @@ Added: Support for Arrest Leader missions. See missions\blue\Default4.sqf for an example mission Added: blck_missionEndCondition = "playerNear"; // Options are "allUnitsKilled", "playerNear", "allKilledOrPlayerNear" - which provides a simple way to define the default condtions under which the mission ends. + which provides a simple way to define the default conditions under which the mission ends for all missions. You can of course define _endCondition in the specific mission file if you wish. -Added: blck_spawnCratesTiming = "atMissionEndAir"; // Choices: "atMissionSpawnGround","atMissionStartAir","atMissionEndGround","atMissionEndAir". - Crates can be spawned on the ground at mission start or at mission end either on the ground or in the air. +Added: A new mission completion condition for hostage and captive missions. + _endCondition = "assetSecured"; + +Added: Mission crates can now be spawned on the ground or in the air at mission completion. + blck_spawnCratesTiming sets the default for all missions. + blck_spawnCratesTiming = "atMissionEndAir"; // Choices: "atMissionSpawnGround","atMissionStartAir","atMissionEndGround","atMissionEndAir". + Define _spawnCratesTiming to set this parameter for a particular mission. + _spawnCratesTiming = "atMissionEndAir"; + See the hostage1.sqf mission as an example. + Added: Crates spawn with tabs or crypto. set the values in the mod-specific configs. -Added: support for hostages/leaders(who must be arrested) (work in progress). You can set the crate to spawn after successfully freeing the captive using the setting above. - Note - you need to update blck_client in your mission.pbo to use this mission mode. + For Epoch, the crypto can be access by pressing space bar. + Added: Additional documentation for those who wish to design their own missions. See \missions\blue\default.sqf and default2.sqf for details. + Added: greater control over AI loadouts. For land-based dynamic missions you can now specify for each mission: Uniforms @@ -44,6 +60,7 @@ Added: greater control over AI loadouts. Sidearms allows. (See \Missions\Blue\default2.sqf for examples). [Still to do: upgrade statics for the same functionality; doable but will require adding these parameters to the spawn info for the groups of infantry, vehicle, submerged and air units]; + Added: greater control of mission helis - you can now set variables in the mission file (see examples below). when these are not defined in the mission file, defaults are used. _chancePara = blck_chanceParaBlue; // Setting this in the mission file overrides the defaults @@ -51,6 +68,7 @@ Added: greater control of mission helis - you can now set variables in the missi _chanceHeliPatrol = blck_chanceHeliPatrolBlue; // Setting this in the mission file overrides the defaults _noChoppers = blck_noPatrolHelisBlue; _missionHelis = blck_patrolHelisBlue; + Added: default minimun and maximum radius for groups to patrol. blck_minimumPatrolRadius = 22; // AI will patrol within a circle with radius of approximately min-max meters. note that because of the way waypoints are completed they may more more or less than this distance. blck_maximumPatrolRadius = 35; @@ -59,11 +77,12 @@ Changed: **** VERY IMPORTANT ****** The definitions of private variables used in missions in now read in through an include statement (see Missions\Blue\default.sqf for an example) Please update any custom mission you have generated accordingly. This should save quite a bit of editing going forward. - Please not that if you do not update the private variables definitions list certain features of the mission spawner may not work due to issues with scope of variables. + Please note that if you do not update the private variables definitions list certain features of the mission spawner may not work due to issues with scope of variables. Changed: Logic for spawning paratroops was redone so it is more clear. - when helis are spawned the paratroops will spawn at the heli location when it spawns based on probability set in _chancePara in the mission file or the default for that mission difficulty. + When helis are spawned the paratroops will spawn at the heli location when it spawns based on probability set in _chancePara in the mission file or the default for that mission difficulty. When no helies are to be spawned, paratroops will spawn at the mission center when it spawns based on probability set in _chancePara in the mission file or the default for that mission difficulty. + Changed: Each mission is now compiled at server startup. A few variables that were not used were eliminated. Some declarations of private variables were consolidated. @@ -72,11 +91,10 @@ Changed: Each mission is now compiled at server startup. Changed: Code for Heli Patrols redone. Code that spawns paratroops moved to a separate function that is called when a player is whithin a certain radius of the mission. Code that spawns a supplemental loot chest added - this will be spawned along with the paratroop reinforcements, if desired. - This crate can have customized loot (think ammo, building supplies, tools and food, ala Exile airdrops). + This crate can have customized loot (think ammo, building supplies, tools and food, ala Exile/Epoch airdrops). Changed: Methods for detecting NULL Groups (rarely a problem with arma these days) simplified. - GMS_fnc_missionSpawner redone using a single test for the _abort flag to save repeated calls for debugging and endMission. - This could be done with try/catch as well. + Still more work to be done here. Changed: Methods for defining mission crate loot were relaxed. You can define each item either with the old method ["Item Name", minimun number, maximum number] or just "Item name". @@ -84,7 +102,11 @@ Changed: Methods for defining mission crate loot were relaxed. Fixed: disabled some logging that is not required except when debugging. Fixed: AI Counts were not being shown at dynamic UMS. Fixed: AI were glitching through walls. -Fixed: Emplaced weapons are spawned at correct locations when their positions are defined in an array in the mission file. +Fixed: Emplaced weapons are now spawned at correct locations when their positions are defined in an array in the mission file. +Fixed: an issue with the experimental build whereby the number of dynamically tracked missions was not correctly spawned. +Fixed: Dead Ai in vehicles were sometimes detected as alive. Dead AI are now ejected. +Fixed: Vehicles are now properly released to players when all AI inside are killed when an HC is connected. + Version 1.80 Build 118 Added: you can now determine whether objects spawned at dynamic missions have simulation or damage enabled.