diff --git a/@epochhive/addons/custom_server.pbo b/@epochhive/addons/custom_server.pbo new file mode 100644 index 0000000..a984799 Binary files /dev/null and b/@epochhive/addons/custom_server.pbo differ diff --git a/@epochhive/addons/custom_server/Compiles/CustomMarkers/CustomMarkers_Epoch.sqf b/@epochhive/addons/custom_server/Compiles/CustomMarkers/CustomMarkers_Epoch.sqf new file mode 100644 index 0000000..3cd267a --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/CustomMarkers/CustomMarkers_Epoch.sqf @@ -0,0 +1,44 @@ + +//blck_customMarkers = []; + +private _markers = [ + [31086.898,0,29440.51],"ServerRule","Server Rules:","mil_triangle","ColorRed"], + [[31143.064,0,28674.146],"ServerRule1","No PVP","mil_dot","ColorWhite"], + [[31136.533,0,27647.641],"ServerRule2","No THEFT from dead players, bases or unlocked vehicles.","mil_dot","ColorWhite"], + [[31129.488,0,25672.701],"ServerRule3","Don't go to players bases. Not to look, not hang around.","mil_dot","ColorWhite"], + [[31136.486,20.089996,26683.422],"ServerRule4","Racism, hacking, glitching, duping or theft will result in a ban.","mil_dot","ColorWhite"], + [[31137.244,5.0910034,24665.658],"ServerRule5","Please be respectful of other players and admins. What an Admin says is final.","mil_dot","ColorWhite"], + [[31140.377,28.001938,23660.883],"ServerRule6","Don't leave vehicles at the traders. These will be unlocked at restarts.","mil_dot","ColorWhite"], + [[93.216553,5.6385589e+013,-577.87292],"MissionsRule","Mission Rules:","mil_triangle","ColorRed"], + [[63.282959,5.6385589e+013,-1236.0565],"MissionRule1","Call missions in side chat and place a marker on the map with your name at the location of the mission you are headed to.","mil_dot","ColorWhite"], + [[58.716553,0,-2213.2051],"MissionRule2","You call the mission when you are on the way to it, not when you are going to do something else.","mil_dot","ColorWhite"], + [[52.185303,0,-3239.7109],"MissionRule3","Don't go to other players missions, you have nothing there to do.","mil_dot","ColorWhite"], + [[45.140381,0,-5214.6504],"MissionRule4","First to call out the mission owns it, thats includes AI gear and mission loot. (If you haven't marked and called it out, you will loose if someone do that.)","mil_dot","ColorWhite"]; + [[52.138428,0,-4203.9287],"MissionRule5","You/Your group can only call one mission at time.","mil_dot","ColorWhite"], + [[52.89624,0,-6221.6934],"MissionRule6","You don't need to call a out a mission if it is in the PVP zone. But if you are doing it from the outside of pvp zone, you will still be a target for PVP.","mil_dot","ColorWhite"], + [[56.029053,7.7267151,-7226.4678],"MissionRule7","Mission that spawns inside or if the mission marker touches the pvp marker will be marked as pvp.","mil_dot","ColorWhite"], + [[-12477.028,0,38781.328],"BuildingsRules","Buildings Rules:","mil_triangle","ColorRed"], + [[{-12420.862,0,38014.969],"BuildingsRules1","Do not build in pre-buildings.","mil_dot","ColorWhite"], + [[-12427.394,0,36988.461],"BuildingsRules2","Do not build on or so as to block roads.","mil_dot","ColorWhite"], + [[-12434.438,2.7021473e+037,35013.523],"BuildingsRules3","When you build, look around and see if your flag will effect any loot spawning. Your flag has a 150m radius, so to be on the safe side build at least 175-200m from loot spawns.","mil_dot","ColorWhite"], + [[-12427.44,0,36024.242],"BuildingsRules4","Do not build in or near high loot areas such as office buildings, airport hangers, or military installations. Flag poles block loot from spawning at these locations.","mil_dot","ColorWhite"], + [[-12426.683,0,34006.477]],"BuildingsRules5","Do not build and sniperbases near mafia places, stronghold. (They are not your personal mission.)","mil_dot","ColorWhite"], + [[-12423.55,0,33001.707,"BuildingsRules6","No air bases. Your base has to touch the ground.","mil_dot","ColorWhite"], + [[-12419.35,0,32066.854],"BuildingsRules7","Admin will delete bases that are breaking these rules, and you will get nothing back.","mil_dot","ColorWhite"], + [[24.283001,-4.3682598e-035,-8286.0889],"PVPZonesRule","PVP Zones Rules:","mil_triangle","ColorYellow"], + [[80.448997,5.0616355e+037,-9052.4521],"PVPZonesRule1","Any things goes.","mil_dot","ColorWhite"], + [[73.917999,-1.3038923e-012,-10078.958,"PVPZonesRule2","You can't be running around just outside the pvp zone and call pve if you get shoot, if you are there, you are a target.","mil_dot","ColorWhite"], + [[66.873001,-6.6600447e-037,-12053.896],"PVPZonesRule3","Mission that spawns inside or if the mission marker touches the pvp marker will be marked as pvp.","mil_dot","ColorWhite"], + [[73.871002,-7.911346e-021,-11043.177],"PVPZonesRule4","If anyone of your team/group is in the pvpzone and you are near it you will consider a legite target.","mil_dot","ColorWhite"], + [[-12857.771,4.3924521e+035,45162.469],,"Good to know:","mil_triangle","ColorOrange"], + [[-12801.605,0,44396.109],"GoodToKnow1","If you building or park your vehicles where missions spawns, be preper to login to a place where your vehicle are gone. As AI and player will have battles there.","mil_dot","ColorWhite"], + [[-12808.137,0,43369.598],"GoodToKnow2","ArmA is a glitchy game. Don't park vehicles on floors/roofs. It may work 1 server session but go boom the next. And they will not be replaced by Admins.","mil_dot","ColorWhite"], + [[12815.182,23135064,41394.66],"GoodToKnow3","What you do will effect your whole group. What your friends do will effect you. It's your job to look after your friends.","mil_dot","ColorWhite"], + [[-12808.184,0,42405.379],"GoodToKnow4","If you gone park your vehicle inside your base, make sure your base is big enough to hold them in there.","mil_dot",,"ColorWhite"], + [[-12833.245,-2.2216157e-031,40349.613],"GoodToKnow5","Use commen sense. Ask your self, would I like this happen too me?","mil_dot","ColorWhite"], + [[-12848.92,-1.4167476e-034,39791.008],"GoodToKnow6","ON EPOCH: Don't hord vehicles, 1 air, 2 land per player. Admin will delete them if think your breaking the limit.","mil_dot","ColorWhite"] +]; + +{ + _x call blck_fnc_addcustomMarker; +}forEach _markers; \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/CustomMarkers/CustomMarkers_Exile.sqf b/@epochhive/addons/custom_server/Compiles/CustomMarkers/CustomMarkers_Exile.sqf new file mode 100644 index 0000000..c4cf243 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/CustomMarkers/CustomMarkers_Exile.sqf @@ -0,0 +1,18 @@ + +blck_customMarkers = []; +blck_fnc_addCustomMarker = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\CustomMarkers\GMS_fnc_addCustomMarkers.sqf"; +if (!isServer) exitWith{}; +_modType = call blck_fnc_getModType; +if (_modType isEqualTo "Epoch") then +{ + [] execVM "\q\addons\custom_server\Compiles\CustomMarkers\CustomMarkers_Epoch.sqf"; +}; + +if (_modType isEqualTo "Exile") then +{ + [] execVM "\q\addons\custom_server\Compiles\CustomMarkers\CustomMarkers_Exile.sqf"; +}; + +{ + +}forEach blck_customMarkers; diff --git a/@epochhive/addons/custom_server/Compiles/CustomMarkers/CustomMarkers_Exile.sqf.bak b/@epochhive/addons/custom_server/Compiles/CustomMarkers/CustomMarkers_Exile.sqf.bak new file mode 100644 index 0000000..f65ae26 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/CustomMarkers/CustomMarkers_Exile.sqf.bak @@ -0,0 +1,18 @@ + +blck_customMarkers = []; +blck_fnc_addCustomMarker = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\CustomMarkers\GMS_fnc_addCustomMarkers.sqf"; +if (!isServer) exitWith{}; +_modType = call blck_getModType; +if (_modType isEqualTo "Epoch") then +{ + [] execVM "\q\addons\custom_server\Compiles\CustomMarkers\CustomMarkers_Epoch.sqf"; +}; + +if (_modType isEqualTo "Exile") then +{ + [] execVM "\q\addons\custom_server\Compiles\CustomMarkers\CustomMarkers_Exile.sqf"; +}; + +{ + +}forEach blck_customMarkers; diff --git a/@epochhive/addons/custom_server/Compiles/CustomMarkers/GMS_fnc_addCustomMarker.sqf b/@epochhive/addons/custom_server/Compiles/CustomMarkers/GMS_fnc_addCustomMarker.sqf new file mode 100644 index 0000000..990a0c0 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/CustomMarkers/GMS_fnc_addCustomMarker.sqf @@ -0,0 +1,20 @@ + +/* +GMS_fnc_addCustomMarker.sqf +adds a custom marker to the array of custom markers that should be shown. +*/ + +params["_marker"]; +_type = []; +if (typeName _marker select 3 isEqualTo "STRING") then {_type = [_marker select 3,[],""]}; +if (typeName _marker select 3 isEqualTo "ARRAY" and count (_marker select 3) isEqualTo 3) then {_type = _marker select 3}; +private _m = [format["cm%1%2",_marker select 0 select 0,_marker select 0 select 1],_marker select 0,_marker select 1,_marker select 2,"",_marker select 4,_type]; +diag_log format["customMarkers_Epoch.sqf:: _m = %1",_m]; +if !(_type isEqualTo []) then +{ + blck_customMarkers pushback _m; +}; + +true + + diff --git a/@epochhive/addons/custom_server/Compiles/CustomMarkers/init_CustomMarkers.sqf b/@epochhive/addons/custom_server/Compiles/CustomMarkers/init_CustomMarkers.sqf new file mode 100644 index 0000000..09f5bb9 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/CustomMarkers/init_CustomMarkers.sqf @@ -0,0 +1,31 @@ +diag_log "-- >> Loading Custom Markers for blckeagls Mission System"; + +blck_customMarkers = []; +blck_fnc_addCustomMarker = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\CustomMarkers\GMS_fnc_addCustomMarker.sqf"; + +if (!isServer) exitWith{}; + +_modType = call blck_fnc_getModType; +if (_modType isEqualTo "Epoch") then +{ + [] execVM "\q\addons\custom_server\Compiles\CustomMarkers\CustomMarkers_Epoch.sqf"; +}; + +if (_modType isEqualTo "Exile") then +{ + //[] execVM "\q\addons\custom_server\Compiles\CustomMarkers\CustomMarkers_Exile.sqf"; +}; + +{ + /* + for spawnMarker.sqf parameters are: + _mArray params["_missionType","_markerPos","_markerLabel","_markerLabelType","_markerColor","_markerType"]; + _markerType params["_mShape","_mSize","_mBrush"]; + */ + // [31086.898,0,29440.51],"ServerRule","Server Rules:","mil_triangle","ColorRed"], + if (blck_debugON) then {diag_log format["[blckeagls] custom markers:: -- >> Adding marker %1",_x];}; + private _markerDefinitions = [_x select 1,_x select 0,_x select 2,"",_x select 4,_x select 3]; + [_markerDefinitions] execVM "debug\spawnMarker.sqf"; +}forEach blck_customMarkers; + +diag_log "[blckeagls] -- >> Custom Markers Loaded"; diff --git a/@epochhive/addons/custom_server/Compiles/CustomMarkers/init_CustomMarkers.sqf.bak b/@epochhive/addons/custom_server/Compiles/CustomMarkers/init_CustomMarkers.sqf.bak new file mode 100644 index 0000000..48e7cfe --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/CustomMarkers/init_CustomMarkers.sqf.bak @@ -0,0 +1,31 @@ +diag_log "-- >> Loading Custom Markers for blckeagls Mission System"; + +blck_customMarkers = []; +blck_fnc_addCustomMarker = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\CustomMarkers\GMS_fnc_addCustomMarker.sqf"; + +if (!isServer) exitWith{}; + +_modType = call blck_getModType; +if (_modType isEqualTo "Epoch") then +{ + [] execVM "\q\addons\custom_server\Compiles\CustomMarkers\CustomMarkers_Epoch.sqf"; +}; + +if (_modType isEqualTo "Exile") then +{ + //[] execVM "\q\addons\custom_server\Compiles\CustomMarkers\CustomMarkers_Exile.sqf"; +}; + +{ + /* + for spawnMarker.sqf parameters are: + _mArray params["_missionType","_markerPos","_markerLabel","_markerLabelType","_markerColor","_markerType"]; + _markerType params["_mShape","_mSize","_mBrush"]; + */ + // [31086.898,0,29440.51],"ServerRule","Server Rules:","mil_triangle","ColorRed"], + if (blck_debugON) then {diag_log format["[blckeagls] custom markers:: -- >> Adding marker %1",_x];}; + private _markerDefinitions = [_x select 1,_x select 0,_x select 2,"",_x select 4,_x select 3]; + [_markerDefinitions] execVM "debug\spawnMarker.sqf"; +}forEach blck_customMarkers; + +diag_log "[blckeagls] -- >> Custom Markers Loaded"; \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_GroupsOnAISide.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_GroupsOnAISide.sqf new file mode 100644 index 0000000..722ec44 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_GroupsOnAISide.sqf @@ -0,0 +1,15 @@ +/* + Determines the total number of spawned groups on the side used by the mission system and returns this value. + By Ghostrider-DbD- + Last updated 12/21/16 +*/ + +private _Groups_AI_Side = 0; + +{ + if ( (side _x) isEqualTo blck_AI_Side) then {_Groups_AI_Side = _Groups_AI_Side + 1;}; +}forEach allGroups; +//diag_log format["_fnc_groupsOnAISide:: -- >> allGroups = %1 | _Groups_AI_Side = %2",allGroups, _Groups_AI_Side]; + +// Return the number of groups used. +_Groups_AI_Side 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 411d83c..d4048fa 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_cleanEmptyGroups.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_cleanEmptyGroups.sqf @@ -4,13 +4,15 @@ By Ghostrider-DbD- 11/16/16 */ -if (true) then +if (blck_debugON) 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]; }; { //diag_log format["_fnc_cleanEmptyGroups:: - >> type of object _x = %1",typeName _x]; if ((count units _x) isEqualTo 0) then {deleteGroup _x}; }forEach allGroups; +diag_log "_fnc_cleanEmptyGroups:: -- >> exiting function"; diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_findWorld.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_findWorld.sqf index 688492c..cbe2dc6 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_findWorld.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_findWorld.sqf @@ -8,14 +8,11 @@ private["_blck_WorldName"]; _blck_WorldName = toLower format ["%1", worldName]; _blck_worldSize = worldSize; -private["_modType"]; -_modType = [] call blck_fnc_getModType; -diag_log format["[blckeagls] Loading Map-specific settings with worldName = %1 and modType = %2",_blck_WorldName,_modType]; +diag_log format["[blckeagls] Loading Map-specific settings with worldName = %1",_blck_WorldName]; -if (_modType isEqualTo "Epoch") then -{ - switch (_blck_WorldName) do {// These may need some adjustment - including a test for shore or water should help as well to avoid missions spawning on water. +switch (_blck_WorldName) do +{// These may need some adjustment - including a test for shore or water should help as well to avoid missions spawning on water. case "altis":{ diag_log "[blckeagls] Altis-specific settings for Epoch loaded"; blck_mapCenter = [6322,7801,0]; @@ -39,14 +36,14 @@ if (_modType isEqualTo "Epoch") then }; case "esseker":{ diag_log "Esseker-specific settings loaded"; - blck_mapCenter = [6144, 6144, 0]; //centerPosition = {7100, 7750, 300}; - blck_mapRange = 5300; + blck_mapCenter = [6049.26,6239.63,0]; //centerPosition = {7100, 7750, 300}; + blck_mapRange = 6000; }; case "taviana":{blck_mapCenter = [10370, 11510, 0];blck_mapRange = 14400;}; case "namalsk":{blck_mapCenter = [4352, 7348, 0];blck_mapRange = 10000;}; case "napf": {blck_mapCenter = [10240,10240,0]; blck_mapRange = 14000}; // {_centerPos = [10240, 10240, 0];_isMountainous = true;_maxHeight = 50;}; case "australia": {blck_mapCenter = [20480,20480, 150];blck_mapRange = 40960;}; - case "panthera2":{blck_mapCenter = [4400, 4400, 0];blck_mapRange = 4400;}; + case "panthera3":{blck_mapCenter = [4400, 4400, 0];blck_mapRange = 4400;}; case "isladuala":{blck_mapCenter = [4400, 4400, 0];blck_mapRange = 4400;}; case "sauerland":{blck_mapCenter = [12800, 12800, 0];blck_mapRange = 12800;}; case "trinity":{blck_mapCenter = [6400, 6400, 0];blck_mapRange = 6400;}; @@ -56,30 +53,7 @@ if (_modType isEqualTo "Epoch") then case "tavi":{blck_mapCenter = [10370, 11510, 0];blck_mapRange = 14090;}; case "lingor":{blck_mapCenter = [4400, 4400, 0];blck_mapRange = 4400;}; case "takistan":{blck_mapCenter = [5500, 6500, 0];blck_mapRange = 5000;}; - default {_blck_WorldName = "default";blck_mapCenter = [6322,7801,0]; blck_mapRange = 12000}; - }; -}; -if (_modType isEqualTo "Exile") then -{ - switch (_blck_WorldName) do { - // These may need some adjustment - including a test for shore or water should help as well to avoid missions spawning on water. - case "altis":{diag_log "Altis-specific settings loaded";blck_mapCenter = [6322,7801,0];blck_mapRange = 21000;}; - case "taviana":{blck_mapCenter = [10370, 11510, 0];blck_mapRange = 14400;}; - case "namalsk":{blck_mapCenter = [4352, 7348, 0];blck_mapRange = 10000;}; - case "napf": {blck_mapCenter = [10240,10240,0]; blck_mapRange = 14000}; // {_centerPos = [10240, 10240, 0];_isMountainous = true;_maxHeight = 50;}; - case "tanoa": {blck_mapCenter = [ (_blck_worldSize/2),(_blck_worldSize/2),0];blck_mapRange = _blck_worldSize;}; - case "panthera2":{blck_mapCenter = [4400, 4400, 0];blck_mapRange = 4400;}; - case "isladuala":{blck_mapCenter = [4400, 4400, 0];blck_mapRange = 4400;}; - case "sauerland":{blck_mapCenter = [12800, 12800, 0];blck_mapRange = 12800;}; - case "trinity":{blck_mapCenter = [6400, 6400, 0];blck_mapRange = 6400;}; - case "utes":{blck_mapCenter = [3500, 3500, 0];blck_mapRange = 3500;}; - case "zargabad":{blck_mapCenter = [4096, 4096, 0];blck_mapRange = 4096;}; - case "fallujah":{blck_mapCenter = [3500, 3500, 0];blck_mapRange = 3500;}; - case "tavi":{blck_mapCenter = [10370, 11510, 0];blck_mapRange = 14090;}; - case "lingor":{blck_mapCenter = [4400, 4400, 0];blck_mapRange = 4400;}; - case "takistan":{blck_mapCenter = [5500, 6500, 0];blck_mapRange = 5000;}; - default {_blck_WorldName = "default";blck_mapCenter = [6322,7801,0]; blck_mapRange = 12000;}; - }; + default {_blck_WorldName = "default";blck_mapCenter = [6322,7801,0]; blck_mapRange = 6000}; }; blck_worldSet = true; diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_getModType.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_getModType.sqf new file mode 100644 index 0000000..0e5be23 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_getModType.sqf @@ -0,0 +1,12 @@ +/* + Based on code by IT07 written for VEMF_r +*/ + +private "_mod"; + +_mod = ""; + +if not ( isNull ( configFile >> "CfgPatches" >> "exile_server" ) ) then { _mod = "Exile" }; +if not ( isNull ( configFile >> "CfgPatches" >> "a3_epoch_server" ) ) then { _mod = "Epoch" }; + +_mod 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 ca28cc4..d000a02 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf @@ -36,17 +36,19 @@ while {true} do [] call GMS_fnc_cleanupDeadAI; - if (_modType isEqualTo "Epoch") then {[] call blck_fnc_cleanEmptyGroups;}; // Exile cleans up empty groups automatically so this should not be needed with that mod. + //if (_modType isEqualTo "Epoch") then { + diag_log "calling blck_fnc_cleanEmptyGroups"; + [] spawn blck_fnc_cleanEmptyGroups; + //}; // Exile cleans up empty groups automatically so this should not be needed with that mod. _timer1min = diag_tickTime; }; - - if ((diag_tickTime - _timer5min) > 180) then { + if ((diag_tickTime - _timer5min) > 300) then { if (blck_timeAcceleration) then { if (blck_debugON) then {diag_log "[blckeagls] calling time acceleration module";}; [] call blck_fnc_timeAcceleration; }; - if (blck_useHC) then {[] call blck_fnc_monitorHC;}; + if (blck_useHC) then {[] call blck_fnc_monitorHC;}; // Not working _timer5min = diag_tickTime; }; @@ -57,7 +59,7 @@ while {true} do _timer10Min = diag_tickTime; }; */ - /* + { if (_x select 6 > 0) then // The mission is not running, check the time left till it is spawned { @@ -67,7 +69,7 @@ while {true} do _coords pushback 0; blck_ActiveMissionCoords pushback _coords; private["_markerClass","_missionName","_missionPath","_aiDifficultyLevel"]; - //diag_log format["_fnc_mainThread:: -->> _missionClass would = %1%2",_x select 2, _index]; + diag_log format["_fnc_mainThread:: -->> _missionClass would = %1%2",_x select 2, _index]; _markerClass = _x select 2; [_markerClass,"Active",_coords] call blck_fnc_updateMissionQue; _aiDifficultyLevel = _x select 4; @@ -78,6 +80,6 @@ while {true} do }; }; }forEach blck_pendingMissions; - */ + }; 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 9d3b30e..9d8af0b 100644 --- a/@epochhive/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup.sqf +++ b/@epochhive/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup.sqf @@ -3,7 +3,7 @@ for DBD Clan By Ghostrider-DBD- Copyright 2016 - Last Modified 9-12-16 + Last Modified 12/21/16 */ //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"]; @@ -24,49 +24,55 @@ if (blck_debugLevel isEqualTo 3) then diag_log format["spawnGroup.sqf: _numbertospawn = %1",_numbertospawn]; }; //Creates a group to make them attack players -_groupSpawned = createGroup blck_AI_Side; // ; Group changed for Exile for which player is RESISTANCE. -_groupSpawned setcombatmode blck_combatMode; -_groupSpawned allowfleeing 0; -_groupSpawned setspeedmode "FULL"; -_groupSpawned setFormation blck_groupFormation; -_groupSpawned setVariable ["blck_group",true,true]; +_groupSpawned = createGroup blck_AI_Side; // ; Group changed for Exile for which player is RESISTANCE. +if !(isNull _groupSpawned) then +{ + diag_log format["_fnc_spawnGroup:: -- >> Group created = %1",_groupSpawned]; + _groupSpawned setcombatmode blck_combatMode; + _groupSpawned allowfleeing 0; + _groupSpawned setspeedmode "FULL"; + _groupSpawned setFormation blck_groupFormation; + _groupSpawned setVariable ["blck_group",true,true]; -//diag_log format["spawnGroup:: group is %1",_groupSpawned]; -// Determines whether or not the group has launchers -_useLauncher = blck_useLaunchers; + //diag_log format["spawnGroup:: group is %1",_groupSpawned]; + // Determines whether or not the group has launchers + _useLauncher = blck_useLaunchers; -// define weapons list for the group -switch (_skillLevel) 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;}; -}; - - -//Spawns the correct number of AI Groups, each with the correct number of units -//Counter variable -_i = 0; -while {_i < _numbertospawn} do { - _i = _i + 1; - if (blck_useLaunchers && _i <= blck_launchersPerGroup) then - { - _launcherType = selectRandom blck_launcherTypes; - } else { - _launcherType = "none"; + // define weapons list for the group + switch (_skillLevel) 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;}; }; - - //Finds a safe positon to spawn the AI in the area given - _safepos = [_pos,0,30,2,0,20,0] call BIS_fnc_findSafePos; - //Spawns the AI unit - //diag_log format["spawnGroup:: spawning unit #%1",_i]; - // params["_pos","_weaponList","_aiGroup",["_skillLevel","red"],["_Launcher","none"],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear]]; - [_safepos,_weaponList,_groupSpawned,_skillLevel,_launcherType,_uniforms,_headGear] call blck_fnc_spawnAI; + + //Spawns the correct number of AI Groups, each with the correct number of units + //Counter variable + _i = 0; + while {_i < _numbertospawn} do { + _i = _i + 1; + if (blck_useLaunchers && _i <= blck_launchersPerGroup) then + { + _launcherType = selectRandom blck_launcherTypes; + } else { + _launcherType = "none"; + }; + + //Finds a safe positon to spawn the AI in the area given + _safepos = [_pos,0,30,2,0,20,0] call BIS_fnc_findSafePos; + + //Spawns the AI unit + //diag_log format["spawnGroup:: spawning unit #%1",_i]; + // params["_pos","_weaponList","_aiGroup",["_skillLevel","red"],["_Launcher","none"],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear]]; + [_safepos,_weaponList,_groupSpawned,_skillLevel,_launcherType,_uniforms,_headGear] call blck_fnc_spawnAI; + }; + _groupSpawned selectLeader (units _groupSpawned select 0); + [_pos,_minDist,_maxDist,_groupSpawned] spawn blck_fnc_setupWaypoints; + + //diag_log format["fnc_spawnGroup:: Group spawned was %1 with units of %2",_groupSpawned, units _groupSpawned]; +} else { + diag_log "_fnc_spawnGroup:: ERROR CONDITION : NULL GROUP CREATED"; }; -_groupSpawned selectLeader (units _groupSpawned select 0); -[_pos,_minDist,_maxDist,_groupSpawned] spawn blck_fnc_setupWaypoints; - -//diag_log format["fnc_spawnGroup:: Group spawned was %1 with units of %2",_groupSpawned, units _groupSpawned]; _groupSpawned 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 496070e..6b7c484 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addMIssionToQue.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addMIssionToQue.sqf @@ -15,7 +15,7 @@ for "_i" from 1 to _noMissions do { private _waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin)); _mission = [_missionList,_path,format["%1%2",_marker,_i],_difficulty,_tMin,_tMax,_waitTime,[0,0,0]]; - diag_log format["-fnc_addMissionToQue::-->> _mission = %1",_mission]; + //diag_log format["-fnc_addMissionToQue::-->> _mission = %1",_mission]; blck_pendingMissions pushback _mission; }; -//diag_log format["_fnc_addMissionToQue:: -- >> Result - blck_pendingMissions = %1",blck_pendingMissions]; +diag_log format["_fnc_addMissionToQue:: -- >> Result - blck_pendingMissions = %1",blck_pendingMissions]; diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf new file mode 100644 index 0000000..f2fd061 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf @@ -0,0 +1,461 @@ +/* + Generic Mission Spawner + for DBD Clan + By Ghostrider-DBD- + Copyright 2016 +*/ + + +private ["_crates","_aiGroup","_objects","_vehicles","_groupPatrolRadius","_missionLandscape","_compositions","_missionCfg","_compSel","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles"]; + +params["_coords","_missionType","_aiDifficultyLevel"]; +/* +_aiDifficultyLevel = _this select 2; // "blue","red","green" and "orange" +*/ + +// ************************* + +// Once the entire mission system can support timeout cleanup of vehicles (specifically the AI vehicle patrols) then each mission layout can define this varialbe. Until then disable timouts. + +////////////////////////////////// +// To simplify debugging and also reduce load on server besure only once instance of the mission spawner is initializing at a time. +///////////////////////////////// + +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"]; +if (isNil "_chanceReinforcements") then +{ + _chanceReinforcements = 0; + _noPara = 0; + _reinforcementLootCounts = [0,0,0,0,0,0]; + _chanceHeliPatrol = 0; + _chanceLoot = 0; +}; +private["_timeOut"]; // _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 "_reinforcementLootCounts") then +{ + _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]; + //diag_log "missionSpawner:: default values used for _reinforcementLootCounts"; +} +else +{ + //diag_log "missionSpawner:: Mission specific values used for _reinforcementLootCounts"; +}; + +if (blck_debugON) then { + diag_log format["[blckEagle] Mission Reinforcement Parameters: changeReinforcements %1 numAI %2 changePatrol %3 chanceLoot %4",_chanceReinforcements,_noPara,_chanceHeliPatrol,_chanceLoot]; +}; + +private["_useMines"]; +if (isNil "_useMines") then {_useMines = blck_useMines; /*diag_log "[blckEagles] Using default setting for _useMines";*/}; + +_objects = []; +_mines = []; +_crates = []; +_aiGroup = []; +_missionAIVehicles = []; +_blck_AllMissionAI = []; +_AI_Vehicles = []; +_blck_localMissionMarker = [_missionType,_coords,"","",_markerColor,_markerType]; +_delayTime = 1; +_groupPatrolRadius = 50; + +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"; + +_fn_timedOut = { + params["_startTime"]; + private["_return"]; + _return = ( (diag_tickTime - _startTime) > blck_MissionTimout ); + _return; +}; +_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; +}; + +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; +while {_wait} do +{ + if (blck_debugLevel isEqualTo 3) 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; + }; +}; +//waitUntil{ { (isPlayer _x && _x distance _coords <= blck_TriggerDistance /*&& vehicle _x == _x*/) || ([_missionStartTime] call _fn_timedOut) } count playableunits > 0 }; + +if (blck_debugON) then +{ + diag_log format["missionSpawner:: Mission Triggerred contition playerInRange %1 and timout = %2",_playerInRange, _missionTimedOut]; +}; + +if (!_playerInRange && _missionTimedOut) exitWith +{ + //["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]; + }; +}; + +if (_playerInRange) 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_playerInRange) && (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]; +}; diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner-debug.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner-debug.sqf new file mode 100644 index 0000000..c966a9b --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner-debug.sqf @@ -0,0 +1,459 @@ +/* + Generic Mission Spawner + for DBD Clan + By Ghostrider-DBD- + Copyright 2016 +*/ + + +private ["_crates","_aiGroup","_objects","_vehicles","_groupPatrolRadius","_missionLandscape","_compositions","_missionCfg","_compSel","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles"]; + +params["_coords","_missionType","_aiDifficultyLevel"]; +/* +_aiDifficultyLevel = _this select 2; // "blue","red","green" and "orange" +*/ + +// ************************* + +// Once the entire mission system can support timeout cleanup of vehicles (specifically the AI vehicle patrols) then each mission layout can define this varialbe. Until then disable timouts. + +////////////////////////////////// +// To simplify debugging and also reduce load on server besure only once instance of the mission spawner is initializing at a time. +///////////////////////////////// + +waitUntil {blck_missionSpawning isEqualTo false}; +blck_missionSpawning = true; + +diag_log format["[blckeagls] missionSpawner:: INITIALIZING USING MISSION PARAMETERS mission: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + +private["_chanceHeliPatrol","_noPara","_reinforcementLootCounts","_chanceLoot"]; +if (isNil "_chanceReinforcements") then +{ + _chanceReinforcements = 0; + _noPara = 0; + _reinforcementLootCounts = [0,0,0,0,0,0]; + _chanceHeliPatrol = 0; + _chanceLoot = 0; +}; +private["_timeOut"]; // _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 "_reinforcementLootCounts") then +{ + _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]; + //diag_log "missionSpawner:: default values used for _reinforcementLootCounts"; +} +else +{ + //diag_log "missionSpawner:: Mission specific values used for _reinforcementLootCounts"; +}; + +if (blck_debugON) then { + diag_log format["(2) [blckEagle] REINFORCEMENT PARAMETERS: Mission Reinforcement Parameters for missionType %5: changeReinforcements %1 numAI %2 changePatrol %3 chanceLoot %4",_chanceReinforcements,_noPara,_chanceHeliPatrol,_chanceLoot,_missionType]; +}; + +private["_useMines"]; +if (isNil "_useMines") then {_useMines = blck_useMines; /*diag_log "[blckEagles] Using default setting for _useMines";*/}; + +_objects = []; +_mines = []; +_crates = []; +_aiGroup = []; +_missionAIVehicles = []; +_blck_AllMissionAI = []; +_AI_Vehicles = []; +_blck_localMissionMarker = [_missionType,_coords,"","",_markerColor,_markerType]; +_delayTime = 1; +_groupPatrolRadius = 50; + +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"; + +_fn_timedOut = { + params["_startTime"]; + private["_return"]; + _return = ( (diag_tickTime - _startTime) > blck_MissionTimout ); + _return; +}; +_fn_playerWithinRange = { + params["_pos"]; + private["_return"]; + _return = false; + { + if (isPlayer _x and _x distance _pos <= blck_TriggerDistance) then {_return = true}; + + }forEach playableunits; + _return; +}; + +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; + +if (DBD_debugON) then {diag_log format["missionSpawner:: WAITING FOR PLAYER to trigger the mission for missionType %1",_missionType];}; + +private["_wait","_missionStartTime","_playerInRange","_missionTimedOut"]; +_missionStartTime = diag_tickTime; +_playerInRange = false; +_missionTimedOut = false; +_wait = true; + +while {_wait} do +{ + uiSleep 1; + if ([_coords] call _fn_playerWithinRange) then + { + _wait = false; + _playerInRange = true; + } else + { + if ( (diag_tickTime - _missionStartTime) > blck_MissionTimout ) then + { + _wait = false; + _missionTimedOut = true; + } else { + if (blck_debugLevel == 3) then + { + sleep 120; + _wait = false; + _playerInRange = true; + diag_log format["(3) _fnc_missionSpawner:: -->> ACTIVATION Mission of missionType %1 activated based on blck_debugLevel == 3",_missionType]; + }; + }; + }; +}; +//waitUntil{ { (isPlayer _x && _x distance _coords <= blck_TriggerDistance /*&& vehicle _x == _x*/) || ([_missionStartTime] call _fn_timedOut) } count playableunits > 0 }; + +if (blck_debugON) then +{ + diag_log format["missionSpawner:: MISSION TRIGGER contition _missionType = %4 and playerInRange %1 and timout = %2 and blck_debugLevel = %3",_playerInRange, _missionTimedOut,blck_debugLevel,_missionType]; +}; + +if (_missionTimedOut) exitWith +{ + //["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]; + }; +}; + +if (_playerInRange || blck_debugLevel == 3) 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 = _objects + _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 = _objects + _temp; + }; + uiSleep _delayTime; + if (_useMines) then + { + _mines = [_coords] call blck_fnc_spawnMines; + //waitUntil{!(_mines isEqualTo [];); + uiSleep _delayTime;; + }; + uiSleep _delayTime; + + if (_missionLandscapeMode isEqualTo "random") then + { + _objects = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape; + } else { + _objects = [_coords, round(random(360)),_missionLandscape,true] call blck_fnc_spawnCompositionObjects; + }; + 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]; + }; + }; + + //diag_log format["_fnc_missionSpawner:: after adding any static weapons, _blck_AllMissionAI is %1",_blck_AllMissionAI]; + 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]; + }; + }; + //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]; + + 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; + }; + }; + + 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]; + }; + }; + + // 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 == -1} do + { + if (_endIfPlayerNear) then { + if ( { (isPlayer _x) && ([_x,_locations,20] call blck_fnc_playerInRange) && (vehicle _x == _x) } count playableunits > 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"]; + }; + }; + if (blck_debugLevel == 3) then + { + uiSleep 60; + _missionComplete = 1; + diag_log format["_fnc_missionSpawner:: -- >> Mission of missionType %1 was Tripped based on blck_debugLevel == 3",_missionType]; + }; + uiSleep 2; + }; + + if (blck_debugON) then + { + diag_log format["[blckeagls] missionSpawner:: Mission COMPLETION CRITERIA FULFILLED: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4 : blck_debugLevel = %5",_coords,_missionType,_aiDifficultyLevel,_markerMissionName,blck_debugLevel]; + }; + + 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]; +}; 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 f2fd061..981f002 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -35,7 +35,7 @@ if (isNil "_chanceReinforcements") then _chanceHeliPatrol = 0; _chanceLoot = 0; }; -private["_timeOut"]; // _timeOut is the time in seconds after which a mission is deactivated. +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;}; @@ -57,11 +57,12 @@ else //diag_log "missionSpawner:: Mission specific values used for _reinforcementLootCounts"; }; -if (blck_debugON) then { +if (blck_debugON) exitWith { diag_log format["[blckEagle] Mission Reinforcement Parameters: changeReinforcements %1 numAI %2 changePatrol %3 chanceLoot %4",_chanceReinforcements,_noPara,_chanceHeliPatrol,_chanceLoot]; + [_blck_localMissionMarker select 0,"Completed"] call blck_fnc_updateMissionQue; }; -private["_useMines"]; +private["_useMines","_abortMissionSpawner","_blck_AllMissionAI","_delayTime","_groupPatrolRadius"]; if (isNil "_useMines") then {_useMines = blck_useMines; /*diag_log "[blckEagles] Using default setting for _useMines";*/}; _objects = []; @@ -74,6 +75,14 @@ _AI_Vehicles = []; _blck_localMissionMarker = [_missionType,_coords,"","",_markerColor,_markerType]; _delayTime = 1; _groupPatrolRadius = 50; +_abortMissionSpawner = false; + +if ((_noEmplacedWeapons + _noAIGroups + _noVehiclePatrols + ([] call blck_fnc_groupsOnAISide)) > 140) then { + // There are insufficient groups available within the 144 group per side maximum to spawn the entire mission + // Log the Error Condition + diag_log format["[blckeagls] ERROR CONDITION: Mission spawner aborted. Insufficient groups available to spawn entire mission | %1 groups used", [] call blck_fnc_groupsOnAISide]; + +}; // max groups per side = 144; leave a safety factor of 4 groups. if (blck_labelMapMarkers select 0) then { @@ -106,6 +115,10 @@ _fn_playerWithinRange = { _return; }; +_fnc_abortMissionSpawner = { + +}; + 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. @@ -250,11 +263,15 @@ if (_playerInRange) then //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; + 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; + } exitWith { + _abortMissionSpawner = true; + }; }forEach _emplacedPositions; //diag_log format["missionSpawner:: emplaced weapons data: _AI_Vehicles %1 _blck_AllMissionAI %1",_AI_Vehicles,_blck_AllMissionAI]; if (blck_debugON) then @@ -276,11 +293,16 @@ if (_playerInRange) then 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]; + //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; + if !(isNull _newGroup) then + { + _newAI = units _newGroup; + _blck_AllMissionAI = _blck_AllMissionAI + _newAI; + //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, _newAI]; + } else { + _abortMissionSpawner = true; + }; }; case 2: { //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=2"]; // spawn groups on either side of the mission area @@ -295,6 +317,7 @@ if (_playerInRange) then _adjusttedGroupSize = _unitsPerGroup; }; _newGroup = [_x,_adjusttedGroupSize,_adjusttedGroupSize,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup; + if (isNull _newGroup) exitWith {_abortMissionSpawner = true;}; _newAI = units _newGroup; _blck_AllMissionAI = _blck_AllMissionAI + _newAI; //diag_log format["missionSpawner: Spawning 2 Groups: _newGroup=%1 _newAI = %2",_newGroup, _newAI]; @@ -304,17 +327,20 @@ if (_playerInRange) then 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; + if (isNull _newGroup) then {_abortMissionSpawner = true;} else { - _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; - + //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; + if (isNull _newGroup) exitWith {_abortMissionSpawner = true;}; + _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"]; @@ -325,6 +351,7 @@ if (_playerInRange) then _groupLocations = [_coords,(_noAIGroups - 1),20,40] call blck_fnc_findPositionsAlongARadius; { _newGroup = [_x,_unitsPerGroup,_unitsPerGroup,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup; + if (isNull _newGroup) exitWith {_abortMissionSpawner = true;}; _newAI = units _newGroup; _blck_AllMissionAI = _blck_AllMissionAI + _newAI; //diag_log format["missionSpawner: Spawning %3 Groups: _newGroup=%1 _newAI = %2",_newGroup, _newAI,_noAIGroups]; @@ -349,21 +376,12 @@ if (_playerInRange) then 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 @@ -374,6 +392,7 @@ if (_playerInRange) then //for "_i" from 1 to _noVehiclePatrols do { _vehGroup = [_x,3,3,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; + if (isNull _vehGroup) exitWith {_abortMissionSpawner = true;}; //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; @@ -391,6 +410,22 @@ if (_playerInRange) then diag_log format["[blckeagls] missionSpawner:: Vehicle Patrols Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; }; }; + + if (_abortMissionSpawner) then + { + // discard everything + {deleteVehicle _x} forEach _objects; + {deleteVehicle _x} forEach _mines; + {deleteVehicle _x} forEach _crates; + {deleteVehicle _x} forEach _blck_AllMissionAI; + {deleteVehicle _x} forEach _AI_Vehicles; + // set the mission status to waiting + [_blck_localMissionMarker select 0,"Completed"] call blck_fnc_updateMissionQue; + uiSleep 1; + // delete any empty groups left over from the cleanup. + [] call blck_fnc_cleanEmptyGroups; + + }; // Trigger for mission end //diag_log format["[blckeagls] mission Spawner _endCondition = %1",_endCondition]; private["_missionComplete"]; @@ -416,7 +451,7 @@ if (_playerInRange) then { if (blck_debugLevel isEqualTo 3) then { - uiSleep 120; + uiSleep 240; _missionComplete = 1; } else { if (_endIfPlayerNear) then { @@ -456,6 +491,6 @@ if (_playerInRange) then [["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; + [_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_updateMissionQue.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf index 56ad3e9..61d3da7 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf @@ -6,12 +6,12 @@ */ params["_mission","_status",["_coords",[0,0,0]] ]; -//diag_log format["_fnc_updateMissionQue :: _mission = %1 | _status = %2 | _coords = %3",_mission,_status,_coords]; +diag_log format["_fnc_updateMissionQue :: _mission = %1 | _status = %2 | _coords = %3",_mission,_status,_coords]; { if (_mission isEqualTo (_x select 2)) exitWith { private _element = _x; - //diag_log format ["_fnc_updateMissionQue :: _element = %1",_element]; + diag_log format ["_fnc_updateMissionQue :: _element = %1",_element]; blck_pendingMissions = blck_pendingMissions - _element; if (toLower(_status) isEqualTo "active") then { _element set[6, -1]; @@ -23,9 +23,9 @@ params["_mission","_status",["_coords",[0,0,0]] ]; _element set[6, _waitTime]; _element set [7,[0,0,0]]; }; - //diag_log format["_fnc_updateMissionQue:: -- >> _element updated from %1 to %2",_x,_element]; + diag_log format["_fnc_updateMissionQue:: -- >> _element updated from %1 to %2",_x,_element]; blck_pendingMissions pushback _element; - //diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions updated to %1",blck_pendingMissions]; + diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions updated to %1",blck_pendingMissions]; }; }forEach blck_pendingMissions; diff --git a/@epochhive/addons/custom_server/Compiles/TimeAccel/GMS_fnc_Time.sqf b/@epochhive/addons/custom_server/Compiles/TimeAccel/GMS_fnc_Time.sqf index b1923cc..7c2c50f 100644 --- a/@epochhive/addons/custom_server/Compiles/TimeAccel/GMS_fnc_Time.sqf +++ b/@epochhive/addons/custom_server/Compiles/TimeAccel/GMS_fnc_Time.sqf @@ -1,12 +1,14 @@ // GMS_fnc_time.sqf // by Ghostrider-DBD_ -// +// Last Updated 12/21/16 // Creds to AWOL, A3W, LouD and Creampie for insights. if (!isServer) exitWith {}; /* - blck_timeAcceleration = true; // When true, time acceleration will be periodically updated based on amount of daylight at that time according to the values below. + blck_timeAcceleration = true; // When true, time acceleration will be periodically updated based on amount of daylight at that time according to the values below + // which can be set using the corresponding variables in the config file for that mod. + blck_timeAccelerationDay = 1; // Daytime time accelearation blck_timeAccelerationDusk = 3; // Dawn/dusk time accelearation blck_timeAccelerationNight = 6; // Nighttim time acceleration @@ -16,7 +18,7 @@ _arr = date call BIS_fnc_sunriseSunsetTime; _sunrise = _arr select 0; _sunset = _arr select 1; _time = dayTime; -diag_log format["_fnc_Time:: -- > _sunrise = %1 | _sunset = %2 | _time = %3",_sunrise,_sunset,_time]; +//diag_log format["_fnc_Time:: -- > _sunrise = %1 | _sunset = %2 | _time = %3",_sunrise,_sunset,_time]; // Night if (_time > (_sunset + 0.5) || _time < (_sunrise - 0.5)) exitWith {setTimeMultiplier blck_timeAccelerationNight; diag_log format["NIGHT TIMGE ADJUSTMENT:: time accel updated to %1; time of day = %2",timeMultiplier,dayTime];}; 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 a76c6ab..ef6be0e 100644 --- a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_cleanupAliveAI.sqf +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_cleanupAliveAI.sqf @@ -41,4 +41,4 @@ params["_aiList"]; deleteVehicle _ai; }; }forEach _aiList; -//diag_log format["_fnc_cleanupAliveAI:: AI Cleanup Completed"]; +diag_log format["_fnc_cleanupAliveAI:: AI Cleanup Completed"]; diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnEmplaced.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnEmplaced.sqf index 241010c..218ecb6 100644 --- a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnEmplaced.sqf +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnEmplaced.sqf @@ -4,9 +4,8 @@ private["_emplaced","_safepos","_emp","_gunner"]; params["_pos","_emplacedGroup","_emplacedTypes",["_minDist",20],["_maxDist",35] ]; - -if (isNull _emplacedGroup) exitWith {}; - +if (isNull _emplacedGroup) exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnEmplaced"; objNull;}; +diag_log format["_fnc_spawnEmplacedGroup:: -- >> _emplacedGroup = %1",_emplacedGroup]; _safepos = [_pos,_minDist,_maxDist,0,0,20,0] call BIS_fnc_findSafePos; _emplaced = selectRandom _emplacedTypes; _emp = [_emplaced,_safepos] call blck_fnc_spawnVehicle; 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 61330b4..f4de1b8 100644 --- a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf @@ -16,8 +16,8 @@ params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_ //_maxDis = maximum distance from the center of the mission for vehicle waypoints //_groupForVehiclePatrol = The group with which to man the vehicle -if (isNull _group) exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnVehiclePatrol"}; - +if (isNull _group) exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnVehiclePatrol"; objNull;}; +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; diff --git a/@epochhive/addons/custom_server/Compiles/blck_functions.sqf b/@epochhive/addons/custom_server/Compiles/blck_functions.sqf index 12998f6..1d5733b 100644 --- a/@epochhive/addons/custom_server/Compiles/blck_functions.sqf +++ b/@epochhive/addons/custom_server/Compiles/blck_functions.sqf @@ -14,7 +14,8 @@ blck_fnc_findPositionsAlongARadius = compileFinal preprocessFileLineNumbers "\ blck_fnc_giveTakeCrypto = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_giveTakeCrypto.sqf"; blck_fnc_monitorHC = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_monitorHC.sqf"; 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_getModType.sqf"; // Test if Epoch or Exile is loaded +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 // Player-related functions blck_fnc_rewardKiller = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_rewardKiller.sqf"; @@ -24,8 +25,8 @@ blck_fnc_MessagePlayers = compileFinal preprocessFileLineNumbers "\q\addons\cus // Mission-related functions blck_fnc_missionTimer = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionTimer.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_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_playerInRange = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_playerInRange.sqf"; diff --git a/@epochhive/addons/custom_server/Compiles/blck_variables.sqf b/@epochhive/addons/custom_server/Compiles/blck_variables.sqf index 67016fe..300ba4f 100644 --- a/@epochhive/addons/custom_server/Compiles/blck_variables.sqf +++ b/@epochhive/addons/custom_server/Compiles/blck_variables.sqf @@ -7,7 +7,7 @@ */ //blck_variablesLoaded = false; blck_debugON = false; -blck_debugLevel = 0; // Reserved for future use. +blck_debugLevel = 0; // Reserved for certain testing modes. blck_minFPS = 10; //////////////////////////////////////////////// diff --git a/@epochhive/addons/custom_server/Configs/blck_configs_epoch.sqf b/@epochhive/addons/custom_server/Configs/blck_configs_epoch.sqf index 8d7ac6e..f1f1add 100644 --- a/@epochhive/addons/custom_server/Configs/blck_configs_epoch.sqf +++ b/@epochhive/addons/custom_server/Configs/blck_configs_epoch.sqf @@ -94,8 +94,6 @@ Last modified 8/1/15 blck_enableGreenMissions = 1; blck_enableRedMissions = 1; blck_enableBlueMissions = 1; - blck_enableHunterMissions = 1; - blck_enableScoutsMissions = 1; // AI VEHICLE PATROL PARAMETERS //Defines how many AI Vehicles to spawn. Set this to -1 to disable spawning of static weapons or vehicles. To discourage players runniing with with vehicles, spawn more B_GMG_01_high @@ -123,20 +121,12 @@ Last modified 8/1/15 blck_TMin_Green = 200; blck_TMin_Blue = 120; blck_TMin_Red = 150; - blck_TMin_Hunter = 120; - blck_TMin_Scouts = 115; - blck_TMin_Crashes = 115; - blck_TMin_UMS = 200; //Maximum Spawn time between missions in seconds blck_TMax_Orange = 360; blck_TMax_Green = 300; blck_TMax_Blue = 200; blck_TMax_Red = 250; - blck_TMax_Hunter = 200; - blck_TMax_Scouts = 200; - blck_TMax_Crashes = 200; - blck_TMax_UMS = 280; blck_MissionTimout = 40*60; // 40 min diff --git a/@epochhive/addons/custom_server/Configs/blck_configs_exile.sqf b/@epochhive/addons/custom_server/Configs/blck_configs_exile.sqf index 8c6c0be..00042e2 100644 --- a/@epochhive/addons/custom_server/Configs/blck_configs_exile.sqf +++ b/@epochhive/addons/custom_server/Configs/blck_configs_exile.sqf @@ -96,8 +96,6 @@ Last modified 8/1/15 blck_enableGreenMissions = 1; blck_enableRedMissions = 1; blck_enableBlueMissions = 1; - blck_enableHunterMissions = 1; - blck_enableScoutsMissions = 1; // AI VEHICLE PATROL PARAMETERS //Defines how many AI Vehicles to spawn. Set this to -1 to disable spawning of static weapons or vehicles. To discourage players runniing with with vehicles, spawn more B_GMG_01_high @@ -129,26 +127,15 @@ Last modified 8/1/15 blck_TMin_Green = 200; blck_TMin_Blue = 120; blck_TMin_Red = 150; - blck_TMin_Hunter = 120; - blck_TMin_Scouts = 115; - blck_TMin_Crashes = 115; - blck_TMin_UMS = 200; //Maximum Spawn time between missions in seconds blck_TMax_Orange = 360; blck_TMax_Green = 300; blck_TMax_Blue = 200; blck_TMax_Red = 250; - blck_TMax_Hunter = 200; - blck_TMax_Scouts = 200; - blck_TMax_Crashes = 200; - blck_TMax_UMS = 280; blck_MissionTimout = 40*60; // 40 min - // Define the maximum number of crash sites on the map at any one time - blck_maxCrashSites = 3; // recommended settings: 3 for Altis, 2 for Tanoa, 1 for smaller maps. Set to -1 to disable - blck_maxDynamicUnderwaterMissions = 3; /**************************************************************** GENERAL AI SETTINGS diff --git a/@epochhive/addons/custom_server/changeLog.sqf b/@epochhive/addons/custom_server/changeLog.sqf index 2f3f8ed..8e4fe61 100644 --- a/@epochhive/addons/custom_server/changeLog.sqf +++ b/@epochhive/addons/custom_server/changeLog.sqf @@ -4,6 +4,14 @@ Loosely based on the AI mission system by blckeagls ver 2.0.2 Contributions by Narines: bug fixes, testing, 'fired' event handler Ideas or code from that by Vampire and KiloSwiss have been used for certain functions. +12/21/16 Version 6.50 Build 21 +Added a check for mod type to the routine that deletes empty groups as this is only needed for Epoch. +Added back the code that (a) eliminates the mission timers and (b) allows multiple instances of a mission to be spawned. + +12/20/16 Version 6.46 Buid 20 +Moved Variables for time acceleration to the config files. +Reworked code for time acceleration to use timeDay and BIS_fnc_sunriseSunsetTime. + 11/20/16 Build 6.45 Build 19 Added Option to display mission information in Toasts (Exile Only). Fixed an issue related to bugs in Arma 1.66 diff --git a/@epochhive/addons/custom_server/init/blck_init.sqf b/@epochhive/addons/custom_server/init/blck_init.sqf index bbc866a..3045f26 100644 --- a/@epochhive/addons/custom_server/init/blck_init.sqf +++ b/@epochhive/addons/custom_server/init/blck_init.sqf @@ -89,23 +89,27 @@ if (blck_spawnStaticLootCrates) then 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; +}; +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; +}; +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; +}; +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; +}; -if (blck_enableOrangeMissions == 1) then -{ - [_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange] spawn blck_fnc_missionTimer;//Starts major mission system (Orange Map Markers) -}; -if (blck_enableGreenMissions == 1) then -{ - [_missionListGreen,_pathGreen,"GreenMarker","green",blck_TMin_Green,blck_TMax_Green] spawn blck_fnc_missionTimer;//Starts major mission system 2 (Green Map Markers) -}; -if (blck_enableRedMissions == 1) 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) -}; -if (blck_enableBlueMissions == 1) then -{ - [_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue] spawn blck_fnc_missionTimer;//Starts minor mission system (Blue Map Markers) -}; // start the main thread for the mission system which monitors missions running and stuff to be cleaned up [] execVM "\q\addons\custom_server\Compiles\Functions\GMS_fnc_mainThread.sqf"; [] execVM "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_vehicleMonitorLoop.sqf"; diff --git a/@epochhive/addons/custom_server/init/build.sqf b/@epochhive/addons/custom_server/init/build.sqf index 0364bf8..b10ba6a 100644 --- a/@epochhive/addons/custom_server/init/build.sqf +++ b/@epochhive/addons/custom_server/init/build.sqf @@ -1,3 +1,3 @@ private ["_version","_versionDate"]; -_blck_version = "6.46 Build 20"; -_blck_versionDate = "12-19-16 3:00 PM"; +_blck_version = "6.50 Build 21"; +_blck_versionDate = "12-22-16 8:00 PM";