diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_AIM.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_AIM.sqf index d6f94ef..1cf31ab 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_AIM.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_AIM.sqf @@ -3,7 +3,7 @@ //blck_Message = _this; params["_msg",["_players",playableUnits]]; -diag_log format["AIM.sqf ===] _this = %1 | _msg = %2 | _players = %3",_this,_msg, _players]; +if (blck_debugLevel > 1) then {diag_log format["AIM.sqf ===] _this = %1 | _msg = %2 | _players = %3",_this,_msg, _players];}; blck_Message = _msg; { //diag_log format["AIM.sqf ===] _ = %2, and (owner _x) = %1", (owner _x), _x]; diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_cleanEmptyGroups.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_cleanEmptyGroups.sqf index a378686..ed17da5 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_cleanEmptyGroups.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_cleanEmptyGroups.sqf @@ -9,10 +9,10 @@ if (blck_debugLevel > 2) then diag_log format ["_fnc_cleanEmptyGroups:: -- >> group count = %1 ",(count allGroups)]; diag_log format ["_fnc_cleanEmptyGroups:: -- >> Group count AI side = %1", call blck_fnc_groupsOnAISide]; }; - +private _grp = +allGroups; { //diag_log format["_fnc_cleanEmptyGroups:: - >> type of object _x = %1",typeName _x]; if ((count units _x) isEqualTo 0) then {deleteGroup _x}; -}forEach allGroups; +}forEach _grp; //if (blck_debugLevel > 2) then {diag_log "_fnc_cleanEmptyGroups:: -- >> exiting function";}; diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_emptyObject.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_emptyObject.sqf new file mode 100644 index 0000000..81fa468 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_emptyObject.sqf @@ -0,0 +1,6 @@ + + params["_veh"]; + clearWeaponCargoGlobal _veh; + clearMagazineCargoGlobal _veh; + clearBackpackCargoGlobal _veh; + clearItemCargoGlobal _veh; \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_findPositionsAlongARadius.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_findPositionsAlongARadius.sqf index 6b095e5..5792cc8 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_findPositionsAlongARadius.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_findPositionsAlongARadius.sqf @@ -3,10 +3,10 @@ for DBD Clan By Ghostrider-DBD- Copyright 2016 - Last Modified 8-13-16 + Last Modified 1-22-17 */ -private["_locs","_radius","_startDir","_currentDir","_Arc","_dist","_newpos","_xpos","_ypos"]; +private["_locs","_startDir","_currentDir","_Arc","_dist","_newpos"]; params["_center","_num","_minDistance","_maxDistance"]; _locs = []; diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_findSafePosn.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_findSafePosn.sqf index 53839e1..4d43226 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_findSafePosn.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_findSafePosn.sqf @@ -5,9 +5,9 @@ for DBD Clan By Ghostrider-DBD- Copyright 2016 - Last Modified 11-16-16 + Last Modified 1-22-17 */ -private["_findNew","_coords","_blackListCenter","_blackListRadius","_dist","_xpos","_ypos","_newPos","_townPos"]; +private["_findNew","_coords","_dist","_xpos","_ypos","_newPos","_townPos","_pole"]; _findNew = true; @@ -19,22 +19,22 @@ while {_findNew} do { //diag_log format["<<--->> _coords = %1",_coords]; { - if ((_x distance _coords) < blck_MinDistanceFromMission) then { - _FindNew = true; + if ((_x distance2D _coords) < blck_MinDistanceFromMission) then { + _findNew = true; }; }forEach DBD_HeliCrashSites; { - if ( ((_x select 0) distance _coords) < (_x select 1)) exitWith + if ( ((_x select 0) distance2D _coords) < (_x select 1)) exitWith { - _FindNew = true; + _findNew = true; }; } forEach blck_locationBlackList; //diag_log format["#- findSafePosn -# blck_ActiveMissionCoords isEqualTo %1", blck_ActiveMissionCoords]; { //diag_log format["#- findSafePosn -# blck_ActiveMissionCoords active mission item is %1", _x]; - if ( (_x distance _coords) < blck_MinDistanceFromMission) exitWith + if ( (_x distance2D _coords) < blck_MinDistanceFromMission) exitWith { _FindNew = true; }; @@ -54,9 +54,9 @@ while {_findNew} do { if !(_ignore) then { //diag_log format["-# findSafePosn.sqf -# testing _coords against Old Mission coords is %1", _x select 0]; - if ( ((_x select 0) distance _coords) < blck_MinDistanceFromMission) then + if ( ((_x select 0) distance2D _coords) < blck_MinDistanceFromMission) then { - _FindNew = true; + _findNew = true; //diag_log format["-# findSafePosn.sqf -# Too Close to Old Mission element: %1", _x]; }; }; @@ -72,15 +72,15 @@ while {_findNew} do { _newPos = [_xpos,_ypos,0]; if (surfaceIsWater _newPos) then { - _FindNew = true; + _findNew = true; _i = 361; }; }; // check that missions spawn at least 1 kkm from towns { _townPos = [((locationPosition _x) select 0), ((locationPosition _x) select 1), 0]; - if (_townPos distance _coords < 200) exitWith { - _FindNew = true; + if (_townPos distance2D _coords < 200) exitWith { + _findNew = true; }; } forEach blck_townLocations; @@ -91,17 +91,17 @@ while {_findNew} do { if (_mod isEqualTo "Exile") then {_pole = "Exile_Construction_Flag_Static"}; //diag_log format["_fnc_findSafePosn:: -- >> _mod = %1 and _pole = %2",_mod,_pole]; { - if ((_x distance _coords) < 600) then + if ((_x distance2D _coords) < 600) then { - _FindNew = true; + _findNew = true; }; }forEach nearestObjects[player, [_pole], 800]; // check to be sure we do not spawn a mission on top of a player. { - if (isPlayer _x && (_x distance _coords) < 600) then + if (isPlayer _x && (_x distance2D _coords) < 600) then { - _FindNew = true; + _findNew = true; }; }forEach playableUnits; diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_giveTakeCrypto.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_giveTakeCrypto.sqf index 0284221..2140f28 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_giveTakeCrypto.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_giveTakeCrypto.sqf @@ -19,7 +19,7 @@ Contact : halvhjearne@gmail.com */ params["_player","_nr"]; - + private["_cIndex","_vars","_current_crypto","_current_cryptoRaw","_playerCryptoLimit"]; _cIndex = EPOCH_customVars find "Crypto"; _vars = _player getVariable["VARS", call EPOCH_defaultVars_SEPXVar]; _current_crypto = _vars select _cIndex; diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf index fc2b419..a7764d6 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf @@ -5,56 +5,65 @@ - whether it is time to delete the mission objects at a specific location - whether it is time to delete live AI associated with a specific mission By Ghostrider-DbD- - Last modified 1-13-17 + Last modified 1-22-17 */ -private ["_index","_timer10Min","_timer1min","_timer5min","_modType"]; - -_index = 0; +private ["_timer10Min","_timer1min","_timer5min","_modType","_coords"]; +_timer1sec = diag_tickTime; _timer5sec = diag_tickTime; -_timer1min = diag_tickTime; +_timer20sec = diag_tickTime; +//_timer1min = diag_tickTime; _timer5min = diag_tickTime; -_timer10Min = diag_tickTime; +//_timer10Min = diag_tickTime; _modType = [] call blck_fnc_getModType; _ai = []; _obj = []; while {true} do { - uiSleep blck_mainThreadUpdateInterval; // defined in custom_server\compiles\blck_variables.sqf - if ((diag_tickTime - _timer5sec) > 5) then + uiSleep 1; // defined in custom_server\compiles\blck_variables.sqf + if ((diag_tickTime - _timer1sec) > 1) then { [] call blck_fnc_vehicleMonitor; - _timer5sec = diag_tickTime; + _timer1sec = diag_tickTime; }; - if ((diag_tickTime - _timer1min) > 60) then + if ((diag_tickTime - _timer5sec) > 5) then { - _ai = blck_liveMissionAI; + //diag_log format["_fnc_mainThread:: (30) diag_tickTime = %1", diag_tickTime]; + diag_log format["_fnc_mainThread:: (31) blck_liveMissionAI = %1", blck_liveMissionAI]; + _ai = +blck_liveMissionAI; { + //diag_log format["_fnc_mainThread:: (34) evaluating liveAIArray %1 with diag_tickTime %2", _x,diag_tickTime]; if (diag_tickTime > (_x select 1) ) then { //diag_log format["_fnc_mainTread:: cleaning up AI group %1",_x]; [_x select 0] call blck_fnc_cleanupAliveAI; + blck_liveMissionAI set[ _forEachIndex, -1]; + blck_liveMissionAI = blck_liveMissionAI - [-1]; // Remove that list of live AI from the list. + //diag_log format["_fnc_mainTread:: blck_liveMissionAI updated from %1",_ai]; + if (blck_debugLevel > 1) then {diag_log format["_fnc_mainTread:: blck_liveMissionAI updated to %1",blck_liveMissionAI];}; }; - blck_liveMissionAI = blck_liveMissionAI - [_x]; // Remove that list of live AI from the list. }forEach _ai; + diag_log format["_fnc_mainThread:: (44) blck_oldMissionObjects = %1", blck_oldMissionObjects]; + _obj = +blck_oldMissionObjects; - _obj = blck_oldMissionObjects; { - //diag_log format["mainThread::-->> missionObjects _x = %1",_x]; + //diag_log format["mainThread::-->> evaluating missionObjects = %1 diag_tickTime %2",_x,diag_tickTime]; if (diag_tickTime > (_x select 1) ) then { //diag_log format["_fnc_mainTread:: cleaning up mission objects %1",_x]; [_x select 0] call blck_fnc_cleanupObjects; + blck_oldMissionObjects set[_forEachIndex, -1]; + blck_oldMissionObjects = blck_oldMissionObjects - [-1]; + //diag_log format["_fnc_mainTread:: blck_oldMissionObjects updated from %1",_obj]; + if (blck_debugLevel > 1) then {diag_log format["_fnc_mainTread:: blck_oldMissionObjects updated to %1",blck_oldMissionObjects];}; }; - blck_oldMissionObjects = blck_oldMissionObjects - [_x]; }forEach _obj; - - [] call GMS_fnc_cleanupDeadAI; + diag_log format["_fnc_mainThread:: (59) blck_fnc_cleanupDeadAI = %1", blck_deadAI]; + [] call blck_fnc_cleanupDeadAI; if (_modType isEqualTo "Epoch") then { - //diag_log "calling blck_fnc_cleanEmptyGroups"; [] call blck_fnc_cleanEmptyGroups; }; // Exile cleans up empty groups automatically so this should not be needed with that mod. - /* [Jan 14, 2017] reverted the the approach based on mission timers for now + diag_log format["_fnc_mainThread:: (66) blck_pendingMissions = %1", blck_pendingMissions]; { if (blck_debugLevel > 2) then {diag_log format["_fnc_mainThread:: -- >> _x = %1 and _x select 6 = %2",_x, _x select 6];}; if (_x select 6 > 0) then // The mission is not running, check the time left till it is spawned @@ -63,23 +72,17 @@ while {true} do { private _coords = [] call blck_fnc_FindSafePosn; _coords pushback 0; - blck_ActiveMissionCoords pushback _coords; // Note, old entries are delete in blck_fnc_FindSafePosn - private["_markerClass","_missionName","_missionPath","_aiDifficultyLevel"]; - //diag_log format["_fnc_mainThread:: -->> _missionClass would = %1%2",_x select 2, _index]; - _markerClass = _x select 2; - if (blck_debugLevel > 2) then {diag_log format["_fnc_mainThread:: -->> _markerClass = %1",_markerClass];}; - _aiDifficultyLevel = _x select 4; + private["_missionName","_missionPath"]; _missionName = selectRandom (_x select 0); _missionPath = _x select 1; - // example: - // [_missionListHunters,_pathHunters,"HunterMarker","green",blck_TMin_Hunter,blck_TMax_Hunter] - [_coords,_markerClass,_aiDifficultyLevel] execVM format["\q\addons\custom_server\Missions\%1\%2.sqf",_missionPath,_missionName]; + [_coords,_x] execVM format["\q\addons\custom_server\Missions\%1\%2.sqf",_missionPath,_missionName]; }; }; }forEach blck_pendingMissions; - _timer1min = diag_tickTime; + _timer5sec = diag_tickTime; + }; - */ + if ((diag_tickTime - _timer5min) > 300) then { if (blck_timeAcceleration) then { diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_playerInRange.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_playerInRange.sqf new file mode 100644 index 0000000..a2a4edb --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_playerInRange.sqf @@ -0,0 +1,19 @@ +////////////////////////////////////////////////////// +// Test whether one object (e.g., a player) is within a certain range of any of an array of other objects +/* + for DBD Clan + By Ghostrider-DBD- + Copyright 2016 + Last Modified 1/22/17 +*/ +///////////////////////////////////////////////////// + +private ["_result"]; +params["_pos","_dist"]; + +_result = false; +{ + if ((_x distance2D _pos) < _dist) exitWith {_result = true;}; +} forEach allPlayers; +//diag_log format["_fnc_playerInRange:: -> _pos = %1 and _dist = %2 and _result = %3",_pos,_dist,_result]; +_result \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_timedOut.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_timedOut.sqf index 878ab75..8293338 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_timedOut.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_timedOut.sqf @@ -1,12 +1,13 @@ ////////////////////////////////////////////////////// // test if a timeout condition exists. // by Ghostrider-DBD- -// Last modified 1/9/17 +// Last modified 1/22/17 // [_startTime] call blck_fnc_timedOut // Returns true (timed out) or false (not timed out) ///////////////////////////////////////////////////// params["_startTime"]; private["_return"]; -_return = ( (diag_tickTime - _startTime) > blck_MissionTimout ); +if ((diag_tickTime - _startTime) > blck_MissionTimout ) then {_return = true} else {_return = false}; +//diag_log format["fnc_timedOut:: blck_MissionTimout = %2 || _return = %1",_return,blck_MissionTimout]; _return; diff --git a/@epochhive/addons/custom_server/Compiles/Functions/getTraderCitesEpoch.sqf b/@epochhive/addons/custom_server/Compiles/Functions/getTraderCitesEpoch.sqf index c382714..e52d10a 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/getTraderCitesEpoch.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/getTraderCitesEpoch.sqf @@ -2,7 +2,7 @@ if !(blck_blacklistTraderCities) exitWith {}; diag_log format["[blckeagls] Adding Trader Cities to blacklisted locations based on setting for blck_blacklistTraderCities = %1",blck_blacklistTraderCities]; -_traderCites = allMapMarkers; +private _traderCites = allMapMarkers; { if (_x in ["center","respawn_east","respawn_west","respawn_north"] && blck_blacklistTraderCities) then diff --git a/@epochhive/addons/custom_server/Compiles/Functions/getTraderCitesExile.sqf b/@epochhive/addons/custom_server/Compiles/Functions/getTraderCitesExile.sqf index 6496b66..89ec39b 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/getTraderCitesExile.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/getTraderCitesExile.sqf @@ -1,5 +1,5 @@ // pull trader cities from config -_traderCites = allMapMarkers; +private _traderCites = allMapMarkers; _tc = []; { if (getMarkerType _x isEqualTo "ExileTraderZone" && blck_blacklistTraderCities) then { diff --git a/@epochhive/addons/custom_server/Compiles/Groups/GMS_fnc_setWaypoints.sqf b/@epochhive/addons/custom_server/Compiles/Groups/GMS_fnc_setWaypoints.sqf index bb11ed6..5edbafd 100644 --- a/@epochhive/addons/custom_server/Compiles/Groups/GMS_fnc_setWaypoints.sqf +++ b/@epochhive/addons/custom_server/Compiles/Groups/GMS_fnc_setWaypoints.sqf @@ -26,7 +26,7 @@ _arc = 360/_wpnum; for [{ _x=1 },{ _x < _wpnum },{ _x = _x + 1; }] do { _dir = _dir + _arc; if (_dir > 360) then {_dir = _dir - 360;}; - while{_oldpos distance _newpos < 20}do{ + while{_oldpos distance2D _newpos < 20}do{ sleep .1; _dist = (_minDis+(random (_maxDis - _minDis))); diff --git a/@epochhive/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup.sqf b/@epochhive/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup.sqf index 6a0eeac..cd5e70f 100644 --- a/@epochhive/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup.sqf +++ b/@epochhive/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup.sqf @@ -3,15 +3,15 @@ for DBD Clan By Ghostrider-DBD- Copyright 2016 - Last Modified 12/21/16 + Last Modified 1/22/17 */ -//Sets Private Variables to they don't interfere when this script is called more than once -private["_numbertospawn","_i","_groupSpawned","_safepos","_x","_weaponList","_useLauncher","_launcherType","_aiSkills"]; + +private["_numbertospawn","_groupSpawned","_safepos","_weaponList","_useLauncher","_launcherType"]; params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear] ]; -if (blck_debugLevel isEqualTo 3) then +if (blck_debugLevel > 2) then { - diag_log format["[blckeagls] _fnc_spawnGroup called parameters: _numai1 %1, _numbai2 %2, _skillLevel %3, _center %4",_numai1,_numai2,_skillLevel,_center]; + //diag_log format["[blckeagls] _fnc_spawnGroup called parameters: _numai1 %1, _numbai2 %2, _skillLevel %3, _center %4",_numai1,_numai2,_skillLevel,_center]; }; //Spawns correct number of AI if (_numai2 > _numai1) then { @@ -19,15 +19,15 @@ if (_numai2 > _numai1) then { } else { _numbertospawn = _numai2; }; -if (blck_debugLevel isEqualTo 3) then +if (blck_debugLevel > 2) then { - diag_log format["spawnGroup.sqf: _numbertospawn = %1",_numbertospawn]; + //diag_log format["spawnGroup.sqf: _numbertospawn = %1",_numbertospawn]; }; -//Creates a group to make them attack players + _groupSpawned = createGroup blck_AI_Side; if !(isNull _groupSpawned) then { - diag_log format["_fnc_spawnGroup:: -- >> Group created = %1",_groupSpawned]; + if (blck_debugLevel > 1) then {diag_log format["_fnc_spawnGroup:: -- >> Group created = %1",_groupSpawned]}; _groupSpawned setcombatmode blck_combatMode; _groupSpawned allowfleeing 0; _groupSpawned setspeedmode "FULL"; diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addLiveAItoQue.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addLiveAItoQue.sqf index 40bdadc..11ead1d 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addLiveAItoQue.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addLiveAItoQue.sqf @@ -3,10 +3,11 @@ call as [ [list of AI], time] call blck_fnc_addLiveAItoQue; where time is the time delay before deletion occurs by Ghostrider-DbD- - Last modified 10-14-16 + Last modified 1-14-17 */ - +//diag_log format["_fnc_addLiveAIToQue:: -> when called, blck_liveMissionAI = %1",blck_liveMissionAI]; params["_aiList","_timeDelay"]; -if (blck_debugON) then {diag_log format["_fnc_addLiveAIToQue:: -->> _aiList = %1 || _timeDelay = %2",_aiList,_timeDelay];}; +//diag_log format["_fnc_addLiveAIToQue:: -->> _aiList = %1 || _timeDelay = %2",_aiList,_timeDelay]; blck_liveMissionAI pushback [_aiList, (diag_tickTime + _timeDelay)]; +//diag_log format["_fnc_addLiveAIToQue:: -> blck_fnc_addLiveAI updated to %1",blck_liveMissionAI]; diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addMIssionToQue.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addMIssionToQue.sqf index 752ff9f..9fcff3e 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addMIssionToQue.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addMIssionToQue.sqf @@ -2,7 +2,7 @@ Adds the basic list of parameters that define a mission such as the marker name, mission list, mission path, AI difficulty, and timer settings, to the arrays that the main thread inspects. by Ghostrider-DbD- - Last modified 10-14-16 + Last modified 1-21-17 */ //private _mission = _this; @@ -16,7 +16,8 @@ for "_i" from 1 to _noMissions do private _waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin)); // 0 1 2 3 4 5 6 7 private _mission = [_missionList,_path,format["%1%2",_marker,_i],_difficulty,_tMin,_tMax,_waitTime,[0,0,0]]; - diag_log format["-fnc_addMissionToQue::-->> _mission = %1",_mission]; + if (blck_debugLevel > 0) then {diag_log format["-fnc_addMissionToQue::-->> _mission = %1",_mission];}; blck_pendingMissions pushback _mission; }; -diag_log format["_fnc_addMissionToQue:: -- >> Result - blck_pendingMissions = %1",blck_pendingMissions]; + +if (blck_debugLevel > 0) then {diag_log format["_fnc_addMissionToQue:: -- >> Result - blck_pendingMissions = %1",blck_pendingMissions];}; diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addObjToQue.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addObjToQue.sqf index 13875bb..76fb0f6 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addObjToQue.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addObjToQue.sqf @@ -7,6 +7,8 @@ */ params["_objList","_timeDelay"]; -if (blck_debugON) then {diag_log format["_fnc_addObjToQue:: -- >> _objList = %1 || _timeDelay = %2",_objList,_timeDelay];}; +//diag_log format["_fnc_addObjToQue:: -- >> _objList = %1 || _timeDelay = %2",_objList,_timeDelay]; +//diag_log format["_fnc_addObjToQue:: (11) -- >> blck_oldMissionObjects prior to update = %1",blck_oldMissionObjects]; blck_oldMissionObjects pushback [_objList, (diag_tickTime + _timeDelay)]; +//diag_log format["_fnc_addObjToQue:: (11) -- >> blck_oldMissionObjects after update = %1",blck_oldMissionObjects]; diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_cleanUpObjects.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_cleanUpObjects.sqf index ca8624d..d5bd444 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_cleanUpObjects.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_cleanUpObjects.sqf @@ -6,13 +6,23 @@ for DBD Clan By Ghostrider-DBD- Copyright 2016 - Last Modified 8-13-16 + Last Modified 1-22-17 */ - params["_buildings"]; + +params["_objects"]; +{ + if ((typeOf _x) isKindOf "LandVehicle") then { - //diag_log format["cleanupObjects.sqf: -- >> object %1 is typeOf %2",_x, typeOf _x]; - deleteVehicle _x; - } forEach _buildings; + if !(_x getVariable["releasedToPlayers",false]) then + { + private _crew = crew _x; + { + [_x] call blck_fnc_deleteAI; + }forEach _crew; + }; + _x setVariable["blck_DeleteAt",0]; // Schedule it to be deleted by fnc_vehicleMonitor immediately + }; +} forEach _objects; diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf new file mode 100644 index 0000000..34b62ff --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf @@ -0,0 +1,35 @@ +/* + + [_mines,_objects,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission] call blck_fnc_endMission; + schedules deletion of all remaining alive AI and mission objects. + Updates the mission que. + Updates mission markers. + By Ghostrider-DbD- + 1/22/17 +*/ + + if (blck_useSignalEnd) then + { + diag_log format["**** Minor\SM1.sqf:: _crate = %1",_crates select 0]; + [_crates select 0] spawn blck_fnc_signalEnd; + + if (blck_debugLevel > 1) then + { + diag_log format["[blckeagls] _fnc_endMission:: (18) SignalEnd called: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + }; + params["_mines","_objects","_blck_AllMissionAI","_endMsg","_blck_localMissionMarker","_coords","_mission"]; + [_mines] spawn blck_fnc_clearMines; + diag_log format["_fnc_endMission: (23) _objects = %1",_objects]; + uisleep 0.1; + [_objects, blck_cleanupCompositionTimer] spawn blck_fnc_addObjToQue; + diag_log format["_fnc_endMission:: (26) _blck_AllMissionAI = %1",_blck_AllMissionAI]; + uisleep 0.1; + [_blck_AllMissionAI,blck_AliveAICleanUpTimer] spawn blck_fnc_addLiveAItoQue; + [["end",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; + [_blck_localMissionMarker select 1, _markerClass] execVM "debug\missionCompleteMarker.sqf"; + [_blck_localMissionMarker select 0] execVM "debug\deleteMarker.sqf"; + blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; + blck_recentMissionCoords pushback [_coords,diag_tickTime]; + diag_log format["_fnc_endMission:: (34) _mission = %1",_mission]; + [_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue; \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner-4ModularCode.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner-4ModularCode.sqf new file mode 100644 index 0000000..6375156 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner-4ModularCode.sqf @@ -0,0 +1,232 @@ +/* + Generic Mission Spawner + for DBD Clan + By Ghostrider-DBD- + Copyright 2016 + Last modified 1/12/17 +*/ + +private ["_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles"]; +params["_coords","_missionType","_aiDifficultyLevel"]; +waitUntil {blck_missionSpawning isEqualTo false}; +blck_missionSpawning = true; +diag_log format["[blckeagls] missionSpawner:: Initializing mission: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + +private["_chanceHeliPatrol","_noPara","_reinforcementLootCounts","_chanceLoot","_heliCrew"]; +if (isNil "_chanceReinforcements") then +{ + _chanceReinforcements = 0; + _noPara = 0; + _reinforcementLootCounts = [0,0,0,0,0,0]; + _chanceHeliPatrol = 0; + _chanceLoot = 0; +}; + +private["_timeOut","_blck_AllMissionAI"]; // _timeOut is the time in seconds after which a mission is deactivated. +if (isNil "_markerColor") then {_markerColor = "ColorBlack"}; +if (isNil "_markerType") then {_markerType = ["mil_box",[]]}; +if (isNil "_timeOut") then {_timeOut = -1;}; +if (isNil "_noPara") then {_noPara = 0}; +if (isNil "_chanceHeliPatrol") then {_chanceHeliPatrol = 0;}; +if (isNil "_chanceLoot") then {_chanceLoot = 0}; +if (isNil "_heliCrew") then {_heliCrew = 3}; + +if (isNil "_reinforcementLootCounts") then +{ + private["__weap","_mags","_backpacks","_optics","_loadout"]; + _weap = 2 + floor(random(4)); + _mags = 5 + floor(random(6)); + _backpacks = 1 + floor(random(2)); + _optics = 1 + floor(random(6)); + _loadout = 1 + floor(random(3)); + _reinforcementLootCounts = [_weap,_mags,_optics,0,0,_backpacks]; + if (blck_debugLevel > 0) then {diag_log "missionSpawner:: default values used for _reinforcementLootCounts";}; +} +else +{ + if (blck_debugLevel > 0) then {diag_log "missionSpawner:: Mission specific values used for _reinforcementLootCounts";}; +}; + +if (blck_debugLevel > 0) then { + diag_log format["[blckEagle] Mission Reinforcement Parameters: changeReinforcements %1 numAI %2 changePatrol %3 chanceLoot %4",_chanceReinforcements,_noPara,_chanceHeliPatrol,_chanceLoot]; +}; + +private["_useMines","_abortMissionSpawner","_blck_AllMissionAI","_delayTime","_groupPatrolRadius"]; +if (isNil "_useMines") then {_useMines = blck_useMines;}; + +_objects = []; +_mines = []; +_crates = []; +_aiGroup = []; +_missionAIVehicles = []; +_blck_AllMissionAI = []; +_AI_Vehicles = []; +_blck_localMissionMarker = [_missionType,_coords,"","",_markerColor,_markerType]; +_delayTime = 1; +_groupPatrolRadius = 50; +_abortMissionSpawner = false; + +[_blck_localMissionMarker select 0,"Active",_coords] call blck_fnc_updateMissionQue; + +if (blck_labelMapMarkers select 0) then +{ + //diag_log "SM1.sqf: labeling map markers *****"; + _blck_localMissionMarker set [2, _markerMissionName]; +}; +if !(blck_preciseMapMarkers) then +{ + //diag_log "SM1.sqf: 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? +[["start",_startMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; +[_blck_localMissionMarker] execVM "debug\spawnMarker.sqf"; + +uiSleep 1; +blck_missionSpawning = false; +if (blck_debugLevel > 0) then {diag_log "missionSpawner:: waiting for player to trigger the mission";}; +private _missionStartTime = diag_tickTime; +waitUntil{[_coords,blck_TriggerDistance,blck_MissionTimout] call blck_fnc_missionStartConditionsMet;}; +if (((diag_tickTime - _missionStartTime) > blck_MissionTimout)) exitWith +{ + //["timeOut",_endMsg,_blck_localMissionMarker select 2] call blck_fnc_messageplayers; + [_blck_localMissionMarker select 0] execVM "debug\deleteMarker.sqf"; + [_objects, 1] spawn blck_fnc_cleanupObjects; + [_blck_localMissionMarker select 0,"Completed"] call blck_fnc_updateMissionQue; + if (blck_debugLevel > 0) then + { + diag_log format["[blckeagls] missionSpawner:: Mission Timed Out: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + }; +}; + + +if (blck_debugLevel > 0) then +{ diag_log format["[blckeagls] missionSpawner:: -- >> Mission tripped by nearby player: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; +}; + +if (count _missionLootBoxes > 0) then +{ + _crates = [_coords,_missionLootBoxes] call blck_fnc_spawnMissionCrates; +} +else +{ + _crates = [_coords,[[selectRandom blck_crateTypes /*"Box_NATO_Wps_F"*/,[0,0,0],_crateLoot,_lootCounts]]] call blck_fnc_spawnMissionCrates; + +}; + +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: Crates Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; +}; + +uiSleep _delayTime; +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; + _objects append _temp; +}; +uiSleep _delayTime; +if (_useMines) then +{ + _mines = [_coords] call blck_fnc_spawnMines; + uiSleep _delayTime;; +}; + +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; +}; +_objects append _temp; +diag_log format["_fnc_missionSpawner::->> mission objects spawned = %1",_objects]; + +if (blck_debugON) then +{ + diag_log format["[blckeagls] missionSpawner:: Landscape spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; +}; + +uiSleep _delayTime;; + +if ((count _missionLootVehicles) > 0) then // spawn loot vehicles +{ + diag_log "[blckEagles] _fnc_missionSpawner:: Spawning Mission Loot Vehicles"; + private _vehs = [_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles; +}; + +uiSleep _delayTime; +diag_log "[blckEagle] _fnc_missionSpawner:: spawning AI"; +_blck_AllMissionAI = [_coords,_minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI; +diag_log format["[blckeagls] _fnc_missionSpawner (190):-> _blck_AllMissionAI = %1",_blck_AllMissionAI]; +if (blck_debugON) then +{ + diag_log format["[blckeagls] missionSpawner:: AI Patrols Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; +}; + +uiSleep _delayTime; +private _emp = []; +diag_log format["[blckeagls] _fnc_missionSpawner (197):-> _noEmplacedWeapons = %1",_noEmplacedWeapons]; +if (!blck_useStatic && (_noEmplacedWeapons > 0)) then +{ + private ["_emplacedGroup","_emplacedPositions"]; + + _emplacedPositions = [_coords,_count,35,50] call blck_fnc_findPositionsAlongARadius; + //diag_log format["missionSpawner:: _emplacedPositions = %1",_emplacedPositions]; + { + _emplacedGroup = [_x,1,1,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; + if !(isNull _emplacedGroup) then + { + _blck_AllMissionAI = _blck_AllMissionAI + (units _emplacedGroup); + _emplacedWeapon = [_x,_emplacedGroup,blck_staticWeapons,5,15] call blck_fnc_spawnEmplacedWeapon; + _missionAIVehicles pushback _emplacedWeapon; + uiSleep _delayTime; + }; + }forEach _emplacedPositions; +}; +if (blck_debugLevel > 0) then {diag_log format["[blckeagls] _fnc_missionSpawner (208):-> _blck_AllMissionAI = %1",_blck_AllMissionAI];}; +uiSleep _delayTime; +if (blck_useVehiclePatrols && (_noVehiclePatrols > 0)) then +{ + diag_log "[blckEagles] _fnc_missionSpawner:: spawning patrol vehicles"; + private _return = [_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionVehiclePatrols; + if (count _return isEqualTo 2) then + { + _blck_AllMissionAI = _blck_AllMissionAI + (_return select 0); + _AI_Vehicles = _AI_Vehicles + (_return select 1); + }; +}; + +if ((random(1) < _chanceReinforcements)) then +{ + diag_log format["[blckeagls] missionSpawner:: calling in reinforcements: _heliCrew = %1",4]; + private["_grpPilot","_supplyHeli"]; + _grpPilot = createGroup blck_AI_Side; + _grpPara = createGroup blck_AI_Side; + if (!(isNulL _grpPilot) && !(isNull _grpPara)) then + { + //_supplyHeli = [_coords,_grpPilot,_chanceLoot] call blck_fnc_spawnMissionHeli; + //[_coords,_grpPara,_noPara,_aiDifficultyLevel,_chanceLoot,_reinforcementLootCounts,_uniforms,_headgear,_supplyHeli,_grpPilot] spawn blck_fnc_callInReinforcements; + } else { deleteGroup _grpPilot; deleteGroup _grpPara;}; +}; + +if (blck_debugON) then {diag_log "[blckeagls] _fnc_missionSpawner (214) :: waiting for mission completion criterion to be met"; +waitUntil{[_crates,_blck_AllMissionAI,_endCondition] call blck_fnc_missionEndConditionsMet;}; +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: Mission completion criteria fulfilled: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; +}; + +if (blck_useSignalEnd) then +{ + [_crates select 0] spawn blck_fnc_signalEnd; +}; +[_mines] spawn blck_fnc_clearMines; +[_objects, blck_cleanupCompositionTimer] call blck_fnc_addObjToQue; +[_blck_AllMissionAI,blck_AliveAICleanUpTime] call blck_fnc_addLiveAItoQue; +[["end",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; +[_blck_localMissionMarker select 1, _missionType] execVM "debug\missionCompleteMarker.sqf"; +[_blck_localMissionMarker select 0] execVM "debug\deleteMarker.sqf"; +[_blck_localMissionMarker select 0,"Completed"] call blck_fnc_updateMissionQue; +diag_log format["[blckeagls] missionSpawner:: end of mission: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; 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 8aa7c1c..67e552b 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -3,14 +3,27 @@ for DBD Clan By Ghostrider-DBD- Copyright 2016 - Last modified 1/12/17 + Last modified 1/22/17 */ -private ["_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut"]; -params["_coords","_missionType","_aiDifficultyLevel"]; -waitUntil {blck_missionSpawning isEqualTo false}; -blck_missionSpawning = true; -diag_log format["[blckeagls] missionSpawner:: Initializing mission: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; +private ["_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut","_aiDifficultyLevel"]; +params["_coords","_mission"]; + +//////// +// 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"]; if (isNil "_chanceReinforcements") then @@ -39,14 +52,14 @@ if (isNil "_reinforcementLootCounts") then _optics = 1 + floor(random(6)); _loadout = 1 + floor(random(3)); _reinforcementLootCounts = [_weap,_mags,_optics,0,0,_backpacks]; - if (blck_debugLevel > 0) then {diag_log "missionSpawner:: default values used for _reinforcementLootCounts";}; + if (blck_debugLevel > 1) then {diag_log "missionSpawner:: default values used for _reinforcementLootCounts";}; } else { - if (blck_debugLevel > 0) then {diag_log "missionSpawner:: Mission specific values used for _reinforcementLootCounts";}; + if (blck_debugLevel > 1) then {diag_log "missionSpawner (47):: Mission specific values used for _reinforcementLootCounts";}; }; -if (blck_debugLevel > 0) then { +if (blck_debugLevel > 1) then { diag_log format["[blckEagle] Mission Reinforcement Parameters: changeReinforcements %1 numAI %2 changePatrol %3 chanceLoot %4",_chanceReinforcements,_noPara,_chanceHeliPatrol,_chanceLoot]; }; @@ -60,385 +73,220 @@ _aiGroup = []; _missionAIVehicles = []; _blck_AllMissionAI = []; _AI_Vehicles = []; -_blck_localMissionMarker = [_missionType,_coords,"","",_markerColor,_markerType]; +_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType]; _delayTime = 1; _groupPatrolRadius = 50; if (blck_labelMapMarkers select 0) then { - //diag_log "SM1.sqf: labeling map markers *****"; + //diag_log "labeling map markers *****"; _blck_localMissionMarker set [2, _markerMissionName]; }; if !(blck_preciseMapMarkers) then { - //diag_log "SM1.sqf: Map marker will be OFFSET from the mission position"; + //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"; +if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (94) waiting for player to trigger the mission";}; -_fn_playerWithinRange = { - params["_pos"]; - private["_return"]; - _return = false; - { - if (isPlayer _x and _x distance _pos <= blck_TriggerDistance) then {_return = true}; - - }forEach allPlayers; // playableunits; changed for Arma 1.66 - _return; -}; +//////// +// All parameters are defined, lets wait until a player is nearby or the mission has timed out +//////// -uiSleep 1; -///////////////////////////// -// Everything has been set up for the mission and it is now waiting to be triggered by a nearby player or to time out. -// Lets let other instances of the mission spawner know it is OK to go ahead -//////////////////////////// -blck_missionSpawning = false; - -diag_log "missionSpawner:: waiting for player to trigger the mission"; 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 { - if (blck_debugLevel isEqualTo 3) then + //diag_log "missionSpawner:: top of mission trigger loop"; + if (blck_debugLevel > 2) exitWith {_playerInRange = true;}; + if ([_coords, blck_TriggerDistance] call blck_fnc_playerInRange) exitWith {_playerInRange = true;}; + if ([_missionStartTime] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;}; + uiSleep 5; + //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]; +}; + +if (_missionTimedOut) exitWith +{ + // Deal with the case in which the mission timed out. + //["timeOut",_endMsg,_blck_localMissionMarker select 2] call blck_fnc_messageplayers; + blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; + [_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue; + [_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; + if (blck_debugLevel > 0) then { - _wait = false; - _playerInRange = true; - } else { - if ([_coords] call _fn_playerWithinRange) then - { - _wait = false; - _playerInRange = true; - } else - { - if ((diag_tickTime - _missionStartTime) > blck_MissionTimout) then - { - _wait = false; - _missionTimedOut = true; - }; - }; - uiSleep 1; + diag_log format["[blckeagls] missionSpawner:: (105) Mission Timed Out: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; }; }; -//waitUntil{ { (isPlayer _x && _x distance _coords <= blck_TriggerDistance /*&& vehicle _x == _x*/) || ([_missionStartTime] call _fn_timedOut) } count playableunits > 0 }; + +//////// +// Spawn the mission objects, loot chest, and AI +//////// +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]; +}; + +if (count _missionLootBoxes > 0) then +{ + _crates = [_coords,_missionCfg select 2] call blck_fnc_spawnMissionCrates; +} +else +{ + _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]]] call blck_fnc_spawnMissionCrates; + +}; +// un-comment this if you want crates cleaned up when the rest of the mission objects are removed. +//_objects append _crates; + +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (131) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +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; +}; +if (typeName _temp isEqualTo "ARRAY") then +{ + _objects append _temp; +}; +//diag_log format["_fnc_missionSpawner:: (181)->> _objects = %1",_objects]; if (blck_debugON) then { - diag_log format["missionSpawner:: Mission Triggerred contition playerInRange %1 and timout = %2",_playerInRange, _missionTimedOut]; + diag_log format["[blckeagls] missionSpawner:: (166) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; }; -if (!_playerInRange && _missionTimedOut) exitWith +uiSleep _delayTime;; + +[_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles; + +uiSleep _delayTime; +private ["_infantry"]; +_infantry = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI; +//diag_log format["missionSpawner:: (201) -> _infantry = %1",_infantry]; +if (typeName _infantry isEqualto "ARRAY") then { - //["timeOut",_endMsg,_blck_localMissionMarker select 2] call blck_fnc_messageplayers; - [_blck_localMissionMarker select 0] execVM "debug\deleteMarker.sqf"; - _blck_localMissionMarker set [1,[0,0,0]]; - _blck_localMissionMarker set [2,""]; - [_objects, 1] spawn blck_fnc_cleanupObjects; - if (blck_debugON) then - { - diag_log format["[blckeagls] missionSpawner:: Mission Timed Out: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; - }; + _blck_AllMissionAI append _infantry; }; -if (_playerInRange) then +uiSleep _delayTime; +if (blck_debugON) then { - if (blck_debugON) then - { diag_log format["[blckeagls] missionSpawner:: -- >> Mission tripped by nearby player: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; - }; - - if (count _missionLootBoxes > 0) then - { - _crates = [_coords,_missionCfg select 2/* array of crates*/] call blck_fnc_spawnMissionCrates; - } - else - { - _crates = [_coords,[[selectRandom blck_crateTypes /*"Box_NATO_Wps_F"*/,[0,0,0],_crateLoot,_lootCounts]]] call blck_fnc_spawnMissionCrates; - - }; - //_objects append _crates; - - if (blck_debugON) then - { - diag_log format["[blckeagls] missionSpawner:: Crates Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; - }; - - uiSleep _delayTime; - - if (blck_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate - { - private ["_temp"]; - _temp = [_coords,blck_SmokeAtMissions select 1] call blck_fnc_smokeAtCrates; - _objects append _temp; - _temp = nil; - }; - uiSleep _delayTime; - if (_useMines) then - { - _mines = [_coords] call blck_fnc_spawnMines; - //waitUntil{!(_mines isEqualTo [];); - uiSleep _delayTime;; - }; - uiSleep _delayTime; - _obj = []; - if (_missionLandscapeMode isEqualTo "random") then - { - _obj = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape; - } else { - _obj = [_coords, floor(random(360)),_missionLandscape,true] call blck_fnc_spawnCompositionObjects; - }; - //diag_log format["_fnc_missionSpawner::->> _obj = %1",_obj]; - _objects append _obj; - //diag_log format["_fnc_missionSpawner::->> _objects = %1",_objects]; - _obj= nil; - if (blck_debugON) then - { - diag_log format["[blckeagls] missionSpawner:: Landscape spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; - }; - - uiSleep _delayTime;; - - if ((count _missionLootVehicles) > 0) then // spawn loot vehicles - { - { - //diag_log format["spawnMissionCVehicles.sqf _x = %1",_x]; - _offset = _x select 1; // offset relative to _coords at which to spawn the vehicle - _pos = [(_coords select 0)+(_offset select 0),(_coords select 1) + (_offset select 1),(_coords select 2)+(_offset select 2)]; - _veh = [_x select 0 /* vehicle class name*/, _pos] call blck_fnc_spawnVehicle; - _vehs pushback _veh; - [_veh,_x select 2 /*loot array*/, _x select 3 /*array of values specifying number of items of each loot type to load*/] call blck_fnc_fillBoxes; - }forEach _missionLootVehicles; - - }; - uiSleep _delayTime; - if (blck_useStatic && (_noEmplacedWeapons > 0)) then - { - private["_static","_count"]; - if ( count (_missionEmplacedWeapons) > 0 ) then - { - _static = _missionCfg select 4 select 1; - _count = _missionCfg select 4 select 0; - } - else - { - _static = blck_staticWeapons; - _count = _noEmplacedWeapons; - }; - private ["_emplacedGroup","_emplacedPositions"]; - - _emplacedPositions = [_coords,_count,35,50] call blck_fnc_findPositionsAlongARadius; - //diag_log format["missionSpawner:: _emplacedPositions = %1",_emplacedPositions]; - { - _emplacedGroup = [_x,1,1,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; - //_emplacedUnits = units _emplacedGroup; - _blck_AllMissionAI = _blck_AllMissionAI + (units _emplacedGroup); - _emplacedWeapon = [_x,_emplacedGroup,blck_staticWeapons,5,15] call blck_fnc_spawnEmplacedWeapon; - _missionAIVehicles pushback _emplacedWeapon; - uiSleep _delayTime; - }forEach _emplacedPositions; - //diag_log format["missionSpawner:: emplaced weapons data: _AI_Vehicles %1 _blck_AllMissionAI %1",_AI_Vehicles,_blck_AllMissionAI]; - if (blck_debugON) then - { - diag_log format["[blckeagls] missionSpawner:: Static Weapons Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; - }; - }; - uiSleep _delayTime; - //diag_log format["_fnc_missionSpawner:: after adding any static weapons, _blck_AllMissionAI is %1",_blck_AllMissionAI]; - - //diag_log format["_fnc_missionSpawner:: after adding any vehicle patrols, _blck_AllMissionAI is %1",_blck_AllMissionAI]; - //diag_log format["missionSpawner:: _noAIGroups = %1; spawning AI Groups now",_noAIGroups]; - uiSleep _delayTime; - private["_unitsToSpawn","_unitsPerGroup","_ResidualUnits","_newGroup"]; - _unitsToSpawn = round(_minNoAI + round(random(_maxNoAI - _minNoAI))); - _unitsPerGroup = floor(_unitsToSpawn/_noAIGroups); - _ResidualUnits = _unitsToSpawn - (_unitsPerGroup * _noAIGroups); - //diag_log format["missionSpawner:: _unitsToSpawn %1 ; _unitsPerGroup %2 _ResidualUnits %3",_unitsToSpawn,_unitsPerGroup,_ResidualUnits]; - switch (_noAIGroups) do - { - case 1: { // spawn the group near the mission center - //params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear] ]; - _newGroup = [_coords,_unitsToSpawn,_unitsToSpawn,_aiDifficultyLevel,_coords,3,18,_uniforms,_headGear] call blck_fnc_spawnGroup; - _newAI = units _newGroup; - _blck_AllMissionAI = _blck_AllMissionAI + _newAI; - //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, _newAI]; - }; - case 2: { - //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=2"]; // spawn groups on either side of the mission area - _groupLocations = [_coords,_noAIGroups,15,30] call blck_fnc_findPositionsAlongARadius; - { - private["_adjusttedGroupSize"]; - if (_ResidualUnits > 0) then - { - _adjusttedGroupSize = _unitsPerGroup + _ResidualUnits; - _ResidualUnits = 0; - } else { - _adjusttedGroupSize = _unitsPerGroup; - }; - _newGroup = [_x,_adjusttedGroupSize,_adjusttedGroupSize,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup; - _newAI = units _newGroup; - _blck_AllMissionAI = _blck_AllMissionAI + _newAI; - //diag_log format["missionSpawner: Spawning 2 Groups: _newGroup=%1 _newAI = %2",_newGroup, _newAI]; - }forEach _groupLocations; - - }; - case 3: { // spawn one group near the center of the mission and the rest on the perimeter - //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=3"]; - _newGroup = [_coords,_unitsPerGroup + _ResidualUnits,_unitsPerGroup + _ResidualUnits,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup; - _newAI = units _newGroup; - _blck_AllMissionAI = _blck_AllMissionAI + _newAI; - //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=3 _newGroup=%1 _newAI = %2",_newGroup, _newAI]; - _groupLocations = [_coords,2,20,35] call blck_fnc_findPositionsAlongARadius; - { - _newGroup = [_x,_unitsPerGroup,_unitsPerGroup,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup; - _newAI = units _newGroup; - _blck_AllMissionAI = _blck_AllMissionAI + _newAI; - //diag_log format["missionSpawner: Spawning 2 Groups:_newGroup=%1 _newAI = %2",_newGroup, _newAI]; - }forEach _groupLocations; - - }; - default { // spawn one group near the center of the mission and the rest on the perimeter - //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=default"]; - _newGroup = [_coords,_unitsPerGroup + _ResidualUnits,_unitsPerGroup + _ResidualUnits,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup; - _newAI = units _newGroup; - _blck_AllMissionAI = _blck_AllMissionAI + _newAI; - //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=%3 _newGroup=%1 _newAI = %2",_newGroup, _newAI,_noAIGroups]; - _groupLocations = [_coords,(_noAIGroups - 1),20,40] call blck_fnc_findPositionsAlongARadius; - { - _newGroup = [_x,_unitsPerGroup,_unitsPerGroup,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup; - _newAI = units _newGroup; - _blck_AllMissionAI = _blck_AllMissionAI + _newAI; - //diag_log format["missionSpawner: Spawning %3 Groups: _newGroup=%1 _newAI = %2",_newGroup, _newAI,_noAIGroups]; - }forEach _groupLocations; - }; - }; - uiSleep _delayTime; - if (blck_debugON) then - { - diag_log format["[blckeagls] missionSpawner:: AI Patrols Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; - }; - - if ((random(1) < _chanceReinforcements)) then - { - _weaponList = blck_WeaponList_Red; - - switch (_aiDifficultyLevel) 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;}; - }; - - //diag_log format["missionSpawner:: weaponList = %1",_weaponList]; - private["_grpReinforcements"]; - _grpReinforcements = grpNull; - - diag_log format["[blckeagls] missionSpawner:: calling in reinforcements: Current mission: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; - [] spawn { - //[_coords,_noPara,_aiDifficultyLevel,_chanceLoot,_reinforcementLootCounts,_weaponList,_uniforms,_headgear,_chanceHeliPatrol] call blck_fnc_Reinforcements; - //waitUntil {_grpReinforcements != grpNull}; - //diag_log format["[blckeagls] missionSpawner::reinforcement spawner started: Current mission: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; - }; - if !(_grpReinforcements isEqualTo grpNull) then - { - _blck_AllMissionAI = _blck_AllMissionAI + (units _grpReinforcements); - //diag_log format["missionSpawner:: _grpReinforcements = %1",_grpReinforcements]; - }; - }; - - if (blck_useVehiclePatrols && (_noVehiclePatrols > 0)) then - { - private["_vehGroup","_patrolVehicle","_vehiclePatrolSpawns"]; - _vehiclePatrolSpawns= [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPositionsAlongARadius; - //diag_log format["missionSpawner:: _vehiclePatrolSpawns = %1",_vehiclePatrolSpawns]; - //for "_i" from 1 to _noVehiclePatrols do - { - _vehGroup = [_x,3,3,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; - //diag_log format["missionSpawner:: group for AI Patrol vehicle spawn: group is %1 with units of %2",_vehGroup, units _vehGroup]; - _blck_AllMissionAI = _blck_AllMissionAI + (units _vehGroup); - _randomVehicle = blck_AIPatrolVehicles call BIS_fnc_selectRandom; - //diag_log format["missionSpawner:: vehicle selected is %1", _randomVehicle]; - _patrolVehicle = [_coords,_x,_randomVehicle,(_x distance _coords) -5,(_x distance _coords) + 5,_vehGroup] call blck_fnc_spawnVehiclePatrol; - //diag_log format["missionSpawner:: patrol vehicle spawned was %1",_patrolVehicle]; - _vehGroup setVariable["groupVehicle",_patrolVehicle,true]; - //uiSleep _delayTime; - _AI_Vehicles pushback _patrolVehicle; - }forEach _vehiclePatrolSpawns; - //diag_log format["missionSpawner:: vehicle patrols data: _AI_Vehicles %1 _blck_AllMissionAI %1",_AI_Vehicles,_blck_AllMissionAI]; - uiSleep _delayTime; - if (blck_debugON) then - { - diag_log format["[blckeagls] missionSpawner:: Vehicle Patrols Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; - }; - }; - // Trigger for mission end - //diag_log format["[blckeagls] mission Spawner _endCondition = %1",_endCondition]; - private["_missionComplete"]; - _missionComplete = -1; - - _endIfPlayerNear = false; - _endIfAIKilled = false; - _startTime = diag_tickTime; - _missionTimedOut = false; - - switch (_endCondition) do - { - case "playerNear": {_endIfPlayerNear = true;}; - case "allUnitsKilled": {_endIfAIKilled = true;}; - case "allKilledOrPlayerNear": {_endIfPlayerNear = true;_endIfAIKilled = true;}; - }; - //diag_log format["missionSpawner :: _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; - private["_locations"]; - _locations = [_coords] + _crates; - - //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) then - { - uiSleep 120; - _missionComplete = 1; - } else { - if (_endIfPlayerNear) then { - if ( { (isPlayer _x) && ([_x,_locations,20] call blck_fnc_objectInRange) && (vehicle _x == _x) } count allPlayers > 0) then { - _missionComplete = 1; - }; - }; - //diag_log format["missionSpawner:: count alive _blck_AllMissionAI = %1",{alive _x} count _blck_AllMissionAI]; - if (_endIfAIKilled) then { - if (({alive _x} count _blck_AllMissionAI) < 1 ) then { - _missionComplete = 1; - //diag_log format["missionSpawner:: _blck_AllMissionAI = %1","testing case _endIfAIKilled"]; - }; - }; - uiSleep 2; - }; - }; - - if (blck_debugON) then - { - diag_log format["[blckeagls] missionSpawner:: Mission completion criteria fulfilled: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; - }; - - if (blck_useSignalEnd) then - { - //diag_log format["**** Minor\SM1.sqf:: _crate = %1",_crates select 0]; - [_crates select 0] spawn blck_fnc_signalEnd; - - if (blck_debugON) then - { - diag_log format["[blckeagls] missionSpawner:: SignalEnd called: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; - }; - }; - [_mines] spawn blck_fnc_clearMines; - [_objects, blck_cleanupCompositionTimer] call blck_fnc_addObjToQue; - [_blck_AllMissionAI,blck_AliveAICleanUpTime] call blck_fnc_addLiveAItoQue; - [["end",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; - [_blck_localMissionMarker select 1, _missionType] execVM "debug\missionCompleteMarker.sqf"; - [_blck_localMissionMarker select 0] execVM "debug\deleteMarker.sqf"; - //[_blck_localMissionMarker select 0,"Completed"] call blck_fnc_updateMissionQue; - diag_log format["[blckeagls] missionSpawner:: end of mission: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + diag_log format["[blckeagls] missionSpawner:: (210) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; }; + +uisleep _delayTime; +if (blck_useVehiclePatrols && (_noVehiclePatrols > 0)) then +{ + private["_veh"]; + uiSleep 1; + _veh = [_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols; + //diag_log format["missionSpawner :: (219) _veh = %1",_veh]; + _objects append (_veh select 0); + _blck_AllMissionAI append (_veh select 1); + uiSleep _delayTime; + if (blck_debugLevel > 0) then + { + diag_log format["[blckeagls] missionSpawner:: (225) Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; +}; + +uiSleep _delayTime; +private ["_temp"]; +if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (213) preparing to spawn emplaced weapons for _markerClass %3:: blck_useStatic = %1 and _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass];}; +if (blck_useStatic && (_noEmplacedWeapons > 0)) then +{ + _temp = [_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray; + //diag_log format ["missionSpawner:: (246) value returned for _temp = %1",_temp]; + _objects append (_temp select 0); + _blck_AllMissionAI append (_temp select 1); +}; + +if ((random(1) < _chanceReinforcements)) then +{ + _weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout; + private["_grpReinforcements"]; + _grpReinforcements = grpNull; + + //diag_log format["[blckeagls] missionSpawner:: calling in reinforcements: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + [] spawn { + //[_coords,_noPara,_aiDifficultyLevel,_chanceLoot,_reinforcementLootCounts,_weaponList,_uniforms,_headgear,_chanceHeliPatrol] call blck_fnc_Reinforcements; + //waitUntil {_grpReinforcements != grpNull}; + //diag_log format["[blckeagls] missionSpawner::reinforcement spawner started: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + if !(_grpReinforcements isEqualTo grpNull) then + { + _blck_AllMissionAI = _blck_AllMissionAI + (units _grpReinforcements); + //diag_log format["missionSpawner:: _grpReinforcements = %1",_grpReinforcements]; + }; +}; + +// 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] + _crates; + +//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 120}; + if ((_endIfPlayerNear) && [_coords,20] call blck_fnc_playerInRange) exitWith {}; + if ((_endIfAIKilled) && ({alive _x} count _blck_AllMissionAI) < 1 ) 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 2; +}; + +if (blck_debugLevel > 1) then +{ + diag_log format["[blckeagls] missionSpawner:: (288) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; + +[_mines,_objects,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission] call blck_fnc_endMission; +diag_log format["[blckeagls] missionSpawner:: (292)end of mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionTimedOut.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionTimedOut.sqf new file mode 100644 index 0000000..0af1cfc --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionTimedOut.sqf @@ -0,0 +1,11 @@ +/* + [_blck_localMissionMarker, _coords, _objects] call blck_fnc_missionTimedOut; +*/ +params["_blck_localMissionMarker", "_coords", "_objects"]; + +//["timeOut",_endMsg,_blck_localMissionMarker select 2] call blck_fnc_messageplayers; +[_blck_localMissionMarker select 0] execVM "debug\deleteMarker.sqf"; +_blck_localMissionMarker set [1,[0,0,0]]; +_blck_localMissionMarker set [2,""]; +blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; +[_objects, 1] spawn blck_fnc_cleanupObjects; \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionTriggeredConditionsMet.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionTriggeredConditionsMet.sqf new file mode 100644 index 0000000..8f01fb8 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionTriggeredConditionsMet.sqf @@ -0,0 +1,38 @@ +/* + test if either of two conditions is true: + player within a specific range of the coordinates + mission has timed out + + By Ghostrider-DbD- + 1/21/17 +*/ + + +params["_coords"]; +private["_result"]; +#define GMS_playerInRange 1 +#define GMS_missionTimeOut 2 + +_result = 0; +if (blck_debugLevel > 2) then +{ + _result = GMS_playerInRange; + diag_log format["_fnc_missionTriggeredConditionsMet:: -> Trigger conditions met with blck_debugLevel > 2 and _result set to %1",_result]; +} else { + if ({ (isPlayer _x) && (_x distance _coords < blck_TriggerDistance) } count allPlayers > 0) then + { + _result = GMS_playerInRange; + diag_log format["_fnc_missionTriggeredConditionsMet:: -> Trigger conditions met with player in range and _result set to %1",_result]; + + } else + { + if ((diag_tickTime - _missionStartTime) > blck_MissionTimout) then + { + _result = GMS_missionTimeOut; + diag_log format["_fnc_missionTriggeredConditionsMet:: -> Trigger conditions met with mission timed out and _result set to %1",_result]; + }; + }; +}; +if (blck_debugLevel > 0) then {diag_log format["_fnc_missionTriggeredConditionsMet:: _result returned = %1 at time %2:",_result,_diag_tickTime]; + +_result \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_objectInRange.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_objectInRange.sqf index 2e6bc90..814fa75 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_objectInRange.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_objectInRange.sqf @@ -4,7 +4,7 @@ for DBD Clan By Ghostrider-DBD- Copyright 2016 - Last modified 1/12/2017 + Last modified 1/22/2017 */ ///////////////////////////////////////////////////// @@ -12,12 +12,12 @@ params["_obj1","_objList","_minDist"]; //_obj1 : player or other object // _objList : array of objects - //_minDist : distance below which the function would return true; + //_minDist : distance within which the function would return true; _result = false; //diag_log format["playerInRange.sqf: _obj1 = %1, _objList = %2 _minDist = %3",_obj1,_objList,_minDist]; { - if ((_x distance _obj1) < _minDist) exitWith {_result = true;}; + if ((_x distance2D _obj1) < _minDist) exitWith {_result = true;}; } forEach _objList; _result \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_playerInRange.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_playerInRange.sqf index f02852d..814a283 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_playerInRange.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_playerInRange.sqf @@ -11,10 +11,9 @@ private ["_result"]; params["_pos","_dist"]; diag_log format["_fnc_playerInRange:: -> _pos = %1 and _dist = %2",_pos,_dist]; -uiSleep 5; _result = false; { - if ((_x distance _pos) < _dist) exitWith {_result = true;}; + if ((_x distance2D _pos) < _dist) exitWith {_result = true;}; } forEach allPlayers; _result \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnBaseObjects.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnBaseObjects.sqf index f92841e..a19ee18 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnBaseObjects.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnBaseObjects.sqf @@ -2,11 +2,10 @@ Spawn objects from an array using offsects from a central location. The code provided by M3Editor EDEN has been addapted to add checks for vehicles, should they be present. Returns an array of spawned objects. - version of 11/9/16 + version of 1/13/17 */ -//diag_log format["_fnc_spawnBaseObjects: _this = %1",_this]; + params["_center","_azi","_objects","_setVector"]; -//diag_log format["_fnc_spawnBaseObjects: _objs = %1",_objects]; private ["_newObjs"]; @@ -23,21 +22,7 @@ _newObjs = []; // Lock any vehicles placed as part of the mission landscape. Note that vehicles that can be taken by players can be added via the mission template. if ( (typeOf _obj) isKindOf "LandVehicle" || (typeOf _obj) isKindOf "Air" || (typeOf _obj) isKindOf "Sea") then { - //diag_log format["_fnc_spawnBaseObjects:: Locking vehicle of type %1",typeOf _obj]; - //_obj = _x select 0; - _obj setVehicleLock "LOCKEDPLAYER"; - _obj addEventHandler ["GetIn",{ // forces player to be ejected if he/she tries to enter the vehicle - private ["_theUnit"]; - _theUnit = _this select 2; - _theUnit action ["Eject", vehicle _theUnit]; - hint "Use of this vehicle is forbidden"; - }]; - - clearItemCargoGlobal _obj; - clearWeaponCargoGlobal _obj; - clearMagazineCargoGlobal _obj; - clearBackpackCargoGlobal _obj; + [_obj] call blck_fnc_configureMissionVehicle; }; } forEach _objects; -//diag_log format["_fnc_spawnBaseObjects _newObjs = %1",_newObjs]; _newObjs diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnCrate.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnCrate.sqf index 969374f..065e8ae 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnCrate.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnCrate.sqf @@ -20,8 +20,5 @@ _crate setVariable ["LAST_CHECK", 100000]; _crate setPosATL [_px, _py, 0.5]; _crate allowDamage false; _crate enableRopeAttach true; -clearWeaponCargoGlobal _crate; -clearMagazineCargoGlobal _crate; -clearBackpackCargoGlobal _crate; -clearItemCargoGlobal _crate; +[_crate] call blck_fnc_emptyObject; _crate; diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf new file mode 100644 index 0000000..50242c7 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf @@ -0,0 +1,40 @@ +/* + + [_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray; + +*/ + +params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"]; +private["_return","_emplacedWeps","_emplacedAI","_wep","_units","_gunner"]; +_emplacedWeps = []; +_emplacedAI = []; +_units = []; +//diag_log "_fnc_spawnEmplacedWeaponArray start"; +// Define _missionEmplacedWeapons if not already configured. +if (count _missionEmplacedWeapons < 1) then +{ + _missionEmplacedWeapons = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius; +}; +//diag_log format["_fnc_spawnEmplacedWeaponArray:: (18) _missionEmplacedWeapons = %1", _missionEmplacedWeapons]; +{ + _empGroup = [_x,1,1,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; + //diag_log format["_fnc_spawnEmplacedWeaponArray:: typeName _empGroup = %1 and _empGroup = %2",typeName _empGroup, _empGroup]; + // params["_vehType","_pos",["_clearInventory",true]]; + _wep = [selectRandom blck_staticWeapons,[0,0,0],false] call blck_fnc_spawnVehicle; + //diag_log format["_fnc_spawnEmplacedWeaponArray (23) spawnVehicle returned value of _wep = %1",_wep]; + _wep setVariable["DBD_vehType","emplaced"]; + _wep setPosATL _x; + [_wep,false] call blck_fnc_configureMissionVehicle; + _emplacedWeps pushback _wep; + blck_missionVehicles pushback _wep; + _units = units _empGroup; + _gunner = _units select 0; + _gunner moveingunner _wep; + _emplacedAI append (units _empGroup); + //diag_log format["_fnc_spawnEmplacedWeaponArray:: position of emplaced weapon = %1 and position of _x is %2",getPos _wep, _x]; + //diag_log format["_fnc_spawnEmplacedWeaponArray:: _gunner = %1 and crew _wep = %2",_gunner, crew _wep]; +} forEach _missionEmplacedWeapons; + +_return = [_emplacedWeps,_emplacedAI]; +//diag_log format["_fnc_spawnEmplacedWeaponArray:: returning with _return = _emplacedWeps = %1",_return]; +_return \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionEmplacedWeapons.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionEmplacedWeapons.sqf index 6fabff5..224b6c2 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionEmplacedWeapons.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionEmplacedWeapons.sqf @@ -3,59 +3,46 @@ [_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnMissionEmplacedWeapons; */ -// [_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnMissionEmplacedWeapons; -params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"]; -diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons(9):: - > _noEmplacedWeapons = %1",_noEmplacedWeapons]; -private ["_emplacedGroup","_emplacedPositions","_missionGroups","_missionAI","_missionStatics","_false","_return","_count"]; -_missionGroups = []; -_missionAI = []; -_missionStatics = []; -_return = []; -diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons(15):: - > _noEmplacedWeapons = %1",_noEmplacedWeapons]; -if (count _missionEmplacedWeapons > 0) then + +params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear",["_missionType","unspecified"]]; +private ["_emplacedGroup","_emplacedAI","_precise","_pos","_emplaced","_emp","_gunner","_staticWeap"]; +_emplacedAI = []; +_staticWeap = []; +if (blck_debugLevel > 0) then {diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons(10):: - >_missionEmplacedWeapons = %2 and _noEmplacedWeapons = %1",_noEmplacedWeapons,_missionEmplacedWeapons];}; + +if ( count _missionEmplacedWeapons isEqualTo 0 ) then { - { - diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons (19):: - > _spawning from _missionEmplacedWeapons %1",_missionEmplacedWeapons]; - _emplacedGroup = [_x,1,1,_aiDifficultyLevel,_coords,0,0.1,_uniforms,_headGear] call blck_fnc_spawnGroup; - diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons (21):: - > _spawned group %1",_emplacedGroup]; - if !(isNull _emplacedGroup) then - { - _missionGroups pushback _emplacedGroup; - {_x allowDamage false;} forEach units _emplacedGroup; - _emplacedWeapon = [_x,_emplacedGroup,blck_staticWeapons,5,15] call blck_fnc_spawnEmplacedWeapon; - _emplacedWeapon setPosATL _x; - _missionStatics pushback _missionStatics; - uiSleep _delayTime; - {_x allowDamage true;} forEach units _emplacedGroup; - }; - } forEach _missionEmplacedWeapons; -} else { - _emplacedPositions = [_coords,_count,35,50] call blck_fnc_findPositionsAlongARadius; - { - diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons (36):: - > _noEmplacedWeapons = %1",_noEmplacedWeapons]; - _emplacedGroup = [_x,1,1,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; - diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons (38):: - > _spawned group %1",_emplacedGroup]; - if !(isNull _emplacedGroup) then - { - _missionGroups pushback _emplacedGroup; - _emplacedWeapon = [_x,_emplacedGroup,blck_staticWeapons,5,15] call blck_fnc_spawnEmplacedWeapon; - _missionStatics pushback _missionStatics; - uiSleep _delayTime; - }; - }forEach _emplacedPositions; + _missionEmplacedWeapons = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius; + _precise = false; + if (blck_debugLevel > 1) then {diag_log "_fnc_spawnMissionEmplacedWeapons:: -->> no spawn points specified, using spawns along a radius"; }; - +diag_log format["_fnc_spawnMissionEmplacedWeapons:: (19) _missionType = %2 _missionEmplacedWeapons updated to %1",_missionEmplacedWeapons,_missionType]; { - if !(isNull _x) then {_missionAI pushback (units _x); -}forEach _missionGroups; + diag_log format["_fnc_spawnMissionEmplacedWeapons:: (21) spawning group to man emplaced weapon"]; + _emplacedGroup = [_x,1,1,_aiDifficultyLevel,[0,0,0],1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; + diag_log format["_fnc_spawnMissionEmplacedWeapons:: (23) group spawned = %1",_emplacedGroup]; + _emplacedAI append (units _emplacedGroup); + diag_log format["_fnc_spawnMissionEmplacedWeapons:: (24) _emplacedAI updated to = %1",_emplacedAI]; -if ( (count _missionAI) < 1) then -{ - {deleteVehicle _x} forEach _missionStatics; -} -else -{ - _return = [_missionAI,_missionStatics]; -}; + diag_log format["_fnc_spawnMissionEmplacedWeapons:: (26) spawning emplaced weapon"]; + if (_precise) then + { + _pos = _x; + } else { + _pos = [_x,5,10,0,0,20,0] call BIS_fnc_findSafePos; + }; + + _emp = [selectRandom blck_staticWeapons,_pos,false] call blck_fnc_spawnVehicle; + diag_log format["_fnc_spawnMissionEmplacedWeapons (33) spawnVehicle returned value of _emp = %1",_emp]; + _emp setVariable["DBD_vehType","emplaced"]; + _emp setPosATL _pos; + [_emp,false] call blck_fnc_configureMissionVehicle; + _gunner = (units _emplacedGroup) select 0; + _gunner moveingunner _emp; + _staticWeap pushback _emp; + diag_log format["_fnc_spawnMissionEmplacedWeapons:: (28) emplaced weapon _wep = %1",_wep]; +}forEach _missionEmplacedWeapons; -_return; \ No newline at end of file +_emplaced = [_staticWeap, _emplacedAI]; + +_emplaced \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf index 0c18fec..f520374 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf @@ -1,46 +1,30 @@ /* - [_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear] call _fnc_spawnMissionVehiclePatrols + [_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionVehiclePatrols by Ghostrider-DbD- - 1/9/17 + 1/22/17 returns [] if no groups could be created returns [_AI_Vehicles,_missionAI] otherwise; */ -params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_uniforms","_headGear"]; -private["_vehGroup","_patrolVehicle","_vehiclePatrolSpawns","_missionAI","_missiongroups","_AI_Vehicles","_abort","_vehiclePatrolSpawns","_randomVehicle","_return"]; +params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_uniforms","_headGear",["_missionType","unspecified"]]; +private["_vehGroup","_patrolVehicle","_vehiclePatrolSpawns","_missionAI","_missiongroups","_vehicles","_return","_vehiclePatrolSpawns","_randomVehicle","_return"]; +_vehicles = []; _missionAI = []; -_missiongroups = []; -_AI_Vehicles = []; -_return = []; -_abort = false; _vehiclePatrolSpawns= [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPositionsAlongARadius; { _vehGroup = [_x,3,3,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; - if (isNull _vehGroup) exitWith {_abort = true;}; - _missiongroups pushback _vehGroup; - _randomVehicle = blck_AIPatrolVehicles call BIS_fnc_selectRandom; - _patrolVehicle = [_coords,_x,_randomVehicle,(_x distance _coords) -5,(_x distance _coords) + 5,_vehGroup] call blck_fnc_spawnVehiclePatrol; - _vehGroup setVariable["groupVehicle",_patrolVehicle,true]; - _AI_Vehicles pushback _patrolVehicle; + //if (isNull _vehGroup) exitWith {_abort = true;}; + if (blck_debugLevel > 0) then {diag_log format["_fnc_spawnMissionVehiclePatrols:: -> _missionType = %3 _vehGroup = %1 and units _vehGroup = %2",_vehGroup, units _vehGroup,_missionType];}; + if (typename (units _vehGroup) isEqualTo "ARRAY") then + { + _randomVehicle = selectRandom blck_AIPatrolVehicles; + _patrolVehicle = [_coords,_x,_randomVehicle,(_x distance _coords) -5,(_x distance _coords) + 5,_vehGroup] call blck_fnc_spawnVehiclePatrol; + //diag_log format["_fnc_spawnMissionVehiclePatrols:: - > patrol vehicle spawned was %1 with type of %2",_patrolVehicle,_randomVehicle]; + _vehicles pushback _patrolVehicle; + _missionAI append units _vehGroup; + //diag_log format["_fnc_spawnMissionVehiclePatrols:: -- > _vehicles updated to %1",_vehicles]; + }; }forEach _vehiclePatrolSpawns; -if (blck_debugLevel > 1) then -{ - diag_log format["[blckeagls] missionSpawner:: Vehicle Patrols Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; -}; -if (_abort) then -{ - {deleteVehicle _x} forEach _AI_Vehicles; - { - {deleteVehicle _x} forEach (units _x); - deleteGroup _x; - } forEach _missiongroups; - -}; -if !(_abort) then -{ - { - _missionAI append (units _x); - }forEach _missiongroups; - _return = [_missionAI,_AI_Vehicles]; -}; +blck_missionVehicles append _vehicles; +_return = [_vehicles,_missionAI]; -_return; \ No newline at end of file +_return \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf index 3f805d9..778e98b 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf @@ -1,7 +1,7 @@ /* spawn a group of objects in random locations aligned with the radial from the center of the region to the object. By Ghostrider-DbD- - Last modified 9-5-2016 + Last modified 1/22/17 copyright 2016 */ @@ -24,5 +24,5 @@ _objects = []; _objects pushback _wreck; sleep 0.1; } forEach _missionLandscape; -diag_log format["_fnc_spawnRandomLandscape::-->> _objects = %1",_objects]; +if (blck_debugLevel > 2) then {diag_log format["_fnc_spawnRandomLandscape::-->> _objects = %1",_objects];}; _objects \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf index c1e4aee..8adab54 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf @@ -2,32 +2,32 @@ Update the parameters for a mission in the list of missions running at that time. Call with the name of the marker associated with the mission and either "Active" or "Completed" by Ghostrider-DbD- - Last modified 1-12-17 + Last modified 1-22-17 */ params["_mission","_status",["_coords",[0,0,0]] ]; if (blck_debugON) then {diag_log format["_fnc_updateMissionQue :: _mission = %1 | _status = %2 | _coords = %3",_mission,_status,_coords];}; -{ - if (_mission isEqualTo (_x select 2)) exitWith - { - private _element = _x; - if (blck_debugON) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions began as %1",blck_pendingMissions];}; - blck_pendingMissions set[_forEachIndex, -1]; - blck_pendingMissions = blck_pendingMissions - [-1]; - if (blck_debugON) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions after deleteing element = %1 resulted in %2",_element,blck_pendingMissions];}; - if (toLower(_status) isEqualTo "active") then { - _element set[6, -1]; - _element set[7,_coords]; - }; - if (toLower(_status) isEqualTo "completed") then - { - private _waitTime = (_element select 4) + random((_element select 5) - (_element select 4)); - _element set[6, _waitTime]; - _element set [7,[0,0,0]]; - }; - if (blck_debugON) then {diag_log format["_fnc_updateMissionQue:: -- >> _element updated to %1",_x,_element];}; - blck_pendingMissions pushback _element; - if (blck_debugON) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions updated to %1",blck_pendingMissions];}; - }; -}forEach blck_pendingMissions; +private["_index","_element","_waitTime"]; + +_index = blck_pendingMissions find _mission; +if (_index > -1) then +{ + if (blck_debuglevel > 0) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions began as %1",blck_pendingMissions];}; + _element = blck_pendingMissions select _index; + if (blck_debuglevel > 0) then {diag_log format["_fnc_updateMissionQue:: -- >> _element before update = %1",_element];}; + if (toLower(_status) isEqualTo "active") then { + _element set[6, -1]; + _element set[7,_coords]; + }; + if (toLower(_status) isEqualTo "inactive") then + { + _waitTime = (_element select 4) + random((_element select 5) - (_element select 4)); + _element set[6, diag_tickTime + _waitTime]; + _element set [7,[0,0,0]]; + }; + if (blck_debuglevel > 0) then {diag_log format["_fnc_updateMissionQue:: -- >> _element after update = %1",_element];}; + blck_pendingMissions set [_index, _element]; + if (blck_debuglevel > 0) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions after update = %1",blck_pendingMissions];}; +}; + diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_missionsDefinitions.hpp b/@epochhive/addons/custom_server/Compiles/Missions/GMS_missionsDefinitions.hpp new file mode 100644 index 0000000..95c13ab --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_missionsDefinitions.hpp @@ -0,0 +1,5 @@ + + +#define GMS_playerInRange 1 +#define GMS_missionTimeOut 2 +#defin GMS_delayTime 0.1 \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/nu-GMS_fnc_objectInRange.sqf b/@epochhive/addons/custom_server/Compiles/Missions/nu-GMS_fnc_objectInRange.sqf new file mode 100644 index 0000000..f38ecc1 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/nu-GMS_fnc_objectInRange.sqf @@ -0,0 +1,23 @@ +////////////////////////////////////////////////////// +// Test whether one object (e.g., a player) is within a certain range of any of an array of other objects +/* + for DBD Clan + By Ghostrider-DBD- + Copyright 2016 + Last modified 1/22/2017 +*/ +///////////////////////////////////////////////////// + + private ["_result"]; + params["_obj1","_objList","_minDist"]; + //_obj1 : player or other object + // _objList : array of objects + //_minDist : distance within which the function would return true; + + _result = false; + + { + if ((_x distance2D _obj1) < _minDist) exitWith {_result = true;}; + } forEach _objList; + diag_log format["objectInRange.sqf: _obj1 = %1, _objList = %2 _minDist = %3 _result = %4",_obj1,_objList,_minDist,_result]; + _result \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/nu-GMS_fnc_spawnMissionEmplacedWeapons.sqf b/@epochhive/addons/custom_server/Compiles/Missions/nu-GMS_fnc_spawnMissionEmplacedWeapons.sqf new file mode 100644 index 0000000..224b6c2 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/nu-GMS_fnc_spawnMissionEmplacedWeapons.sqf @@ -0,0 +1,48 @@ +/* + + [_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnMissionEmplacedWeapons; + +*/ + +params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear",["_missionType","unspecified"]]; +private ["_emplacedGroup","_emplacedAI","_precise","_pos","_emplaced","_emp","_gunner","_staticWeap"]; +_emplacedAI = []; +_staticWeap = []; +if (blck_debugLevel > 0) then {diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons(10):: - >_missionEmplacedWeapons = %2 and _noEmplacedWeapons = %1",_noEmplacedWeapons,_missionEmplacedWeapons];}; + +if ( count _missionEmplacedWeapons isEqualTo 0 ) then +{ + _missionEmplacedWeapons = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius; + _precise = false; + if (blck_debugLevel > 1) then {diag_log "_fnc_spawnMissionEmplacedWeapons:: -->> no spawn points specified, using spawns along a radius"; +}; +diag_log format["_fnc_spawnMissionEmplacedWeapons:: (19) _missionType = %2 _missionEmplacedWeapons updated to %1",_missionEmplacedWeapons,_missionType]; +{ + diag_log format["_fnc_spawnMissionEmplacedWeapons:: (21) spawning group to man emplaced weapon"]; + _emplacedGroup = [_x,1,1,_aiDifficultyLevel,[0,0,0],1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; + diag_log format["_fnc_spawnMissionEmplacedWeapons:: (23) group spawned = %1",_emplacedGroup]; + _emplacedAI append (units _emplacedGroup); + diag_log format["_fnc_spawnMissionEmplacedWeapons:: (24) _emplacedAI updated to = %1",_emplacedAI]; + + diag_log format["_fnc_spawnMissionEmplacedWeapons:: (26) spawning emplaced weapon"]; + if (_precise) then + { + _pos = _x; + } else { + _pos = [_x,5,10,0,0,20,0] call BIS_fnc_findSafePos; + }; + + _emp = [selectRandom blck_staticWeapons,_pos,false] call blck_fnc_spawnVehicle; + diag_log format["_fnc_spawnMissionEmplacedWeapons (33) spawnVehicle returned value of _emp = %1",_emp]; + _emp setVariable["DBD_vehType","emplaced"]; + _emp setPosATL _pos; + [_emp,false] call blck_fnc_configureMissionVehicle; + _gunner = (units _emplacedGroup) select 0; + _gunner moveingunner _emp; + _staticWeap pushback _emp; + diag_log format["_fnc_spawnMissionEmplacedWeapons:: (28) emplaced weapon _wep = %1",_wep]; +}forEach _missionEmplacedWeapons; + +_emplaced = [_staticWeap, _emplacedAI]; + +_emplaced \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_EH_reloadWeapon.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_EH_reloadWeapon.sqf new file mode 100644 index 0000000..07238f3 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_EH_reloadWeapon.sqf @@ -0,0 +1,21 @@ +/* + + + unit: Object - Object the event handler is assigned to. + selectionName: String - Name of the selection where the unit was damaged. "" for over-all structural damage, "?" for unknown selections. + damage: Number - Resulting level of damage for the selection. + source: Object - The source unit that caused the damage. + projectile: String - Classname of the projectile that caused inflicted the damage. ("" for unknown, such as falling damage.) + +(Since Arma 3 v 1.49.131802) + + hitPartIndex: Number - Hit part index of the hit point, -1 otherwise. +*/ + +private ["_unit","_killer","_group","_deleteAI_At"]; +_unit = _this select 0; +_source = _this select 3; + +if (isPlayer _source) then { + [_unit,_source] call GRMS_fnc_alertGroup; +}; diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_EH_unitWeaponReloaded.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_EH_unitWeaponReloaded.sqf new file mode 100644 index 0000000..6021468 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_EH_unitWeaponReloaded.sqf @@ -0,0 +1,23 @@ +/* + + https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/Reloaded + + The EH returns array in _this variable of the following format [entity, weapon, muzzle, newMagazine, (oldMagazine)], where: + + entity: Object - unit or vehicle to which EH is assigned + weapon: String - weapon that got reloaded + muzzle: String - weapons muzzle that got reloaded + newMagazine: Array - new magazine info in format [magazineClass, ammoCount, magazineID, magazineCreator], where: + magazineClass: String - class name of the magazine + ammoCount: Number - amount of ammo in magazine + magazineID: Number - global magazine id + magazineCreator: Number - owner of the magazine creator + +*/ + +private ["_unit","_mag"]; +_unit = _this select 0; +_mag = _this select 3 select 0; +if (blck_debugLevel > 2) then {diag_log format["_EH_unitWeaponReloaded:: unit %1 reloaded weapon %2 with magazine %3",_unit,_this select 1,_mag]; +if (blck_debugLevel > 2) then (diag_log format["_EH_unitWeaponReloaded:: one magazine of type %1 added to inventory of unit %2",_mag,_unit]; +_unit addMagazine _mag; diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_alertNearbyUnits.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_alertNearbyUnits.sqf index f8ecedf..363b0c4 100644 --- a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_alertNearbyUnits.sqf +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_alertNearbyUnits.sqf @@ -13,7 +13,7 @@ _intelligence = _unit getVariable ["intelligence",1]; if (_alertDist > 0) then { //diag_log format["+----+ alerting units close to %1",_unit]; { - if (((position _x) distance (position _unit)) <= _alertDist) then { + if (((position _x) distance2D (position _unit)) <= _alertDist) then { _x reveal [_killer, _intelligence]; //diag_log "Killer revealed"; } diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_cleanupAliveAI.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_cleanupAliveAI.sqf index ef6be0e..2774d7c 100644 --- a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_cleanupAliveAI.sqf +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_cleanupAliveAI.sqf @@ -1,44 +1,14 @@ /* Delete alive AI. - Now called from the main thread which tracks the time elapsed so that we no longer need to wait a proscribed period of time (see changes on lines 9 and 12) + Now called from the main thread which tracks the time elapsed so that we no longer spawn a wait timer for each completed mission. by Ghostrider - Last updated 10/22/16 + Last updated 1/22/17 */ -private["_ai","_veh"]; params["_aiList"]; -//diag_log format["_fnc_cleanupAliveAI:: called with blck_AICleanUpTimer = %1 and count of alive AI = %2",0, count _aiList]; { - //diag_log format["cleanupAliveAI:: for unit _x, alive = %1, GMS_DiedAt = %2",(alive _x), _x getVariable["GMS_DiedAt", -1]]; - if ( alive _x && (_x getVariable["GMS_DiedAt", -1] < 0)) then { // The unit has not been processed by a kill handler. This double test is probably not needed. - _ai = _x; - - if ( vehicle _ai != _ai) then // the AI is in a vehicle of some sort so lets be sure to delete it - { - _veh = vehicle _ai; - //diag_log format["cleanupAliveAI:: deleting vehicle %1",_veh]; - _veh setDamage 1; - deleteVehicle _veh; - }; - - //diag_log format["_fnc_cleanupAliveAI:: _x is %4, typeOf _x %1 typeOf vehicle _x %2, blck_vehicle %3", (typeOf _x), (typeOf (vehicle _x)),_veh,_x]; - { - _ai removeAllEventHandlers _x; - }forEach ["Killed","Fired","HandleDamage","HandleHeal","FiredNear"]; - - { - deleteVehicle _x; - }forEach nearestObjects [getPos _ai,["WeaponHolderSimulated","GroundWeapoonHolder"],3]; - - //_group = group _ai; - [_ai] joinSilent grpNull; - - if (count units group _ai < 1) then - { - deletegroup group _ai; - }; - deleteVehicle _ai; - }; + //if (blck_debugLevel > 2) then {diag_log format["_fnc_cleanupAliveAI:: -> deleteing AI Unit %1",_x];}; + [_x] call blck_fnc_deleteAI; }forEach _aiList; -diag_log format["_fnc_cleanupAliveAI:: AI Cleanup Completed"]; + diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_cleanupDeadAI.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_cleanupDeadAI.sqf index 1a8ff3a..8bd49a7 100644 --- a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_cleanupDeadAI.sqf +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_cleanupDeadAI.sqf @@ -1,28 +1,20 @@ /* Delete Dead AI and nearby weapons after an appropriate period. by Ghostrider - Last updated 10/22/16 + Last updated 1/13/17 */ private["_aiList","_ai"]; -//diag_log format["_fnc_cleanupDeadAI Called"]; -_aiList = blck_deadAI; +_aiList = +blck_deadAI; { - // As written, this ignores any bodies that do not have GMS_DiedAt defined. - - if ( (_x getVariable ["GMS_DiedAt",0]) > 0 ) then + if ( diag_tickTime > _x getVariable ["blck_cleanupAt",0] ) then // DBD_DeleteAITimer { - if ( diag_tickTime > ((_x getVariable ["GMS_DiedAt",0]) + blck_bodyCleanUpTimer) ) then // DBD_DeleteAITimer + _ai = _x; { - _ai = _x; - { - deleteVehicle _x; - }forEach nearestObjects [getPos _x,["WeaponHolder"],3]; - uiSleep 0.1; - //diag_log ["deleting AI %2 at _pos %1",getPos _ai,_ai]; - blck_deadAI = blck_deadAI - [_ai]; - deleteVehicle _ai; - }; + deleteVehicle _x; + }forEach nearestObjects [getPos _ai,["WeaponHolderSimulated","GroundWeapoonHolder"],3]; + blck_deadAI = blck_deadAI - [_ai]; + deleteVehicle _ai; }; } forEach _aiList; diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_deleteAI.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_deleteAI.sqf new file mode 100644 index 0000000..d21ab54 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_deleteAI.sqf @@ -0,0 +1,22 @@ +/* + Delete a unit. + by Ghostrider + Last updated 1/22/17 +*/ + +private["_ai","_group"]; +params["_unit"]; + +//if (blck_debugLevel > 2) then {diag_log format["_fnc_deleteAI::-> deleting unit = %1",_unit];}; + +{ + _unit removeAllEventHandlers _x; +}forEach ["Killed","Fired","HandleDamage","HandleHeal","FiredNear"]; +private _group = (group _unit); +[_unit] joinSilent grpNull; +deleteVehicle _unit; +if (count units _group isEqualTo 0) then +{ + deletegroup _group; +}; + diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf index 0c86833..1c2f786 100644 --- a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf @@ -1,6 +1,6 @@ /* Handle AI Deaths - Last Modified 1/4/17 + Last Modified 1/13/17 By Ghostrider-DBD- Copyright 2016 */ @@ -8,8 +8,7 @@ private["_group","_isLegal","_weapon","_lastkill","_kills","_message","_killstreakMsg"]; params["_unit","_killer","_isLegal"]; -//diag_log format["#- processAIKill.sqf -# called for unit %1",_unit]; -_unit setVariable ["GMS_DiedAt", (diag_tickTime),true]; +_unit setVariable ["blck_cleanupAt", (diag_tickTime) + blck_bodyCleanUpTimer, true]; blck_deadAI pushback _unit; _group = group _unit; diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_processIlleagalAIKills.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_processIlleagalAIKills.sqf index 03fe3c5..53a6e0d 100644 --- a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_processIlleagalAIKills.sqf +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_processIlleagalAIKills.sqf @@ -1,6 +1,6 @@ /* by Ghostrider - 1-4-17 + 1-22-17 */ private["_missionType","_wasRunover","_launcher","_legal"]; @@ -11,17 +11,19 @@ _legal = true; _fn_targetVehicle = { // force AI to fire on the vehicle with launchers if equiped params["_vk","_unit"]; + private { if (((position _x) distance (position _unit)) <= 350) then { _x reveal [_vk, 4]; _x dowatch _vk; _x doTarget _vk; - if (_launcher != "") then + if (_unit getVariable ["Launcher",""] != "") then { _x selectWeapon (secondaryWeapon _unit); - _x fireAtTarget [_vk,_launcher]; + _x fireAtTarget [_vk,_unit getVariable ["Launcher"]]; } else { + _x doTarget _vk; _x doFire _vk; }; }; @@ -31,7 +33,6 @@ _fn_targetVehicle = { // force AI to fire on the vehicle with launchers if equi _fn_applyVehicleDamage = { // apply a bit of damage private["_vd"]; params["_vk"]; - //_vk = _this select 0; _vd = getDammage _vk; _vk setDamage (_vd + blck_RunGearDamage); }; @@ -46,7 +47,6 @@ _fn_msgIED = { params["_killer"]; diag_log format["fn_msgIED:: -- >> msg = %1 and owner _killer = %2",blck_Message, (owner _killer)]; [["IED","",0,0],[_killer]] call blck_fnc_MessagePlayers; - //(owner _killer) publicVariableClient "blck_Message"; }; if (typeOf _killer != typeOf (vehicle _killer)) then // AI was killed by a vehicle diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_removeLaunchers.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_removeLaunchers.sqf index 4414c42..f3acbe8 100644 --- a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_removeLaunchers.sqf +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_removeLaunchers.sqf @@ -1,9 +1,9 @@ /* by Ghostrider - 11-11-16 + 1-22-17 */ -private["_launcher","_launcherRounds","_objects","_weapons","_container"]; +private["_launcher","_launcherRounds"]; params["_unit"]; // = _this select 0; _launcher = _unit getVariable ["Launcher",""]; _unit removeWeapon _Launcher; diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_rewardKiller.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_rewardKiller.sqf index f9ff99b..e684a9a 100644 --- a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_rewardKiller.sqf +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_rewardKiller.sqf @@ -3,13 +3,13 @@ calculate a reward player for AI Kills in crypto. Code fragment adapted from VEMF call as [_unit,_killer] call blck_fnc_rewardKiller; - Last modified 1/4/17 + Last modified 1/22/17 */ params["_unit","_killer","_kills"]; //diag_log format["rewardKiller:: _unit = %1 and _killer %2",_unit,_killer]; -private["_modType","_reward"]; +private["_modType","_reward","_maxReward","_dist","_killstreakReward","_distanceBonus","_newKillerScore","_newKillerFrags","_money"]; _modType = call blck_fnc_getModType; //diag_log format["[blckeagles] rewardKiller:: - _modType = %1",_modType]; @@ -69,4 +69,4 @@ if (_modType isEqualTo "Exile") then [["showScore",[50,_distanceBonus,_kills]], [_killer]] call blck_fnc_messageplayers; }; }; -//_reward + diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit.sqf index f797f34..24644a9 100644 --- a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit.sqf +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit.sqf @@ -2,16 +2,13 @@ Original Code by blckeagls Modified by Ghostrider Logic for adding AI Ammo, GL Shells and Attachments addapted from that by Buttface (A3XAI). - Infinite Ammo fix by Narines. - Code to delete dead AI bodies moved to AIKilled.sqf Everything having to do with spawning and configuring an AI should happen here - Last Modified 11/12/16 + Last Modified 1/22/17 */ //Defines private variables so they don't interfere with other scripts -private ["_pos","_i","_weap","_ammo","_other","_skin","_aiGroup","_ai1","_magazines","_players","_owner","_ownerOnline","_nearEntities","_skillLevel","_aiSkills","_specialItems", - "_Launcher","_launcherRound","_vest","_index","_WeaponAttachments","_Meats","_Drink","_Food","_aiConsumableItems","_weaponList","_ammoChoices","_attachment","_attachments", - "_headGear","_uniforms","_pistols","_specialItems","_noItems"]; +private ["_i","_weap","_skin","_ai1","_skillLevel","_aiSkills", + "_launcherRound","_index","_ammoChoices"]; params["_pos","_weaponList","_aiGroup",["_skillLevel","red"],["_Launcher","none"],["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_underwater",false]]; //_pos = _this select 0; // Position at which to spawn AI @@ -25,7 +22,7 @@ params["_pos","_weaponList","_aiGroup",["_skillLevel","red"],["_Launcher","none" if (isNull _aiGroup) exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnUnit"}; _ai1 = ObjNull; -_modType = call blck_fnc_getModType; +private _modType = call blck_fnc_getModType; if (_modType isEqualTo "Epoch") then { "I_Soldier_EPOCH" createUnit [_pos, _aiGroup, "_ai1 = this", 0.7, "COLONEL"]; @@ -53,8 +50,7 @@ _skin = ""; _counter = 1; while {_skin isEqualTo "" && _counter < 10} do { - _skin = selectRandom _uniforms; // call BIS_fnc_selectRandom; - //_ai1 forceAddUniform _skin; + _skin = selectRandom _uniforms; _ai1 forceAddUniform _skin; _skin = uniform _ai1; //diag_log format["_fnc_spawnUnit::-->> for unit _ai1 % uniform is %2",_ai1, uniform _ai1]; @@ -81,7 +77,6 @@ if (_modType isEqualTo "Epoch") then _ai1 addHeadgear (selectRandom _headGear); // Add a vest to AI for storage -//_vest = selectRandom blck_vests; // call BIS_fnc_selectRandom; _ai1 addVest selectRandom blck_vests; if ( random (1) < blck_chanceBackpack) then @@ -91,28 +86,22 @@ if ( random (1) < blck_chanceBackpack) then }; _weap = selectRandom _weaponList; - +private["_optics","_pointers","_muzzles","_underbarrel","_legalOptics"]; _ai1 addWeaponGlobal _weap; _ammoChoices = getArray (configFile >> "CfgWeapons" >> _weap >> "magazines"); -//_muzzles = getArray (configFile >> "CfgWeapons" >> _weap >> "muzzles"); _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 = []; -{ - if !(_x in blck_blacklistedOptics) then {_legalOptics pushback _x}; -}forEach _optics; -_ammo = selectRandom _ammoChoices; -//diag_log format["[spawnUnit.sqf] _ammo returned as %1",_ammo]; -for "_i" from 2 to (floor(random 3)) do { - _ai1 addMagazine _ammo; -}; -//if (random 1 < 0.3) then {_unit addPrimaryWeaponItem (selectRandom _muzzles)}; -_ai1 addPrimaryWeaponItem (selectRandom _legalOptics); -_ai1 addPrimaryWeaponItem (selectRandom _pointers); -_ai1 addPrimaryWeaponItem (selectRandom _muzzles); -_ai1 addPrimaryWeaponItem (selectRandom _underbarrel); +_legalOptics = _optics - blck_blacklistedOptics; + +_ai1 addMagazines [selectRandom _ammoChoices, 3]; + +if (random 1 < 0.4) then {_ai1 addPrimaryWeaponItem (selectRandom _muzzles)}; +if (random 1 < 0.4) then {_ai1 addPrimaryWeaponItem (selectRandom _legalOptics);}; +if (random 1 < 0.4) then {_ai1 addPrimaryWeaponItem (selectRandom _pointers);}; +if (random 1 < 0.4) then {_ai1 addPrimaryWeaponItem (selectRandom _muzzles);}; +if (random 1 < 0.4) then {_ai1 addPrimaryWeaponItem (selectRandom _underbarrel);}; if ((count(getArray (configFile >> "cfgWeapons" >> _weap >> "muzzles"))) > 1) then { _ai1 addMagazine "1Rnd_HE_Grenade_shell"; }; @@ -121,11 +110,10 @@ _weap = selectRandom blck_Pistols; //diag_log format["[spawnUnit.sqf] _weap os %1",_weap]; _ai1 addWeaponGlobal _weap; _ammoChoices = getArray (configFile >> "CfgWeapons" >> _weap >> "magazines"); -_ai1 addMagazine selectRandom _ammoChoices; +_ai1 addMagazines [selectRandom _ammoChoices, 2]; //add random items to AI. _other = ["ITEM","COUNT"] for "_i" from 1 to (1+floor(random(3))) do { - _i = _i + 1; _ai1 addItem (selectRandom blck_ConsumableItems); }; @@ -160,7 +148,8 @@ else }; // Infinite ammo -_ai1 addeventhandler ["fired", {(_this select 0) setvehicleammo 1;}]; +//_ai1 addeventhandler ["fired", {(_this select 0) setvehicleammo 1;}]; +_ai1 addEventHandler ["reloaded", {_this call compile preprocessfilelinenumbers blck_EH_unitWeaponReloaded;}]; _ai1 addEventHandler ["killed",{ [(_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; }]; //_ai addEventHandler ["HandleDamage",{ [(_this select 0), (_this select 1)] execVM blck_EH_AIHandleDamage;}]; diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_configureMissionVehicle.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_configureMissionVehicle.sqf index 9bd6f9d..b8d77e1 100644 --- a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_configureMissionVehicle.sqf +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_configureMissionVehicle.sqf @@ -1,22 +1,22 @@ // Configures a mission vehicle // by Ghostrider-DBD- -// Last Updated 10/25/16 +// Last Updated 1/22/17 -params["_veh"]; - -clearWeaponCargoGlobal _veh; -clearMagazineCargoGlobal _veh; -clearBackpackCargoGlobal _veh; -clearItemCargoGlobal _veh; +params["_veh",["_clearInventory",true]]; +private["_unit"]; +if (_clearInventory) then +{ + [_veh] call blck_fnc_emptyObject; +}; _veh setVehicleLock "LOCKEDPLAYER"; -_veh addEventHandler ["GetIn",{ +_veh addEventHandler ["GetIn",{ // Note: only fires when vehicle is local to player private["_unit","_veh"]; _unit = _this select 2; _veh = _this select 0; if (isPlayer _unit) then { _unit action ["eject",_veh]; - cutText ["You are not allowed to enter that vehicle at this time","PLAIN DOWN"]; + titleText ["You are not allowed to enter that vehicle at this time","PLAIN DOWN"]; }; }]; diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_decomissionAIVehicle.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_decomissionAIVehicle.sqf index 916d006..0f45022 100644 --- a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_decomissionAIVehicle.sqf +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_decomissionAIVehicle.sqf @@ -1,11 +1,11 @@ // ========================================================================================================= // blckeagls mission system // Author: Ghostrider-DBD- -// Last modified 9-3-16 +// Last modified 1-22-17 // ------------------------------------------------------------------------------------------------------------ // Unused at present, reserved for the future -private ["_ai_veh","_ai_veh_hitsource","_ai_veh_type","_ai_veh_name","_ai_veh_side","_ai_veh_group_side","_ai_veh_hitsource_group_side","_ai_veh_hitsource_type","_ai_veh_hitsource_name","_ai_veh_hitsource_side"]; +private ["_ai_veh","_ai_veh_type","_ai_veh_name"]; //diag_log "Vehicle Decommisioning handler activated"; params["_ai_veh"]; diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_deleteVehicle.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_deleteVehicle.sqf new file mode 100644 index 0000000..20cf378 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_deleteVehicle.sqf @@ -0,0 +1,9 @@ +/* + by Ghostrider-Dbd- + 1/13/17 +*/ +params["_vehicle"]; +{ + _vehicle removeAllEventHandlers _x; +}forEach ["GetIn","GetOut","Killed","Fired","HandleDamage","HandleHeal","FiredNear"]; +deleteVehicle _vehicle; \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnEmplacedWeapon.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnEmplacedWeapon.sqf new file mode 100644 index 0000000..5b8a08c --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnEmplacedWeapon.sqf @@ -0,0 +1,29 @@ +// Spawns an emplaced weapons, man's it, and saves it to an array of monitored vehicles. +// by Ghostrider-DBD- +// Last Updated 1-22-17 +// ["_pos","_emplacedGroup","_emplacedTypes",["_minDist",20],["_maxDist",35],["_precise",false] ] call blck_fnc_spawnEmplacedWeapon; + +private["_emplaced","_safepos","_emp","_gunner"]; +params["_pos","_emplacedGroup","_emplacedTypes",["_minDist",20],["_maxDist",35],["_precise",false], ["_missionType","undefined" ]]; +if (isNull _emplacedGroup) exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnEmplaced"; objNull;}; +diag_log "params[_pos,_emplacedGroup,_emplacedTypes,_minDist,_maxDist,_precise,_missionType]"; +diag_log format["_fnc_spawnEmplacedGroup:: -- >> _this = %1",_this]; +if !(_precise) then +{ + _safepos = [_pos,_minDist,_maxDist,0,0,20,0] call BIS_fnc_findSafePos; +}; +_emplaced = selectRandom _emplacedTypes; +diag_log format["_fnc_spawnEmplacedWeapon:: (14) weapon %1 selected from selection of %2",_emplaced,_emplacedTypes]; +diag_log format["_fnc_spawnEmplacedWeapon:: (15) weapon magazine cargo is %1", magazinesAmmo _emplaced]; +// params["_vehType","_pos",["_clearInventory",true]]; +_emp = [_emplaced,_safepos,false] call blck_fnc_spawnVehicle; +_emp setVariable["DBD_vehType","emplaced"]; +diag_log format["_fnc_spawnEmplacedWeapon:: (17) weapon _%1 spawned at %2 using weapon type %3",_emp,_safepos,_emplaced]; +if (_precise) then {_emp setPosATL _pos]; +_gunner = (units _emplacedGroup) select 0; +_gunner moveingunner _emp; +waitUntil { count crew _emp > 0}; +blck_missionVehicles pushback _emp; +if (blck_debugLevel > 1) then {diag_log format["spawnEmplaced.sqf: (24) _missionType %3 || Emplaced weapon %1 spawned at position %2",_emp,getPosATL _emp,_missionType]; + +_emp diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehicle.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehicle.sqf index 2c08f24..525bb63 100644 --- a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehicle.sqf +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehicle.sqf @@ -2,23 +2,25 @@ Spawn a vehicle and protect it against cleanup by Epoch Returns the object (vehicle) created. By Ghostrider-DBD- - Last modified 10-24-16 + Last modified 1-22-17 */ private["_veh","_modType"]; -params["_vehType","_pos"]; +params["_vehType","_pos",["_clearInventory",true]]; //_vehType = _this select 0; // type of vehicle to be spawned //_pos = _this select 1; // position at which vehicle is to be spawned -//diag_log format["spawnVehicle.sqf: _this = %1",_this]; +if (blck_debugLevel > 2) then {diag_log format["spawnVehicle.sqf: _this = %1",_this];}; _veh = createVehicle[_vehType, _pos, [], 0, "NONE"]; _modType = call blck_fnc_getModType; if (_modType isEqualTo "Epoch") then { //_veh call EPOCH_server_vehicleInit; _veh call EPOCH_server_setVToken; + diag_log format["_fnc_spawnVehicle:: (20) EPOCH_server_setVToken performed for vehicle %1",_veh]; }; -[_veh] call blck_fnc_configureMissionVehicle; - +// params["_veh",["_clearInventory",true]]; +[_veh,_clearInventory] call blck_fnc_configureMissionVehicle; +diag_log format["spawnVehicle:: returning parameter _veh = %1",_veh]; _veh 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 f4de1b8..5d42f0a 100644 --- a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf @@ -1,11 +1,10 @@ -////////////////////////////////////// -// spawn a vehicle, fill it with AI, and give it waypoints around the perimeter of the mission area -// Returns an array _units that contains a list of the units that were spawned and placed in the vehicle - /* By Ghostrider-DBD- Copyright 2016 Last updated 8-14-16 + + spawns a vehicle of _vehType and mans it with units in _group. + returns _veh, the vehicle spawned. */ private["_vehType","_safepos","_veh"]; @@ -21,7 +20,7 @@ diag_log format["_fnc_spawnVehiclePatrol::->> _group = %1",_group]; _safepos = [_pos,0,25,0,0,20,0] call BIS_fnc_findSafePos; _veh = [_vehType,_safepos] call blck_fnc_spawnVehicle; -//diag_log format["spawnVehiclePatrols:: vehicle spawned is %1 of typeof %2",_veh, typeOf _veh]; +diag_log format["spawnVehiclePatrol:: vehicle spawned is %1 of typeof %2",_veh, typeOf _veh]; private["_unitNumber"]; _unitNumber = 0; @@ -40,7 +39,7 @@ while {(count (waypoints _group)) > 0} do { deleteWaypoint ((waypoints _group) select 0); }; -//diag_log format["spawnVehiclePatrols:: vehicle spawned was %1",_veh]; + _count = 5; _start = _center getDir _pos; _angle = _start; @@ -58,7 +57,5 @@ for "_i" from 1 to _count do }; _wp = _group addWaypoint [_pos, 25]; _wp setWaypointType "CYCLE"; -waitUntil { count crew _veh > 0}; -blck_missionVehicles pushback _veh; _veh diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf index 79dc696..943a54f 100644 --- a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf @@ -5,62 +5,82 @@ By Ghostrider-DBD- Copyright 2016 - Last updated 1-17-17 + Last updated 1-22-17 */ -private _vehList = blck_missionVehicles; +private ["_veh","_vehList"]; +_vehList = blck_missionVehicles; +if (blck_debugLevel > 1) then {diag_log format["_fnc_vehicleMonitor:: function called with blck_missionVehicles = %1",_vehList];}; { - private ["_veh"]; _veh = _x; + if (_veh getVariable["blck_DeleteAt",0] > 0) then + { + if (diag_tickTime > (_veh getVariable["blck_DeleteAt",0])) then + { + [_veh] call blck_deleteVehicle; + blck_missionVehicles = blck_missionVehicles - [_veh]; + }; + }; if ({alive _x} count crew _veh < 1) then { if (_veh getVariable["DBD_vehType","none"] isEqualTo "emplaced") then { - [_veh] spawn {uiSleep 1;(_this select 0) setDamage 1;}; - blck_missionVehicles = blck_missionVehicles - [_veh]; - if (blck_debugOn) then{ - diag_log format["_fnc_vehicleMonitor:: deleting emplaced weapon %1",_veh]; + if (blck_debugLevel > 2) then + { + diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh]; }; + _veh setDamage 1; + _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; }else { if (blck_killEmptyAIVehicles) then { - blck_missionVehicles = blck_missionVehicles - [_veh]; - [_veh] spawn { - params["_v"]; - //diag_log format["vehicleMonitor.sqf:: case of patrol vehicle: _veh %1 is about to be killed with getAllHitPointsDamage = %2",_v, (getAllHitPointsDamage _v)]; - uiSleep 20; - { - _v setHitPointDamage [_x, 1]; - //diag_log format["vehicleMonitor: hitpart %1 for vehicle %1 set to 1",_x,_v]; - } forEach ["HitLFWheel","HitLF2Wheel","HitRFWheel","HitRF2Wheel","HitEngine","HitLBWheel","HitLMWheel","HitRBWheel","HitRMWheel","HitTurret","HitGun","HitTurret","HitGun","HitTurret","HitGun","HitTurret","HitGun"]; - if (blck_debugLevel isEqualTo 3) then - { - diag_log format["_fnc_vehicleMonitor:: damage applied to a patrol vehicle -- >> current damage for vehicle %1 is = %2",_v, (getAllHitPointsDamage _v)]; - }; - [_v] spawn { // spawn this so we don't hold up the rest the evaluations and cleanup needed. - private _v = _this select 0; - uiSleep 60; - if (blck_debugOn) then { - diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle:deleting vehicle _veh",_v]; - }; - deleteVehicle _v; - }; - }; + if (blck_debugLevel > ) then + { + diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle destroyed where vehicle = %1",_veh]; + }; + { + _veh setHitPointDamage [_x, 1]; + + } forEach ["HitLFWheel","HitLF2Wheel","HitRFWheel","HitRF2Wheel","HitEngine","HitLBWheel","HitLMWheel","HitRBWheel","HitRMWheel","HitTurret","HitGun","HitTurret","HitGun","HitTurret","HitGun","HitTurret","HitGun"]; + _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; } else { //diag_log format["vehicleMonitor.sqf: make vehicle available to players; stripping eventHandlers from_veh %1",_veh]; blck_missionVehicles = blck_missionVehicles - [_veh]; _veh removealleventhandlers "GetIn"; _veh removealleventhandlers "GetOut"; _veh setVehicleLock "UNLOCKED" ; - if (blck_debugOn) then + _veh setVariable["releasedToPlayers",true]; + [_veh] call blck_fnc_emptyObject; + if (blck_debugLevel > ) then { diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1",_veh]; }; }; }; } else { - _veh setVehicleAmmo 1; - _veh setFuel 1; + private ["_crew","_mag","_allMags","_cnt"]; + //_veh setVehicleAmmo 1; + //_veh setFuel 1; + // https://community.bistudio.com/wiki/fullCrew + // 0 1 2 3 4 + // returns Array - format [[unit,role,cargoIndex,turretPath,personTurret], ...] + //diag_log format["_fnc_vehicleMonitor:: (65) _veh = %1",_veh]; + _crew = fullCrew _veh; + //diag_log format["_fnc_vehicleMonitor:: (67) _crew = %1",_crew]; + { + //diag_log format ["_fnc_vehicleMonitor:: (69) _x = %1",_x]; + _mag = _veh currentMagazineTurret (_x select 3); + if (count _mag > 0) then + { + //diag_log format["_fnc_vehicleMonitor:: (71) _mag is typeName %1", typeName _mag]; + //diag_log format ["_fnc_vehicleMonitor:: (71) length _mag = %2 and _mag = %1",_mag,count _mag]; + _allMags = magazinesAmmo _veh; + //diag_log format["_fnc_vehicleMonitor:: (71) _allMags = %1",_allMags]; + _cnt = ( {_mag isEqualTo (_x select 0)}count _allMags); + //diag_log format["_fnc_vehicleMonitor:: (75) _cnt = %1",_cnt]; + if (_cnt < 2) then {_veh addMagazineCargo [_mag,2]}; + }; + } forEach _crew; }; }forEach _vehList; diff --git a/@epochhive/addons/custom_server/Compiles/blck_functions.sqf b/@epochhive/addons/custom_server/Compiles/blck_functions.sqf index e36b60a..6f9567a 100644 --- a/@epochhive/addons/custom_server/Compiles/blck_functions.sqf +++ b/@epochhive/addons/custom_server/Compiles/blck_functions.sqf @@ -17,21 +17,20 @@ blck_fnc_monitorHC = compileFinal preprocessFileLineNumbers "\q\addons\custom_s blck_fnc_timeAcceleration = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\TimeAccel\GMS_fnc_Time.sqf"; blck_fnc_getModType = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_getModType.sqf"; // Test if Epoch or Exile is loaded blck_fnc_groupsOnAISide = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_GroupsOnAISide.sqf"; // Returns the number of groups on the side used by AI -//blck_fnc_deleteFromArray = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_deleteFromArray.sqf"; - +blck_fnc_emptyObject = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_emptyObject.sqf"; +blck_fnc_playerInRange = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_playerInRange.sqf"; // Player-related functions blck_fnc_rewardKiller = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_rewardKiller.sqf"; blck_fnc_MessagePlayers = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_AIM.sqf"; // Send messages to players regarding Missions //blck_fnc_sendRewardMessage = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_sendRewardMessage.sqf"; // Mission-related functions -blck_fnc_missionStartConditionsMet = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionStartConditionsMet.sqf"; blck_fnc_selectAILoadout = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_selectAILoadout.sqf"; blck_fnc_addMissionToQue = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_addMissionToQue.sqf"; // blck_fnc_updateMissionQue = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_updateMissionQue.sqf"; // blck_fnc_addLiveAItoQue = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_addLiveAItoQue.sqf"; blck_fnc_addObjToQue = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_addObjToQue.sqf"; // -blck_fnc_objectInRange = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_objectInRange.sqf"; +//blck_fnc_objectInRange = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_objectInRange.sqf"; blck_fnc_missionTimer = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionTimer.sqf"; blck_fnc_spawnCrate = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnCrate.sqf"; // Simply spawns a crate of a specified type at a specific position. blck_fnc_spawnMissionCrates = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionCrates.sqf"; @@ -40,6 +39,7 @@ blck_fnc_spawnCompositionObjects = compileFinal preprocessFileLineNumbers "\q\a blck_fnc_spawnRandomLandscape = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnRandomLandscape.sqf"; blck_fnc_spawnMissionVehiclePatrols = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionVehiclePatrols.sqf"; blck_fnc_spawnMissionEmplacedWeapons = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionEmplacedWeapons.sqf"; +blck_fnc_spawnEmplacedWeaponArray = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnEmplacedWeaponArray.sqf"; blck_fnc_spawnMissionAI = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionAI.sqf"; blck_fnc_spawnMissionLootVehicles = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionLootVehicles.sqf"; blck_fnc_spawnMissionHeli = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionHeli.sqf"; @@ -48,11 +48,9 @@ blck_fnc_loadLootItemsFromArray = compileFinal preprocessFileLineNumbers "\q\add blck_fnc_fillBoxes = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_fillBoxes.sqf"; // Adds items to an object according to passed parameters. See the script for details. blck_fnc_smokeAtCrates = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_smokeAtCrates.sqf"; // Spawns a wreck and adds smoke to it blck_fnc_spawnMines = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMines.sqf"; // Deploys mines at random locations around the mission center -blck_fnc_abortMission = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMines.sqf"; -blck_fnc_missionEndConditionsMet = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionEndConditionsMet.sqf"; blck_fnc_clearMines = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_clearMines.sqf"; // clears mines in an array passed as a parameter blck_fnc_signalEnd = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_signalEnd.sqf"; // deploy smoke grenades at loot crates at the end of the mission. -blck_fnc_missionEnd = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionEnd.sqf"; +blck_fnc_endMission = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_endMission.sqf"; // Reinforcement-related functions blck_fnc_callInReinforcements = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Reinforcements\GMS_fnc_callInReinforcements.sqf"; @@ -69,26 +67,29 @@ blck_fnc_setupWaypoints = compileFinal preprocessFileLineNumbers "\q\addons\cus blck_fnc_cleanEmptyGroups = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_cleanEmptyGroups.sqf"; // GMS_fnc_cleanEmptyGroups // Functions specific to vehicles, whether wheeled or static -blck_fnc_spawnEmplacedWeapon = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnEmplaced.sqf"; // Self-evident -blck_fnc_spawnVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnVehicle.sqf"; // Spawn a temporary vehicle of a specified type at a specific position -blck_fnc_spawnVehiclePatrol = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnVehiclePatrol.sqf"; // Spawn an AI vehicle control and have it patrol the mission perimeter +//blck_fnc_spawnEmplacedWeapon = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnEmplacedWeapon.sqf"; +blck_fnc_spawnVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnVehicle.sqf"; +blck_fnc_spawnVehiclePatrol = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_spawnVehiclePatrol.sqf"; blck_fnc_protectVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_protectVehicle.sqf"; blck_fnc_configureMissionVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_configureMissionVehicle.sqf"; -blck_fnc_vehicleMonitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_vehicleMonitor.sqf"; // Checks for vehicles for which all AI are dead and handles any changes needed when this is true. +blck_fnc_vehicleMonitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_vehicleMonitor.sqf"; +//blck_fnc_deleteVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_deleteVehicle.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_unitWeaponReloaded = "\q\addons\custom_server\Compiles\Units\GMS_EH_unitWeaponReloaded.sqf"; //blck_EH_AIHandleDamage = "\q\addons\custom_server\Compiles\Units\GMS_EH_AIHandleDamage.sqf"; // GRMS_EH_AIHandleDamage blck_fnc_processAIKill = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_processAIKill.sqf"; blck_fnc_removeLaunchers = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_removeLaunchers.sqf"; blck_fnc_removeNVG = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_removeNVG.sqf"; blck_fnc_alertNearbyUnits = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_alertNearbyUnits.sqf"; blck_fnc_processIlleagalAIKills = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_processIlleagalAIKills.sqf"; -GMS_fnc_cleanupDeadAI = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_cleanupDeadAI.sqf"; // handles deletion of AI bodies and gear when it is time. +blck_fnc_cleanupDeadAI = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_cleanupDeadAI.sqf"; // handles deletion of AI bodies and gear when it is time. blck_fnc_setSkill = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_setSkill.sqf"; blck_fnc_cleanupAliveAI = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_cleanupAliveAI.sqf"; +blck_fnc_deleteAI = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_deleteAI.sqf"; diag_log "[blckeagls] Functions Loaded"; blck_functionsCompiled = true; diff --git a/@epochhive/addons/custom_server/Compiles/blck_variables.sqf b/@epochhive/addons/custom_server/Compiles/blck_variables.sqf index 032db5a..285c5cb 100644 --- a/@epochhive/addons/custom_server/Compiles/blck_variables.sqf +++ b/@epochhive/addons/custom_server/Compiles/blck_variables.sqf @@ -31,6 +31,6 @@ DBD_HeliCrashSites = []; // radius within whih missions are triggered. The trigger causes the crate and AI to spawn. blck_TriggerDistance = 1000; blck_mainThreadUpdateInterval = 60; -blck_missionSpawning = false; +//blck_missionSpawning = false; diag_log "[blckeagls] Variables Loaded"; blck_variablesLoaded = true; diff --git a/@epochhive/addons/custom_server/Configs/blck_configs_epoch.sqf b/@epochhive/addons/custom_server/Configs/blck_configs_epoch.sqf index 750c7d7..dc9539d 100644 --- a/@epochhive/addons/custom_server/Configs/blck_configs_epoch.sqf +++ b/@epochhive/addons/custom_server/Configs/blck_configs_epoch.sqf @@ -159,7 +159,7 @@ Last modified 8/1/15 blck_bodyCleanUpTimer = 1200; // time in seconds after which dead AI bodies are deleted // Each time an AI is killed, the location of the killer will be revealed to all AI within this range of the killed AI, set to -1 to disable // values are ordered as follows [blue, red, green, orange]; - blck_AliveAICleanUpTime = 900; // Time after mission completion at which any remaining live AI are deleted. + blck_AliveAICleanUpTimer = 900; // Time after mission completion at which any remaining live AI are deleted. blck_cleanupCompositionTimer = 1200; blck_AIAlertDistance = [250,325,450,500]; //blck_AIAlertDistance = [150,225,400,500]; diff --git a/@epochhive/addons/custom_server/Configs/blck_configs_exile.sqf b/@epochhive/addons/custom_server/Configs/blck_configs_exile.sqf index 1e387dd..71eb155 100644 --- a/@epochhive/addons/custom_server/Configs/blck_configs_exile.sqf +++ b/@epochhive/addons/custom_server/Configs/blck_configs_exile.sqf @@ -157,7 +157,7 @@ Last modified 8/1/15 blck_bodyCleanUpTimer = 1200; // time in seconds after which dead AI bodies are deleted // Each time an AI is killed, the location of the killer will be revealed to all AI within this range of the killed AI, set to -1 to disable // values are ordered as follows [blue, red, green, orange]; - blck_AliveAICleanUpTime = 900; // Time after mission completion at which any remaining live AI are deleted. + blck_AliveAICleanUpTimer = 900; // Time after mission completion at which any remaining live AI are deleted. blck_cleanupCompositionTimer = 1200; blck_AIAlertDistance = [150,225,250,300]; //blck_AIAlertDistance = [150,225,400,500]; diff --git a/@epochhive/addons/custom_server/Configs/blck_custom_config.sqf b/@epochhive/addons/custom_server/Configs/blck_custom_config.sqf index 9d0d59d..1fc0611 100644 --- a/@epochhive/addons/custom_server/Configs/blck_custom_config.sqf +++ b/@epochhive/addons/custom_server/Configs/blck_custom_config.sqf @@ -24,19 +24,19 @@ if (blck_debugON) then // Used primarily for debugging. diag_log "[blckeagls] Debug seting is ON, Custom configurations used"; - blck_mainThreadUpdateInterval = 10; + //blck_mainThreadUpdateInterval = 10; blck_enableOrangeMissions = -1; blck_enableGreenMissions = -1; - blck_enableRedMissions = 1; + blck_enableRedMissions = -1; blck_enableBlueMissions = 1; blck_cleanupCompositionTimer = 10; // Time after mission completion at which items in the composition are deleted. - blck_AliveAICleanUpTime = 10; // Time after mission completion at which any remaining live AI are deleted. + blck_AliveAICleanUpTimer = 10; // Time after mission completion at which any remaining live AI are deleted. blck_bodyCleanUpTimer = 10; - blck_SpawnEmplaced_Orange = 4; // Number of static weapons at Orange Missions - blck_SpawnEmplaced_Green = 3; // Number of static weapons at Green Missions + blck_SpawnEmplaced_Orange = 0; // Number of static weapons at Orange Missions + blck_SpawnEmplaced_Green = 0; // Number of static weapons at Green Missions blck_SpawnEmplaced_Blue = 1; // Number of static weapons at Blue Missions blck_SpawnEmplaced_Red = 2; @@ -59,16 +59,17 @@ if (blck_debugON) then blck_TMax_Green = 38; blck_TMax_Orange = 31; - blck_reinforceBlue = [0.999, 2, 0.001]; - //blck_MissionTimout = 120; // 40 min + //blck_reinforceBlue = [0.999, 2, 0.001]; + //blck_MissionTimout = 60; // 40 min + blck_SkillsBlue = [ - ["aimingAccuracy",0.01], - ["aimingShake",0.01], - ["aimingSpeed",0.01], - ["endurance",0.01], - ["spotDistance",0.01], - ["spotTime",0.01], - ["courage",0.01], + ["aimingAccuracy",0.1], + ["aimingShake",0.3], + ["aimingSpeed",0.5], + ["endurance",0.5], + ["spotDistance",0.7], + ["spotTime",0.7], + ["courage",0.7], ["reloadSpeed",0.80], ["commanding",0.8], ["general",1.00] diff --git a/@epochhive/addons/custom_server/KnownIssues.txt b/@epochhive/addons/custom_server/KnownIssues.txt new file mode 100644 index 0000000..4f3483c --- /dev/null +++ b/@epochhive/addons/custom_server/KnownIssues.txt @@ -0,0 +1,9 @@ + + +Known issues + +1. Missions sometimes are not triggered by players. +2. Missions are sometimes not completed even when completion criteria are met. +3. Infinite ammo is not working for at least some weapons. Probable cause is the arma engine as server logs show multiple errors related to weapons not being found. + This impacts both vehicle-mounted weapons and AI weapons. +4. Emplaced weapons are not spawning correctly. \ No newline at end of file diff --git a/@epochhive/addons/custom_server/changeLog.sqf b/@epochhive/addons/custom_server/changeLog.sqf index 5acc75d..a4c5a44 100644 --- a/@epochhive/addons/custom_server/changeLog.sqf +++ b/@epochhive/addons/custom_server/changeLog.sqf @@ -1,9 +1,36 @@ /* blck Mission system by Ghostrider-DBD- Loosely based on the AI mission system by blckeagls ver 2.0.2 -Contributions by Narines: bug fixes, testing, 'fired' event handler +Contributions by Narines: bug fixes, testing, infinite ammo fix. Ideas or code from that by Vampire and KiloSwiss have been used for certain functions. +1/22/17 Version 6.54 build 32 +Changed code to test for conditions that trigger to spawn mission objects and AI completely +Rewrote the code for spawning emplaced weapons from scratch. + +1/22/17 Version 6.54 build 30 +Fixed an error in how the waitTime till a mission was respawned after being updated to inactive status. +Added additional reporting as to the mission type for which AI, statics and vehicle patrols are being spawned. +Continued switching from blck_debugOn to blck_debugLevel. +Continued work to move much of the code from GMS_fnc_missionSpawner to precompiled functions. + - tested and working for all but the emplaced weapons module. +Removed old code that had been commented out from GMS_missionSpawner. +deactivated the 'fired' event handler +added an 'reloaded' event handler to units that adds a magazin of the type used to reload the weapon to prevent units running out of ammo. this also provides a break in firing and is more realistic. +Added a check to GMS_fnc_vehicleMonitor that addes ammo to vehicle cargo when stores are low. Removed the infinite ammo script for static and vehicle weapons, again for greater realism. +Increased number of rounds of ammo added to AI units for primary and secondary weapons. +Tweaked code in GMS_fnc_spawnUnit to increase efficiency. +Attempted a fix for occaisional issues with missions not triggering or ending by changing from distance to distance2D. +Tweaked code for deleting dead AI to also delete any weapons containers nearby. +Checked throughout for potential scope issues; ensured all private variables were declared as such. +Changed the method by which mission patrol vehicles and static weapons are deleted at the end of a mission. + +1/21/17 Build 29. +Went back to the timerless system for spawning missions. +Improved code for updating the array of pending/active missions + GMS_fnc_updateMissionQue.sqf re-written to take greater advantage of existing array commands: set and find. +Ensured that the array used to store the location(s) of active or recent missions is properly updated. + 1/13/17 Version 6.54 Build 27 Rerverted back to the code that spawned a single instance of each mission until I can debug certain issues. diff --git a/@epochhive/addons/custom_server/init/blck_init.sqf b/@epochhive/addons/custom_server/init/blck_init.sqf index 0cd4325..0439e3f 100644 --- a/@epochhive/addons/custom_server/init/blck_init.sqf +++ b/@epochhive/addons/custom_server/init/blck_init.sqf @@ -94,23 +94,23 @@ blck_spawnStaticLootCrates = nil; //Start the mission timers if (blck_enableOrangeMissions > 0) then { - [_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange] spawn blck_fnc_missionTimer;//Starts major mission system (Orange Map Markers) - //[_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange,blck_enableOrangeMissions] call blck_fnc_addMissionToQue; + //[_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange] spawn blck_fnc_missionTimer;//Starts major mission system (Orange Map Markers) + [_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange,blck_enableOrangeMissions] call blck_fnc_addMissionToQue; }; if (blck_enableGreenMissions > 0) then { - [_missionListGreen,_pathGreen,"GreenMarker","green",blck_TMin_Green,blck_TMax_Green] spawn blck_fnc_missionTimer;//Starts major mission system 2 (Green Map Markers) - //[_missionListGreen,_pathGreen,"GreenMarker","green",blck_TMin_Green,blck_TMax_Green,blck_enableGreenMissions] call blck_fnc_addMissionToQue; + //[_missionListGreen,_pathGreen,"GreenMarker","green",blck_TMin_Green,blck_TMax_Green] spawn blck_fnc_missionTimer;//Starts major mission system 2 (Green Map Markers) + [_missionListGreen,_pathGreen,"GreenMarker","green",blck_TMin_Green,blck_TMax_Green,blck_enableGreenMissions] call blck_fnc_addMissionToQue; }; if (blck_enableRedMissions > 0) then { - [_missionListRed,_pathRed,"RedMarker","red",blck_TMin_Red,blck_TMax_Red] spawn blck_fnc_missionTimer;//Starts minor mission system (Red Map Markers)//Starts minor mission system 2 (Red Map Markers) - //[_missionListRed,_pathRed,"RedMarker","red",blck_TMin_Red,blck_TMax_Red,blck_enableRedMissions] call blck_fnc_addMissionToQue; + //[_missionListRed,_pathRed,"RedMarker","red",blck_TMin_Red,blck_TMax_Red] spawn blck_fnc_missionTimer;//Starts minor mission system (Red Map Markers)//Starts minor mission system 2 (Red Map Markers) + [_missionListRed,_pathRed,"RedMarker","red",blck_TMin_Red,blck_TMax_Red,blck_enableRedMissions] call blck_fnc_addMissionToQue; }; if (blck_enableBlueMissions > 0) then { - [_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue] spawn blck_fnc_missionTimer;//Starts minor mission system (Blue Map Markers) - //[_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue,blck_enableBlueMissions] call blck_fnc_addMissionToQue; + //[_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue] spawn blck_fnc_missionTimer;//Starts minor mission system (Blue Map Markers) + [_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue,blck_enableBlueMissions] call blck_fnc_addMissionToQue; }; // start the main thread for the mission system which monitors missions running and stuff to be cleaned up diff --git a/@epochhive/addons/custom_server/init/build.sqf b/@epochhive/addons/custom_server/init/build.sqf index b6561cf..872e508 100644 --- a/@epochhive/addons/custom_server/init/build.sqf +++ b/@epochhive/addons/custom_server/init/build.sqf @@ -1,3 +1,4 @@ private ["_version","_versionDate"]; -_blck_version = "6.54 Build 28"; -_blck_versionDate = "1-13-17 10:00 PM"; +_blck_version = "6.54 Build 32"; +_blck_versionDate = "1-22-17 8:00 PM"; + diff --git a/changeLog.sqf b/changeLog.sqf index 3934917..f220718 100644 --- a/changeLog.sqf +++ b/changeLog.sqf @@ -1,9 +1,49 @@ /* blck Mission system by Ghostrider-DBD- Loosely based on the AI mission system by blckeagls ver 2.0.2 -Contributions by Narines: bug fixes, testing, 'fired' event handler +Contributions by Narines: bug fixes, testing, infinite ammo fix. Ideas or code from that by Vampire and KiloSwiss have been used for certain functions. +1/22/17 Version 6.54 build 32 +Changed code to test for conditions that trigger to spawn mission objects and AI completely +Rewrote the code for spawning emplaced weapons from scratch. +Fixed an error in how the waitTime till a mission was respawned after being updated to inactive status. +Added additional reporting as to the mission type for which AI, statics and vehicle patrols are being spawned. +Continued switching from blck_debugOn to blck_debugLevel. +Continued work to move much of the code from GMS_fnc_missionSpawner to precompiled functions. + - tested and working for all but the emplaced weapons module. +Removed old code that had been commented out from GMS_missionSpawner. +deactivated the 'fired' event handler +added an 'reloaded' event handler to units that adds a magazin of the type used to reload the weapon to prevent units running out of ammo. this also provides a break in firing and is more realistic. +Added a check to GMS_fnc_vehicleMonitor that addes ammo to vehicle cargo when stores are low. Removed the infinite ammo script for static and vehicle weapons, again for greater realism. +Increased number of rounds of ammo added to AI units for primary and secondary weapons. +Tweaked code in GMS_fnc_spawnUnit to increase efficiency. +Attempted a fix for occaisional issues with missions not triggering or ending by changing from distance to distance2D. +Tweaked code for deleting dead AI to also delete any weapons containers nearby. +Checked throughout for potential scope issues; ensured all private variables were declared as such. +Changed the method by which mission patrol vehicles and static weapons are deleted at the end of a mission. + +1/21/17 Build 29. +Went back to the timerless system for spawning missions. +Improved code for updating the array of pending/active missions + GMS_fnc_updateMissionQue.sqf re-written to take greater advantage of existing array commands: set and find. +Ensured that the array used to store the location(s) of active or recent missions is properly updated. + +1/13/17 Version 6.54 Build 27 +Rerverted back to the code that spawned a single instance of each mission until I can debug certain issues. + +1/7/17 Version 6.53 Build 24 +Added a setting blck_baseSkill = 0.7; // This defines the base skil of AI. Increase it to make AI more challenging. +Tweaked AI difficulty settings to make missions more difficult. +changed - GMS_EH_unitKilled - the event handler now uses precompiled rather than compiled on the fly code. +changed - several other minor performance tweaks were made server side. +changed - small changes were made the the loop in blck_client.sqf +Tweaked debugging information to reduced unnecessary logging when not in debug-mode. +Disabled the loop sending server fps client-side +fixed - GMS_fnc_updateMissionQue was not correctly updating mission information after mission completion. +fixed - GMS_fnc_mainThread was not deleted old AI and Vehicles from the arrays used to capture them after mission completion. +changed - calls to GMS_fnc_vehicleMonitor were moved inside the main loop. + 1/3/17 Version 6.51 Build 23 Moved configuration for the client from debug\blckclient.sqf to debug\blckconfig.sqf. Added a setting blck_useKillMessages = true/false; (line 60 of the config. when true, kill messages will be send to all players when a player kills an AI. The style of the message is controlled client-side (debug\blck_config.sqf)