diff --git a/@ExileServer/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf b/@ExileServer/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf index 13ad30f..5a386fa 100644 --- a/@ExileServer/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf +++ b/@ExileServer/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf @@ -3,7 +3,7 @@ for DBD Clan By Ghostrider-DBD- Copyright 2016 - Last modified 4/11/17 + Last modified 8/13/17 -------------------------- License @@ -245,12 +245,15 @@ if (blck_debugLevel > 0) then }; #endif +uiSleep 3; _temp = [[],[],false]; _abort = false; -private["_patrolVehicles"]; -if (blck_useVehiclePatrols && (_noVehiclePatrols > 0)) then +private["_patrolVehicles","_vehToSpawn"]; +_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange; +diag_log format["_missionSpawner:: _vehToSpawn = %1",_vehToSpawn]; +if (blck_useVehiclePatrols && (_vehToSpawn > 0)) then { - _temp = [_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols; + _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols; //[_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols; #ifdef blck_debugMode if (blck_debugLevel > 1) then { @@ -296,10 +299,14 @@ _abort = false; if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (234) preparing to spawn emplaced weapons for _coords %4 | _markerClass %3 | blck_useStatic = %1 | _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass,_coords];}; #endif -if (blck_useStatic && (_noEmplacedWeapons > 0)) then +uiSleep 3; +private["_noEmplacedToSpawn"]; +_noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange; +diag_log format["_missionSpawner:: _noEmplacedToSpawn = %1",_vehToSpawn]; +if (blck_useStatic && (_noEmplacedToSpawn > 0)) then { // params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"]; - _temp = [_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray; + _temp = [_missionEmplacedWeapons,_noEmplacedToSpawn,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray; #ifdef blck_debugMode if (blck_debugLevel > 2) then @@ -346,10 +353,11 @@ if (_abort) exitWith [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true,_patrolVehicles] call blck_fnc_endMission; }; +uiSleep 3; if (_allowReinforcements) then { _weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout; - temp = []; + _temp = []; #ifdef blck_debugMode if (blck_debugLevel > 1) then @@ -357,34 +365,60 @@ if (_allowReinforcements) then diag_log format["[blckeagls] missionSpawner:: (268) calling in reinforcements: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; }; #endif - - //params["_coords","_aiSkillsLevel","_weapons","_uniforms","_headgear"]; - _temp = [_coords,_aiDifficultyLevel,_weaponList,_uniforms,_headGear] call blck_fnc_spawnMissionReinforcements; - - #ifdef blck_debugMode - if (blck_debugLevel > 2) then + private _noChoppers = 0; + private _chancePara = 0.5; + switch (toLower _aiDifficultyLevel) do { - diag_log format["missionSpawner:: _temp = %1",_temp]; + case "blue":{ + _noChoppers = [blck_noPatrolHelisBlue] call blck_fnc_getNumberFromRange; + _chancePara = [blck_chanceParaBlue] call blck_fnc_getNumberFromRange; + }; + case "red":{ + _noChoppers = [blck_noPatrolHelisRed] call blck_fnc_getNumberFromRange; + _chancePara = [blck_chanceParaRed] call blck_fnc_getNumberFromRange; + }; + case "green":{ + _noChoppers = [blck_noPatrolHelisGreen] call blck_fnc_getNumberFromRange; + _chancePara = [blck_chanceParaGreen] call blck_fnc_getNumberFromRange; + }; + case "orange":{ + _noChoppers = [blck_noPatrolHelisOrange] call blck_fnc_getNumberFromRange; + _chancePara = [blck_chanceParaOrange] call blck_fnc_getNumberFromRange; + }; }; - #endif - - if (typeName _temp isEqualTo "ARRAY") then - { - _abort = _temp select 2; - _objects pushback (_temp select 0); - _blck_AllMissionAI append (_temp select 1); - }; - if (_abort) then + diag_log format["_missionSpawner:: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara]; + for "_i" from 1 to (_noChoppers) do { + //params["_coords","_aiSkillsLevel","_weapons","_uniforms","_headgear"]; + + _temp = [_coords,_aiDifficultyLevel,_weaponList,_uniforms,_headGear,_chancePara] call blck_fnc_spawnMissionReinforcements; - #ifdef blck_debugMode - if (blck_debugLevel > 2) then + #ifdef blck_debugMode + if (blck_debugLevel >= 2) then { - diag_log "missionSpawner:: (276) grpNul or ERROR in blck_fnc_spawnMissionReinforcements, mission termination criteria met, calling blck_endMission"; + diag_log format["missionSpawner:: blck_fnc_spawnMissionReinforcements call for chopper # %1 out of a total of %2 choppers",_i, _noChoppers]; + diag_log format["missionSpawner:: _temp = %1",_temp]; }; #endif - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true,_patrolVehicles] call blck_fnc_endMission; + if (typeName _temp isEqualTo "ARRAY") then + { + _abort = _temp select 2; + _objects pushback (_temp select 0); + _blck_AllMissionAI append (_temp select 1); + }; + if (_abort) then + { + + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log "missionSpawner:: (276) grpNul or ERROR in blck_fnc_spawnMissionReinforcements, mission termination criteria met, calling blck_endMission"; + }; + #endif + + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true,_patrolVehicles] call blck_fnc_endMission; + }; }; }; // Trigger for mission end @@ -410,7 +444,7 @@ _locations = [_coords]; //diag_log format["missionSpawner:: Waiting for player to satisfy mission end criteria of _endIfPlayerNear %1 with _endIfAIKilled %2",_endIfPlayerNear,_endIfAIKilled]; while {_missionComplete isEqualTo -1} do { - //if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 300}; + //if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 180}; if ((_endIfPlayerNear) && [_locations,10,true] call blck_fnc_playerInRangeArray) exitWith {}; if ((_endIfAIKilled) && ({alive _x} count _blck_AllMissionAI) < 1 /*[_blck_AllMissionAI] call blck_fnc_missionAIareDead*/ ) exitWith {}; //diag_log format["missionSpawner:: (283) missionCompleteLoop - > players near = %1 and ai alive = %2",[_coords,20] call blck_fnc_playerInRange, {alive _x} count _blck_AllMissionAI]; diff --git a/@ExileServer/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf b/@ExileServer/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf index 5a386fa..32757e1 100644 --- a/@ExileServer/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@ExileServer/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -67,7 +67,8 @@ if !(blck_preciseMapMarkers) then }; _blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name? if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (91) message players and spawn a mission marker";}; -[["start",_startMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; +[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers; +//[["start",_startMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; [_blck_localMissionMarker] execVM "debug\spawnMarker.sqf"; #ifdef blck_debugMode @@ -461,6 +462,8 @@ if (blck_debugLevel > 0) then //diag_log format["[blckeagls] missionSpawner:: (418) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; private["_result"]; +// Force passing the mission name for informational purposes. +_blck_localMissionMarker set [2, _markerMissionName]; _result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,false,_patrolVehicles] call blck_fnc_endMission; //diag_log format["[blckeagls] missionSpawner:: (420)end of mission: blck_fnc_endMission returned value of %1","pending"]; diff --git a/@ExileServer/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf b/@ExileServer/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf index 4e342fc..85b1508 100644 --- a/@ExileServer/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf +++ b/@ExileServer/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf @@ -86,6 +86,7 @@ if (blck_debugLevel > 1) then // params["_vehType","_pos",["_clearInventory",true]]; _wep = [(_x select 0),[0,0,0],false] call blck_fnc_spawnVehicle; + _wep addEventHandler["HandleDamage",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}]; _empGroup setVariable["groupVehicle",_wep]; _wep setVariable["vehicleGroup",_empGroup]; #ifdef blck_debugMode diff --git a/@ExileServer/addons/custom_server/Compiles/Vehicles/GMS_EH_AIKilled.sqf b/@ExileServer/addons/custom_server/Compiles/Vehicles/GMS_EH_AIKilled.sqf new file mode 100644 index 0000000..d7e8151 --- /dev/null +++ b/@ExileServer/addons/custom_server/Compiles/Vehicles/GMS_EH_AIKilled.sqf @@ -0,0 +1,19 @@ + +/* + Killed handler for _units + By Ghostrider-DbD + Last Modified 4-11-17 + + -------------------------- + 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"; + +params["_unit","_killer"]; + +//diag_log format["EH_AIKilled:: _units = %1 and _killer = %2",_unit,_killer]; +[_unit,_killer] remoteExec ["blck_fnc_processAIKill",2]; diff --git a/@ExileServer/addons/custom_server/Compiles/Vehicles/GMS_EH_AIVehicle_HandleDamage.sqf b/@ExileServer/addons/custom_server/Compiles/Vehicles/GMS_EH_AIVehicle_HandleDamage.sqf new file mode 100644 index 0000000..7028bac --- /dev/null +++ b/@ExileServer/addons/custom_server/Compiles/Vehicles/GMS_EH_AIVehicle_HandleDamage.sqf @@ -0,0 +1,39 @@ +/* + By Ghostrider-DbD- + Last Modified 7-27-17 + + Handles the case where a vehicle is hit. + + -------------------------- + 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 ["_unit","_instigator","_group","_wp"]; +diag_log format["_EH_AIVehicle_HandleDamage::-->> _this = %1",_this]; +_unit = _this select 0 select 0; +_instigator = _this select 0 select 3; + +#ifdef blck_debugMode +if (blck_debugLevel > 1) then +{ + diag_log format["_EH_AIVehicle_HandleDamage:: _units = %1 and _instigator = %2 units damage is %3",_unit,_instigator, damage _unit]; +}; +#endif + +if (!(alive _unit)) exitWith {}; +if (!(isPlayer _instigator)) exitWith {}; +[_unit,_instigator] call blck_fnc_alertGroupUnits; +[_instigator] call blck_fnc_alertNearbyVehicles; +_group = group _unit; +//_group setBehavior "COMBAT"; +_wp = [_group, currentWaypoint _group]; +_wp setWaypointBehaviour "COMBAT"; +_group setCombatMode "RED"; +_wp setWaypointCombatMode "RED"; + + diff --git a/@ExileServer/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf b/@ExileServer/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf index 4ae0985..e37010a 100644 --- a/@ExileServer/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf +++ b/@ExileServer/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf @@ -25,16 +25,17 @@ params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_ //_maxDis = maximum distance from the center of the mission for vehicle waypoints //_groupForVehiclePatrol = The group with which to man the vehicle -//#ifdef blck_debugMode +#ifdef blck_debugMode if (blck_debugLevel > 1) then { diag_log format["_fnc_spawnVehiclePatrol:: _center = %1 | _pos = %2 | _vehType = %3 | _group = %4",_center,_pos,_vehType,_group]; }; -//#endif +#endif if !(isNull _group) then { // exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnVehiclePatrol"; objNull;}; _veh = [_vehType,_pos] call blck_fnc_spawnVehicle; + _veh addEventHandler["HandleDamage",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}]; _group setVariable["groupVehicle",_veh]; //#ifdef blck_debugMode if (blck_debugLevel > 1) then @@ -61,55 +62,12 @@ if !(isNull _group) then _group setBehaviour "COMBAT"; [_center,_minDis,_maxDis,_group,"perimeter","SAD","vehicle"] spawn blck_fnc_setupWaypoints; }; -//#ifdef blck_debugMode +#ifdef blck_debugMode if (blck_debugLevel > 1) then { diag_log format["_fnc_spawnVehiclePatrol::->> _veh = %1",_veh]; }; -//#endif +#endif _veh - /* - while {(count (waypoints _group)) > 0} do - { - deleteWaypoint ((waypoints _group) select 0); - }; - - _count = 5; - _start = _center getDir _pos; - _angle = _start; - _sign = selectRandom [1, -1]; - _arc = _sign * 360/_count; - for "_i" from 1 to _count do - { - _angle = _angle + _arc; - _p2 = _center getPos [(_minDis + random(_maxDis - _minDis)),_angle]; - - - if (_i isEqualTo 1) then - { - _wp = [_group, 0]; - _wp setWaypointPosition [_p2, 25]; - } else { - _wp = _group addWaypoint [_p2, 25]; - }; - _wp setWaypointType "MOVE"; - _wp setWaypointName "move"; - _wp setWaypointBehaviour "AWARE"; - _wp setWaypointCombatMode blck_combatMode; - _wp setWaypointTimeout [1,1.1,1.2]; - _wp = _group addWaypoint [_p2, 25]; - _wp setWaypointType "SAD"; - _wp setWaypointName "sentry"; - _wp setWaypointBehaviour "AWARE"; - _wp setWaypointCombatMode blck_combatMode; - _wp setWaypointTimeout [10,17.5,25]; - }; - _wp = _group addWaypoint [_pos, 25]; - _wp setWaypointType "CYCLE"; - _group setVariable["wpIndex",0]; - -}; -*/ - diff --git a/@ExileServer/addons/custom_server/Compiles/blck_functions.sqf b/@ExileServer/addons/custom_server/Compiles/blck_functions.sqf index 7a5c6c8..ebbdbc3 100644 --- a/@ExileServer/addons/custom_server/Compiles/blck_functions.sqf +++ b/@ExileServer/addons/custom_server/Compiles/blck_functions.sqf @@ -89,12 +89,13 @@ blck_fnc_spawnMissionHeli = compileFinal preprocessFileLineNumbers "\q\addons\cu blck_fnc_spawnMissionParatroops = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnMissionParatroops.sqf"; // Lumped here because these 'jump' from aircraft blck_fnc_spawnParaUnits = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnParaUnits.sqf"; // Lumped here because these 'jump' from aircraft blck_fnc_releaseVehicleToPlayers = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_releaseVehicleToPlayers.sqf"; // GMS_fnc_releaseVehicleToPlayers - +blck_EH_AIVehicle_HandleDamage = "\q\addons\custom_server\Compiles\Vehicles\GMS_EH_AIVehicle_HandleDamage.sqf"; + // functions to support Units blck_fnc_removeGear = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_removeGear.sqf"; // Strip an AI unit of all gear. blck_fnc_spawnAI = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_spawnUnit.sqf"; // spawn individual AI blck_EH_AIKilled = "\q\addons\custom_server\Compiles\Units\GMS_EH_AIKilled.sqf"; // Event handler to process AI deaths -blck_EH_AHHit = "\q\addons\custom_server\Compiles\Units\GMS_EH_AIHit.sqf"; +blck_EH_AIHit = "\q\addons\custom_server\Compiles\Units\GMS_EH_AIHit.sqf"; blck_EH_AIFiredNear = "\q\addons\custom_server\Compiles\Units\GMS_EH_AIFiredNear.sqf"; blck_EH_unitWeaponReloaded = "\q\addons\custom_server\Compiles\Units\GMS_EH_unitWeaponReloaded.sqf"; blck_fnc_processAIKill = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_processAIKill.sqf"; diff --git a/@ExileServer/addons/custom_server/SLS/SLS_functions.sqf b/@ExileServer/addons/custom_server/SLS/SLS_functions.sqf index 439168f..66f747f 100644 --- a/@ExileServer/addons/custom_server/SLS/SLS_functions.sqf +++ b/@ExileServer/addons/custom_server/SLS/SLS_functions.sqf @@ -101,7 +101,7 @@ _fn_setupCrates = { #endif _crate }; - +diag_log "[blckeagls] SLS System: Functions Initialized!"; private["_cratePosnList","_no","_ar","_x","_cratePos","_lootType","_randomPos","_useSmoke"]; { @@ -135,5 +135,4 @@ private["_cratePosnList","_no","_ar","_x","_cratePos","_lootType","_randomPos"," }; } forEach _lootBoxes; -blck_SLSComplete = true; -diag_log "[blckeagls] SLS System: Static crates loaded successfully for Epoch!"; + diff --git a/@ExileServer/addons/custom_server/SLS/SLS_init.sqf b/@ExileServer/addons/custom_server/SLS/SLS_init.sqf index 7b0c963..01ff573 100644 --- a/@ExileServer/addons/custom_server/SLS/SLS_init.sqf +++ b/@ExileServer/addons/custom_server/SLS/SLS_init.sqf @@ -10,7 +10,7 @@ http://creativecommons.org/licenses/by-nc-sa/4.0/ */ - +diag_log "[blckeagls] SLS System: Initializing Static Loot Crate System!"; #include "\q\addons\custom_server\Configs\blck_defines.hpp"; if not (isNull( configFile >> "CfgPatches" >> "a3_epoch_server" )) then @@ -22,3 +22,5 @@ if not (isNull ( configFile >> "CfgPatches" >> "exile_server" ) ) then { [] execVM "\q\addons\custom_server\SLS\SLS_init_exile.sqf"; }; +diag_log "[blckeagls] SLS System: Static loot crates ran successfully!"; +blck_SLSComplete = true; \ No newline at end of file diff --git a/@ExileServer/addons/custom_server/SLS/SLS_init_exile.sqf b/@ExileServer/addons/custom_server/SLS/SLS_init_exile.sqf index 62bb8a9..2db0f9d 100644 --- a/@ExileServer/addons/custom_server/SLS/SLS_init_exile.sqf +++ b/@ExileServer/addons/custom_server/SLS/SLS_init_exile.sqf @@ -13,7 +13,5 @@ */ #include "\q\addons\custom_server\Configs\blck_defines.hpp"; -// Assemble the final executable with Epoch crate configurations and SLS code - #include "\q\addons\custom_server\SLS\SLS_defines_exile.sqf"; #include "\q\addons\custom_server\SLS\SLS_functions.sqf"; diff --git a/@ExileServer/addons/custom_server/init/blck_init.sqf b/@ExileServer/addons/custom_server/init/blck_init.sqf index f303465..456b9f0 100644 --- a/@ExileServer/addons/custom_server/init/blck_init.sqf +++ b/@ExileServer/addons/custom_server/init/blck_init.sqf @@ -21,7 +21,7 @@ if !(isNil "blck_Initialized") exitWith{}; private["_blck_loadingStartTime"]; _blck_loadingStartTime = diag_tickTime; #include "\q\addons\custom_server\init\build.sqf"; -diag_log format["[blckeagls] Loading version %1 Build %2",_blck_versionDate,_blck_version]; +diag_log format["[blckeagls] Loading Version %2 Build Date %1",_blck_versionDate,_blck_version]; call compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\blck_variables.sqf"; waitUntil {(isNil "blck_variablesLoaded") isEqualTo false;}; @@ -86,10 +86,19 @@ if (blck_spawnStaticLootCrates) then { // Start the static loot crate spawner diag_log "[blckeagls] SLS:: -- >> Static Loot Spawner Started"; - [] execVM "\q\addons\custom_server\SLS\SLS_init.sqf"; - waitUntil {(isNil "blck_SLSComplete") isEqualTo false;}; - waitUntil{blck_SLSComplete}; - blck_SLSComplete = nil; + [] spawn compileFinal preprocessFileLineNumbers "\q\addons\custom_server\SLS\SLS_init.sqf"; + _wait = true; + while {_wait} do + { + if !(isNil "blck_SLSComplete") then { + if (blck_SLSComplete) then { + blck_SLSComplete = nil; + _wait = false; + }; + }; + diag_log format["Waiting for SLS to be completed at %1",diag_tickTime]; + uiSleep 1; + }; diag_log "[blckeagls] SLS:: -- >> Static Loot Spawner Done"; }else{ diag_log "[blckeagls] SLS:: -- >> Static Loot Spawner disabled"; diff --git a/@ExileServer/addons/custom_server/init/build.sqf b/@ExileServer/addons/custom_server/init/build.sqf index 4286c80..bfd7f13 100644 --- a/@ExileServer/addons/custom_server/init/build.sqf +++ b/@ExileServer/addons/custom_server/init/build.sqf @@ -1,3 +1,3 @@ private ["_version","_versionDate"]; -_blck_version = "6.70 Build 74"; -_blck_versionDate = "8-17-17 8:00 PM"; +_blck_version = "6.71 Build 77"; +_blck_versionDate = "9-24-17 4:00 PM"; diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf new file mode 100644 index 0000000..5a386fa --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf @@ -0,0 +1,467 @@ +/* + Generic Mission Spawner + for DBD Clan + By Ghostrider-DBD- + Copyright 2016 + Last modified 8/13/17 + + -------------------------- + 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 ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut","_aiDifficultyLevel"]; +params["_coords","_mission",["_allowReinforcements",true]]; +diag_log format["_missionSpawner (18):: _allowReinforcements = %1",_allowReinforcements]; + +//////// +// set all variables needed for the missions +// data is pulled either from the mission description or from the _mission variable passsed as a parameter +// Deal with situations where some of these variables might not be defined as well. +//////// + +// _mission params[_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange]; +_markerClass = _mission select 2; +_aiDifficultyLevel = _mission select 3; + +if (blck_debugLevel > 0) then {diag_log format["_fnc_mainThread:: -->> _markerClass = %1",_markerClass];}; + +[_mission,"active",_coords] call blck_fnc_updateMissionQue; +blck_ActiveMissionCoords pushback _coords; +diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + +private["_chanceHeliPatrol","_noPara","_reinforcementLootCounts","_chanceLoot","_heliCrew","_loadCratesTiming"]; + +if (isNil "_markerColor") then {_markerColor = "ColorBlack"}; +if (isNil "_markerType") then {_markerType = ["mil_box",[]]}; +//if (isNil "_timeOut") then {_timeOut = -1;}; +if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn"; + +private["_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius"]; +if (isNil "_useMines") then {_useMines = blck_useMines;}; + +_objects = []; +_mines = []; +_crates = []; +_aiGroup = []; +_missionAIVehicles = []; +_blck_AllMissionAI = []; +_AI_Vehicles = []; +_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType]; +_delayTime = 1; +_groupPatrolRadius = 50; + +if (blck_labelMapMarkers select 0) then +{ + //diag_log "labeling map markers *****"; + _blck_localMissionMarker set [2, _markerMissionName]; +}; +if !(blck_preciseMapMarkers) then +{ + //diag_log "Map marker will be OFFSET from the mission position"; + _blck_localMissionMarker set [1,[_coords,75] call blck_fnc_randomPosition]; +}; +_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name? +if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (91) message players and spawn a mission marker";}; +[["start",_startMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; +[_blck_localMissionMarker] execVM "debug\spawnMarker.sqf"; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (94) waiting for player to trigger the mission";}; +#endif +//////// +// All parameters are defined, lets wait until a player is nearby or the mission has timed out +//////// + +private["_wait","_missionStartTime","_playerInRange","_missionTimedOut"]; +_missionStartTime = diag_tickTime; +_playerInRange = false; +_missionTimedOut = false; +_wait = true; +if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (105) starting mission trigger loop"}; + +while {_wait} do +{ + #ifdef blck_debugMode + //diag_log "missionSpawner:: top of mission trigger loop"; + if (blck_debugLevel > 2) exitWith {_playerInRange = true;}; + #endif + + if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;}; + if ([_missionStartTime] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;}; + uiSleep 5; + + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log format["missionSpawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords]; + diag_log format["missionSpawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers]; + diag_log format["missionSpawner:: Trigger Loop - timeout = %1", [_missionStartTime] call blck_fnc_timedOut]; + }; + #endif +}; + +if (_missionTimedOut) exitWith +{ +/* + +*/ + // Deal with the case in which the mission timed out. + //["timeOut",_endMsg,_blck_localMissionMarker select 2] call blck_fnc_messageplayers; + blck_recentMissionCoords pushback [_coords,diag_tickTime]; + blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; + [_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue; + blck_missionsRunning = blck_missionsRunning - 1; + [_blck_localMissionMarker select 0] call compile preprocessfilelinenumbers "debug\deleteMarker.sqf"; + //_blck_localMissionMarker set [1,[0,0,0]]; + //_blck_localMissionMarker set [2,""]; + [_objects, 0.1] spawn blck_fnc_cleanupObjects; + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then + { + diag_log format["[blckeagls] missionSpawner:: (105) Mission Timed Out: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + #endif +}; + +//////// +// Spawn the mission objects, loot chest, and AI +//////// +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (112) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif + +if (count _missionLootBoxes > 0) then +{ + _crates = [_coords,_missionLootBoxes,_loadCratesTiming] call blck_fnc_spawnMissionCrates; +} +else +{ + _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming] call blck_fnc_spawnMissionCrates; + +}; + +if (blck_cleanUpLootChests) then +{ + _objects append _crates; +}; + +//uisleep 2; +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (136) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif + +private ["_temp"]; +if (blck_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate +{ + _temp = [_coords,blck_SmokeAtMissions select 1] call blck_fnc_smokeAtCrates; + if (typeName _temp isEqualTo "ARRAY") then + { + _objects append _temp; + }; +}; + +uiSleep _delayTime; +if (_useMines) then +{ + _mines = [_coords] call blck_fnc_spawnMines; + //uiSleep _delayTime;; +}; +uiSleep _delayTime; +_temp = []; +if (_missionLandscapeMode isEqualTo "random") then +{ + _temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape; +} else { + _temp = [_coords, floor(random(360)),_missionLandscape,true] call blck_fnc_spawnCompositionObjects; + //uiSleep 1; +}; +if (typeName _temp isEqualTo "ARRAY") then +{ + _objects append _temp; +}; +//diag_log format["_fnc_missionSpawner:: (181)->> _objects = %1",_objects]; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (170) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif + +uiSleep _delayTime;; + +_temp = [_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles; +//uisleep 1; +_crates append _temp; + +uiSleep _delayTime; + +_abort = false; +_temp = [[],[],false]; +_temp = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI; +//[_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI; + +#ifdef blck_debugMode +if (blck_debugLevel > 2) then { + diag_log format["missionSpawner :: (185) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1; +}; + +_abort = _temp select 1; +if (blck_debugLevel > 2) then { + diag_log format["missionSpawner :: (190) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1; +}; +#endif + +if (_abort) exitWith +{ + if (blck_debugLevel > 1) then { + diag_log "missionSpawner:: (194) grpNull returned, mission termination criteria met, calling blck_fnc_endMission" + }; + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission; +}; +if !(_abort) then +{ + _blck_AllMissionAI append (_temp select 0); +}; + +uiSleep _delayTime; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (202) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif + +uiSleep 3; +_temp = [[],[],false]; +_abort = false; +private["_patrolVehicles","_vehToSpawn"]; +_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange; +diag_log format["_missionSpawner:: _vehToSpawn = %1",_vehToSpawn]; +if (blck_useVehiclePatrols && (_vehToSpawn > 0)) then +{ + _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols; + //[_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols; + #ifdef blck_debugMode + if (blck_debugLevel > 1) then { + diag_log format["missionSpawner :: (216) blck_fnc_spawnMissionVehiclePatrols returned _temp = %1",_temp]; + }; + #endif + + if (typeName _temp isEqualTo "ARRAY") then + { + _abort = _temp select 2; + }; + if !(_abort) then + { + _patrolVehicles = _temp select 0; + _blck_AllMissionAI append (_temp select 1); + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then + { + diag_log format["[blckeagls] missionSpawner:: (272) Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + #endif + + }; +}; + +if (_abort) exitWith +{ + #ifdef blck_debugMode + if (blck_debugLevel > 0) then { + diag_log "missionSpawner:: (222) grpNull returned, mission termination criteria met, calling blck_endMission"; + }; + #endif + + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission; +}; + +uiSleep _delayTime; +_temp = [[],[],false]; +_abort = false; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (234) preparing to spawn emplaced weapons for _coords %4 | _markerClass %3 | blck_useStatic = %1 | _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass,_coords];}; +#endif + +uiSleep 3; +private["_noEmplacedToSpawn"]; +_noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange; +diag_log format["_missionSpawner:: _noEmplacedToSpawn = %1",_vehToSpawn]; +if (blck_useStatic && (_noEmplacedToSpawn > 0)) then +{ + // params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"]; + _temp = [_missionEmplacedWeapons,_noEmplacedToSpawn,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray; + + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log format ["missionSpawner:: (232) blck_fnc_spawnEmplacedWeaponArray returned _temp = %1",_temp]; + }; + #endif + + if (typeName _temp isEqualTo "ARRAY") then + { + _abort = _temp select 2; + }; + + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log format ["missionSpawner:: (241) _abort = %1",_abort]; + + }; + #endif + + if !(_abort) then + { + _objects append (_temp select 0); + _blck_AllMissionAI append (_temp select 1); + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then + { + diag_log format["[blckeagls] missionSpawner:: (253) Static Weapons Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + #endif + }; +}; +if (_abort) exitWith +{ + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log "missionSpawner:: (261) grpNull ERROR in blck_fnc_spawnEmplacedWeaponArray, mission termination criteria met, calling blck_endMission"; + }; + #endif + + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true,_patrolVehicles] call blck_fnc_endMission; +}; + +uiSleep 3; +if (_allowReinforcements) then +{ + _weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout; + _temp = []; + + #ifdef blck_debugMode + if (blck_debugLevel > 1) then + { + diag_log format["[blckeagls] missionSpawner:: (268) calling in reinforcements: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + #endif + private _noChoppers = 0; + private _chancePara = 0.5; + switch (toLower _aiDifficultyLevel) do + { + case "blue":{ + _noChoppers = [blck_noPatrolHelisBlue] call blck_fnc_getNumberFromRange; + _chancePara = [blck_chanceParaBlue] call blck_fnc_getNumberFromRange; + }; + case "red":{ + _noChoppers = [blck_noPatrolHelisRed] call blck_fnc_getNumberFromRange; + _chancePara = [blck_chanceParaRed] call blck_fnc_getNumberFromRange; + }; + case "green":{ + _noChoppers = [blck_noPatrolHelisGreen] call blck_fnc_getNumberFromRange; + _chancePara = [blck_chanceParaGreen] call blck_fnc_getNumberFromRange; + }; + case "orange":{ + _noChoppers = [blck_noPatrolHelisOrange] call blck_fnc_getNumberFromRange; + _chancePara = [blck_chanceParaOrange] call blck_fnc_getNumberFromRange; + }; + }; + diag_log format["_missionSpawner:: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara]; + for "_i" from 1 to (_noChoppers) do + { + //params["_coords","_aiSkillsLevel","_weapons","_uniforms","_headgear"]; + + _temp = [_coords,_aiDifficultyLevel,_weaponList,_uniforms,_headGear,_chancePara] call blck_fnc_spawnMissionReinforcements; + + #ifdef blck_debugMode + if (blck_debugLevel >= 2) then + { + diag_log format["missionSpawner:: blck_fnc_spawnMissionReinforcements call for chopper # %1 out of a total of %2 choppers",_i, _noChoppers]; + diag_log format["missionSpawner:: _temp = %1",_temp]; + }; + #endif + + if (typeName _temp isEqualTo "ARRAY") then + { + _abort = _temp select 2; + _objects pushback (_temp select 0); + _blck_AllMissionAI append (_temp select 1); + }; + if (_abort) then + { + + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log "missionSpawner:: (276) grpNul or ERROR in blck_fnc_spawnMissionReinforcements, mission termination criteria met, calling blck_endMission"; + }; + #endif + + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true,_patrolVehicles] call blck_fnc_endMission; + }; + }; +}; +// Trigger for mission end +//diag_log format["[blckeagls] mission Spawner _endCondition = %1",_endCondition]; +private["_missionComplete","_endIfPlayerNear","_endIfAIKilled"]; +_missionComplete = -1; +_startTime = diag_tickTime; + +switch (_endCondition) do +{ + case "playerNear": {_endIfPlayerNear = true;_endIfAIKilled = false;}; + case "allUnitsKilled": {_endIfPlayerNear = false;_endIfAIKilled = true;}; + case "allKilledOrPlayerNear": {_endIfPlayerNear = true;_endIfAIKilled = true;}; +}; +//diag_log format["missionSpawner :: (269) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; +private["_locations"]; +_locations = [_coords]; +{ + _locations pushback (getPos _x); +} forEach _crates; + +//diag_log format["missionSpawner:: _coords = %1 | _crates = %2 | _locations = %3",_coords,_crates,_locations]; +//diag_log format["missionSpawner:: Waiting for player to satisfy mission end criteria of _endIfPlayerNear %1 with _endIfAIKilled %2",_endIfPlayerNear,_endIfAIKilled]; +while {_missionComplete isEqualTo -1} do +{ + //if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 180}; + if ((_endIfPlayerNear) && [_locations,10,true] call blck_fnc_playerInRangeArray) exitWith {}; + if ((_endIfAIKilled) && ({alive _x} count _blck_AllMissionAI) < 1 /*[_blck_AllMissionAI] call blck_fnc_missionAIareDead*/ ) exitWith {}; + //diag_log format["missionSpawner:: (283) missionCompleteLoop - > players near = %1 and ai alive = %2",[_coords,20] call blck_fnc_playerInRange, {alive _x} count _blck_AllMissionAI]; + uiSleep 4; +}; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (414) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + diag_log format["missionSpawner :: (415) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; +}; +#endif +//diag_log format["[blckeagls] missionSpawner:: (418) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + +private["_result"]; +_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,false,_patrolVehicles] call blck_fnc_endMission; + +//diag_log format["[blckeagls] missionSpawner:: (420)end of mission: blck_fnc_endMission returned value of %1","pending"]; + diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf index 5a386fa..32757e1 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -67,7 +67,8 @@ if !(blck_preciseMapMarkers) then }; _blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name? if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (91) message players and spawn a mission marker";}; -[["start",_startMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; +[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers; +//[["start",_startMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; [_blck_localMissionMarker] execVM "debug\spawnMarker.sqf"; #ifdef blck_debugMode @@ -461,6 +462,8 @@ if (blck_debugLevel > 0) then //diag_log format["[blckeagls] missionSpawner:: (418) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; private["_result"]; +// Force passing the mission name for informational purposes. +_blck_localMissionMarker set [2, _markerMissionName]; _result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,false,_patrolVehicles] call blck_fnc_endMission; //diag_log format["[blckeagls] missionSpawner:: (420)end of mission: blck_fnc_endMission returned value of %1","pending"]; diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf index 4e342fc..85b1508 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf @@ -86,6 +86,7 @@ if (blck_debugLevel > 1) then // params["_vehType","_pos",["_clearInventory",true]]; _wep = [(_x select 0),[0,0,0],false] call blck_fnc_spawnVehicle; + _wep addEventHandler["HandleDamage",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}]; _empGroup setVariable["groupVehicle",_wep]; _wep setVariable["vehicleGroup",_empGroup]; #ifdef blck_debugMode diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_EH_AIKilled.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_EH_AIKilled.sqf new file mode 100644 index 0000000..d7e8151 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_EH_AIKilled.sqf @@ -0,0 +1,19 @@ + +/* + Killed handler for _units + By Ghostrider-DbD + Last Modified 4-11-17 + + -------------------------- + 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"; + +params["_unit","_killer"]; + +//diag_log format["EH_AIKilled:: _units = %1 and _killer = %2",_unit,_killer]; +[_unit,_killer] remoteExec ["blck_fnc_processAIKill",2]; diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_EH_AIVehicle_HandleDamage.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_EH_AIVehicle_HandleDamage.sqf new file mode 100644 index 0000000..7028bac --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_EH_AIVehicle_HandleDamage.sqf @@ -0,0 +1,39 @@ +/* + By Ghostrider-DbD- + Last Modified 7-27-17 + + Handles the case where a vehicle is hit. + + -------------------------- + 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 ["_unit","_instigator","_group","_wp"]; +diag_log format["_EH_AIVehicle_HandleDamage::-->> _this = %1",_this]; +_unit = _this select 0 select 0; +_instigator = _this select 0 select 3; + +#ifdef blck_debugMode +if (blck_debugLevel > 1) then +{ + diag_log format["_EH_AIVehicle_HandleDamage:: _units = %1 and _instigator = %2 units damage is %3",_unit,_instigator, damage _unit]; +}; +#endif + +if (!(alive _unit)) exitWith {}; +if (!(isPlayer _instigator)) exitWith {}; +[_unit,_instigator] call blck_fnc_alertGroupUnits; +[_instigator] call blck_fnc_alertNearbyVehicles; +_group = group _unit; +//_group setBehavior "COMBAT"; +_wp = [_group, currentWaypoint _group]; +_wp setWaypointBehaviour "COMBAT"; +_group setCombatMode "RED"; +_wp setWaypointCombatMode "RED"; + + diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf index 4ae0985..e37010a 100644 --- a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf @@ -25,16 +25,17 @@ params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_ //_maxDis = maximum distance from the center of the mission for vehicle waypoints //_groupForVehiclePatrol = The group with which to man the vehicle -//#ifdef blck_debugMode +#ifdef blck_debugMode if (blck_debugLevel > 1) then { diag_log format["_fnc_spawnVehiclePatrol:: _center = %1 | _pos = %2 | _vehType = %3 | _group = %4",_center,_pos,_vehType,_group]; }; -//#endif +#endif if !(isNull _group) then { // exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnVehiclePatrol"; objNull;}; _veh = [_vehType,_pos] call blck_fnc_spawnVehicle; + _veh addEventHandler["HandleDamage",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}]; _group setVariable["groupVehicle",_veh]; //#ifdef blck_debugMode if (blck_debugLevel > 1) then @@ -61,55 +62,12 @@ if !(isNull _group) then _group setBehaviour "COMBAT"; [_center,_minDis,_maxDis,_group,"perimeter","SAD","vehicle"] spawn blck_fnc_setupWaypoints; }; -//#ifdef blck_debugMode +#ifdef blck_debugMode if (blck_debugLevel > 1) then { diag_log format["_fnc_spawnVehiclePatrol::->> _veh = %1",_veh]; }; -//#endif +#endif _veh - /* - while {(count (waypoints _group)) > 0} do - { - deleteWaypoint ((waypoints _group) select 0); - }; - - _count = 5; - _start = _center getDir _pos; - _angle = _start; - _sign = selectRandom [1, -1]; - _arc = _sign * 360/_count; - for "_i" from 1 to _count do - { - _angle = _angle + _arc; - _p2 = _center getPos [(_minDis + random(_maxDis - _minDis)),_angle]; - - - if (_i isEqualTo 1) then - { - _wp = [_group, 0]; - _wp setWaypointPosition [_p2, 25]; - } else { - _wp = _group addWaypoint [_p2, 25]; - }; - _wp setWaypointType "MOVE"; - _wp setWaypointName "move"; - _wp setWaypointBehaviour "AWARE"; - _wp setWaypointCombatMode blck_combatMode; - _wp setWaypointTimeout [1,1.1,1.2]; - _wp = _group addWaypoint [_p2, 25]; - _wp setWaypointType "SAD"; - _wp setWaypointName "sentry"; - _wp setWaypointBehaviour "AWARE"; - _wp setWaypointCombatMode blck_combatMode; - _wp setWaypointTimeout [10,17.5,25]; - }; - _wp = _group addWaypoint [_pos, 25]; - _wp setWaypointType "CYCLE"; - _group setVariable["wpIndex",0]; - -}; -*/ - diff --git a/@epochhive/addons/custom_server/Compiles/blck_functions.sqf b/@epochhive/addons/custom_server/Compiles/blck_functions.sqf index 7a5c6c8..ebbdbc3 100644 --- a/@epochhive/addons/custom_server/Compiles/blck_functions.sqf +++ b/@epochhive/addons/custom_server/Compiles/blck_functions.sqf @@ -89,12 +89,13 @@ blck_fnc_spawnMissionHeli = compileFinal preprocessFileLineNumbers "\q\addons\cu blck_fnc_spawnMissionParatroops = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnMissionParatroops.sqf"; // Lumped here because these 'jump' from aircraft blck_fnc_spawnParaUnits = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnParaUnits.sqf"; // Lumped here because these 'jump' from aircraft blck_fnc_releaseVehicleToPlayers = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_releaseVehicleToPlayers.sqf"; // GMS_fnc_releaseVehicleToPlayers - +blck_EH_AIVehicle_HandleDamage = "\q\addons\custom_server\Compiles\Vehicles\GMS_EH_AIVehicle_HandleDamage.sqf"; + // functions to support Units blck_fnc_removeGear = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_removeGear.sqf"; // Strip an AI unit of all gear. blck_fnc_spawnAI = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_spawnUnit.sqf"; // spawn individual AI blck_EH_AIKilled = "\q\addons\custom_server\Compiles\Units\GMS_EH_AIKilled.sqf"; // Event handler to process AI deaths -blck_EH_AHHit = "\q\addons\custom_server\Compiles\Units\GMS_EH_AIHit.sqf"; +blck_EH_AIHit = "\q\addons\custom_server\Compiles\Units\GMS_EH_AIHit.sqf"; blck_EH_AIFiredNear = "\q\addons\custom_server\Compiles\Units\GMS_EH_AIFiredNear.sqf"; blck_EH_unitWeaponReloaded = "\q\addons\custom_server\Compiles\Units\GMS_EH_unitWeaponReloaded.sqf"; blck_fnc_processAIKill = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_processAIKill.sqf"; diff --git a/@epochhive/addons/custom_server/SLS/SLS_functions.sqf b/@epochhive/addons/custom_server/SLS/SLS_functions.sqf index 439168f..66f747f 100644 --- a/@epochhive/addons/custom_server/SLS/SLS_functions.sqf +++ b/@epochhive/addons/custom_server/SLS/SLS_functions.sqf @@ -101,7 +101,7 @@ _fn_setupCrates = { #endif _crate }; - +diag_log "[blckeagls] SLS System: Functions Initialized!"; private["_cratePosnList","_no","_ar","_x","_cratePos","_lootType","_randomPos","_useSmoke"]; { @@ -135,5 +135,4 @@ private["_cratePosnList","_no","_ar","_x","_cratePos","_lootType","_randomPos"," }; } forEach _lootBoxes; -blck_SLSComplete = true; -diag_log "[blckeagls] SLS System: Static crates loaded successfully for Epoch!"; + diff --git a/@epochhive/addons/custom_server/SLS/SLS_init.sqf b/@epochhive/addons/custom_server/SLS/SLS_init.sqf index 7b0c963..01ff573 100644 --- a/@epochhive/addons/custom_server/SLS/SLS_init.sqf +++ b/@epochhive/addons/custom_server/SLS/SLS_init.sqf @@ -10,7 +10,7 @@ http://creativecommons.org/licenses/by-nc-sa/4.0/ */ - +diag_log "[blckeagls] SLS System: Initializing Static Loot Crate System!"; #include "\q\addons\custom_server\Configs\blck_defines.hpp"; if not (isNull( configFile >> "CfgPatches" >> "a3_epoch_server" )) then @@ -22,3 +22,5 @@ if not (isNull ( configFile >> "CfgPatches" >> "exile_server" ) ) then { [] execVM "\q\addons\custom_server\SLS\SLS_init_exile.sqf"; }; +diag_log "[blckeagls] SLS System: Static loot crates ran successfully!"; +blck_SLSComplete = true; \ No newline at end of file diff --git a/@epochhive/addons/custom_server/SLS/SLS_init_exile.sqf b/@epochhive/addons/custom_server/SLS/SLS_init_exile.sqf index 62bb8a9..2db0f9d 100644 --- a/@epochhive/addons/custom_server/SLS/SLS_init_exile.sqf +++ b/@epochhive/addons/custom_server/SLS/SLS_init_exile.sqf @@ -13,7 +13,5 @@ */ #include "\q\addons\custom_server\Configs\blck_defines.hpp"; -// Assemble the final executable with Epoch crate configurations and SLS code - #include "\q\addons\custom_server\SLS\SLS_defines_exile.sqf"; #include "\q\addons\custom_server\SLS\SLS_functions.sqf"; diff --git a/@epochhive/addons/custom_server/init/blck_init.sqf b/@epochhive/addons/custom_server/init/blck_init.sqf index f303465..456b9f0 100644 --- a/@epochhive/addons/custom_server/init/blck_init.sqf +++ b/@epochhive/addons/custom_server/init/blck_init.sqf @@ -21,7 +21,7 @@ if !(isNil "blck_Initialized") exitWith{}; private["_blck_loadingStartTime"]; _blck_loadingStartTime = diag_tickTime; #include "\q\addons\custom_server\init\build.sqf"; -diag_log format["[blckeagls] Loading version %1 Build %2",_blck_versionDate,_blck_version]; +diag_log format["[blckeagls] Loading Version %2 Build Date %1",_blck_versionDate,_blck_version]; call compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\blck_variables.sqf"; waitUntil {(isNil "blck_variablesLoaded") isEqualTo false;}; @@ -86,10 +86,19 @@ if (blck_spawnStaticLootCrates) then { // Start the static loot crate spawner diag_log "[blckeagls] SLS:: -- >> Static Loot Spawner Started"; - [] execVM "\q\addons\custom_server\SLS\SLS_init.sqf"; - waitUntil {(isNil "blck_SLSComplete") isEqualTo false;}; - waitUntil{blck_SLSComplete}; - blck_SLSComplete = nil; + [] spawn compileFinal preprocessFileLineNumbers "\q\addons\custom_server\SLS\SLS_init.sqf"; + _wait = true; + while {_wait} do + { + if !(isNil "blck_SLSComplete") then { + if (blck_SLSComplete) then { + blck_SLSComplete = nil; + _wait = false; + }; + }; + diag_log format["Waiting for SLS to be completed at %1",diag_tickTime]; + uiSleep 1; + }; diag_log "[blckeagls] SLS:: -- >> Static Loot Spawner Done"; }else{ diag_log "[blckeagls] SLS:: -- >> Static Loot Spawner disabled"; diff --git a/@epochhive/addons/custom_server/init/build.sqf b/@epochhive/addons/custom_server/init/build.sqf index 4286c80..bfd7f13 100644 --- a/@epochhive/addons/custom_server/init/build.sqf +++ b/@epochhive/addons/custom_server/init/build.sqf @@ -1,3 +1,3 @@ private ["_version","_versionDate"]; -_blck_version = "6.70 Build 74"; -_blck_versionDate = "8-17-17 8:00 PM"; +_blck_version = "6.71 Build 77"; +_blck_versionDate = "9-24-17 4:00 PM"; diff --git a/changeLog.sqf b/changeLog.sqf index bb4d921..8a91c74 100644 --- a/changeLog.sqf +++ b/changeLog.sqf @@ -5,14 +5,13 @@ Contributions by Narines: bug fixes, testing, infinite ammo fix. Ideas or code from that by Vampire and KiloSwiss have been used for certain functions. Significant Changes: -8/16/17 Version 6.70 Build 73 -[Added] Optional Static Missions. See the How To and th eexample missions for guidance on using this. -[Fixed] Mission completion was sometimes not triggered by a player nearby. -[Reverte] There is one active, unresolved bug which is that the mission system glitches if you proved a range (e.g. [2,4] for numbers of vehicle patrols, air patrols, or emplaced weapons. -8/13/17 Version 6.61 Build 72 -Bug fixes. -Note: do not use the ranges of values for numbers of vehicle, air or statics. +Version 6.71 Build 77 +[Added] HandleDamage Event Handler for Armed Vehicles to increase their interaction with players. +[Fixed] Mission name was not displayed with start or end messages when the mission marker labels were disabled. +[Fixed] the mission system would hang in some situations due to an undefined global variable in SLS. + +8/13/17 Version 6.61 Build 71 [Added] Most parameters for numbers of loot, AI, and vehicle patrols can be defined as either a scalar value or range. Note that there is backwards compatability to prior versions so you need make no changes to your configs if you do not wish to.