diff --git a/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup - Copy.sqf b/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup - Copy.sqf deleted file mode 100644 index fe31ffd..0000000 --- a/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup - Copy.sqf +++ /dev/null @@ -1,122 +0,0 @@ -/* - blck_fnc_spawnGroup - for ghostridergaming - By Ghostrider [GRG] - Copyright 2016 - Last modified 11/12/17 - - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; - -private["_numbertospawn","_groupSpawned","_safepos","_useLauncher","_launcherType"]; -// _newGroup = [_groupSpawnPos,_minAI,_maxAI,_skillLevel,_coords,_minPatrolRadius,_maxPatrolRadius,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,true,_isScubaGroup] -params["_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",20], ["_maxDist",35],["_configureWaypoints",true], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_scuba",false] ]; - -#ifdef blck_debugMode -if (blck_debugLevel >= 2) then -{ - private _params = ["_pos","_center","_numai1","_numai2","_skillLevel","_minDis","_maxDist","_configureWaypoints","_uniforms","_headGear","_vests","_backpacks","_weaponList","_sideArms","_scuba"]; - { - diag_log format["_fnc_spawnGroup: param %1 | value %2 | _forEachIndex %3",_params select _forEachIndex,_this select _forEachIndex,_forEachIndex]; - }forEach _this; -}; -#endif -//Spawns correct number of AI -if (_numai2 > _numai1) then -{ - _numbertospawn = floor( (random (_numai2 - _numai1) + _numai1 ) ); -} else { - _numbertospawn = _numai2; -}; - -#ifdef blck_debugMode -if (blck_debugLevel >= 1) then -{ - diag_log format["spawnGroup.sqf: _numbertospawn = %1",_numbertospawn]; -}; -#endif - -_groupSpawned = createGroup [blck_AI_Side, true]; // true here causes any empty group to be automatically deleted within 1 sec or so. https://community.bistudio.com/wiki/createGroup - -#ifdef blck_debugMode -if (blck_debugLevel >= 1) then -{ - diag_log format["spawnGroup.sqf: _groupSpawned = %1",_groupSpawned]; -}; -#endif -if !(isNull _groupSpawned) then -{ - #ifdef blck_debugMode - if (blck_debugLevel >= 1) then {diag_log format["_fnc_spawnGroup:: -- >> Group created = %1",_groupSpawned]}; - #endif - _groupSpawned setVariable["groupVehicle",objNull]; - - #ifdef useDynamicSimulation - _groupSpawned enableDynamicSimulation true; - #endif - - _groupSpawned setcombatmode "RED"; - _groupSpawned setBehaviour "COMBAT"; - _groupSpawned allowfleeing 0; - _groupSpawned setspeedmode "FULL"; - _groupSpawned setFormation blck_groupFormation; - _groupSpawned setVariable ["blck_group",true,true]; - - //diag_log format["spawnGroup:: group is %1",_groupSpawned]; - _useLauncher = blck_useLaunchers; - if (count _weaponList == 0) then - { - _weaponList = [_skillLevel] call blck_fnc_selectAILoadout; - }; - - //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 - #ifdef blck_debugMode - if (blck_debugLevel > 2) then - { - diag_log format["spawnGroup:: spawning unit #%1",_i]; - }; - #endif - //params["_pos","_aiGroup",_skillLevel,_uniforms, _headGear,_vests,_backpacks,_Launcher,_weaponList,_sideArms,_scuba]; - [_pos,_groupSpawned,_skillLevel,_uniforms,_headGear,_vests,_backpacks,_launcherType, _weaponList, _sideArms, _scuba] call blck_fnc_spawnUnit; - }; - _groupSpawned selectLeader (units _groupSpawned select 0); - // params["_pos","_minDis","_maxDis","_group",["_mode","random"],["_pattern",["MOVE","SAD"]]]; - if (_configureWaypoints) then - { - if (_scuba) then {_infantryType = "scuba"} else {_infantryType = "infantry"}; - [_pos,_minDist,_maxDist,_groupSpawned,"random","SAD","infantry"] spawn blck_fnc_setupWaypoints; - }; - //[_pos,_minDist,_maxDist,_groupSpawned,"random","SENTRY"] spawn blck_fnc_setupWaypoints; - //diag_log format["_fnc_spawnGroup: blck_fnc_setupWaypoints called for group %1",_groupSpawned]; - #ifdef blck_debugMode - if (blck_debugLevel >= 1) then - { - diag_log format["fnc_spawnGroup:: Group spawned was %1 with units of %2",_groupSpawned, units _groupSpawned]; - }; - #endif - -} else { - diag_log "_fnc_spawnGroup:: ERROR CONDITION : NULL GROUP CREATED"; -}; -_groupSpawned diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission - Copy.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission - Copy.sqf deleted file mode 100644 index 469db4e..0000000 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission - Copy.sqf +++ /dev/null @@ -1,137 +0,0 @@ -/* - schedules deletion of all remaining alive AI and mission objects. - Updates the mission que. - Updates mission markers. - By Ghostrider GRG - - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp" -private["_cleanupAliveAITimer","_cleanupCompositionTimer","_isScubaMission"]; - -_fn_missionCleanup = { - params["_mines","_objects","_blck_AllMissionAI","_mission","_cleanupAliveAITimer","_cleanupCompositionTimer",["_isScubaMission",false]]; - [_mines] spawn blck_fnc_clearMines; - //diag_log format["_fnc_endMission: (103) _objects = %1",_objects]; - [_objects, _cleanupCompositionTimer] spawn blck_fnc_addObjToQue; - //diag_log format["_fnc_endMission:: (106) _blck_AllMissionAI = %1",_blck_AllMissionAI]; - [_blck_AllMissionAI, (_cleanupAliveAITimer)] spawn blck_fnc_addLiveAItoQue; - blck_missionsRunning = blck_missionsRunning - 1; - blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; - if !(_isScubaMission) then - { - blck_recentMissionCoords pushback [_coords,diag_tickTime]; - [_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue; - //diag_log format["_fnc_endMission:: (109) _mission = %1",_mission]; - }; - if (_isScubaMission) then - { - blck_priorDynamicUMS_Missions pushback [_coords,diag_tickTime]; - blck_UMS_ActiveDynamicMissions = blck_UMS_ActiveDynamicMissions - [_coords]; - blck_dynamicUMS_MissionsRuning = blck_dynamicUMS_MissionsRuning - 1; - }; -}; - -/////////////////////////////////////////////////////////////////////// -// MAIN FUNCTION STARTS HERE -////////////////////////////////////////////////////////////////////// - #ifdef blck_debugMode - diag_log format["_fnc_endMission: _this = %1",_this]; - #endif - params["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_blck_localMissionMarker","_coords","_mission",["_aborted",false],["_vehicles",[]],["_isScubaMission",false]]; - - #ifdef blck_debugMode - if (blck_debugLevel > 0) then - { - diag_log format["_fnc_endMission: _blck_localMissionMarker %1 | _coords %2 | _mission %3 | _aborted %4",_blck_localMissionMarker,_coords,_mission,_aborted]; - diag_log format["_fnc_endMission: _aborted = %1",_aborted]; - diag_log format["_fnc_endMission: _isScubaMission = %1",_isScubaMission]; - diag_log format["_fnc_endMission: prior to running mission end functions -> blck_missionsRunning = %1 | blck_dynamicUMS_MissionsRuning = %2",blck_missionsRunning,blck_dynamicUMS_MissionsRuning]; - }; - #endif - - if (_aborted > 0) exitWith - { - #ifdef blck_debugMode - if (blck_debugLevel > 0) then { - diag_log format["_fnc_endMission: Mission Aborted, setting all timers to 0"]; - }; - #endif - if (_aborted == 2) then - { - [["abort",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; - }; - [_blck_localMissionMarker select 0] call blck_fnc_deleteMarker; - _cleanupCompositionTimer = 0; - _cleanupAliveAITimer = 0; - // params["_mines","_objects","_blck_AllMissionAI","_mission","_cleanupAliveAITimer","_cleanupCompositionTimer",["_isScubaMission",false]]; - [_mines,_objects,_blck_AllMissionAI,_mission,_cleanupAliveAITimer,_cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup; - { - deleteVehicle _x; - }forEach _crates; - { - deleteVehicle _x; - }forEach _vehicles; - }; - if (_aborted == 0) then - { - private["_cleanupAliveAITimer","_cleanupCompositionTimer"]; - if (blck_useSignalEnd) then - { - [_crates select 0] spawn blck_fnc_signalEnd; - { - _x enableRopeAttach true; - }forEach _crates; - #ifdef blck_debugMode - if (blck_debugLevel > 0) then - { - diag_log format["[blckeagls] _fnc_endMission:: (18) SignalEnd called: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; - }; - #endif - }; - #ifdef blck_debugMode - if (blck_debugLevel > 0) then { - diag_log format["_fnc_endMission: Mission Completed without errors, setting all timers to default values"]; - }; - #endif - - _cleanupCompositionTimer = blck_cleanupCompositionTimer; - _cleanupAliveAITimer = blck_AliveAICleanUpTimer; - [["end",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; - [_blck_localMissionMarker select 0] call blck_fnc_deleteMarker; - [_blck_localMissionMarker select 1, _markerClass] spawn blck_fnc_missionCompleteMarker; - // Using a variable attached to the crate rather than the global setting to be sure we do not fill a crate twice. - // the "lootLoaded" loaded should be set to true by the crate filler script so we can use that for our check. - { - //diag_log format["_fnc_endMission (82): for crate %1 lootLoaded = %2",_x,_x getVariable["lootLoaded",false]]; - if !(_x getVariable["lootLoaded",false]) then - { - // _crateLoot,_lootCounts are defined above and carry the loot table to be used and the number of items of each category to load - [_x,_crateLoot,_lootCounts] call blck_fnc_fillBoxes; - }; - }forEach _crates; - { - private ["_v","_posnVeh"]; - _posnVeh = blck_monitoredVehicles find _x; // returns -1 if the vehicle is not in the array else returns 0-(count blck_monitoredVehicles -1) - if (_posnVeh >= 0) then - { - #ifdef blck_debugMode - diag_log format["_fnc_endMission: setting missionCompleted for vehicle %1 to %2",_x,diag_tickTime]; - #endif - (blck_monitoredVehicles select _posnVeh) setVariable ["missionCompleted", diag_tickTime]; - } else { - _x setVariable ["missionCompleted", diag_tickTime]; - blck_monitoredVehicles pushback _x; - }; - } forEach _vehicles; - [_mines,_objects,_blck_AllMissionAI,_mission,_cleanupAliveAITimer,_cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup; - }; - #ifdef blck_debugMode - diag_log format["_fnc_endMission: after to running mission end functions -> blck_missionsRunning = %1 | blck_dynamicUMS_MissionsRuning = %2",blck_missionsRunning,blck_dynamicUMS_MissionsRuning]; - #endif - _aborted \ No newline at end of file diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy (4).sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy (4).sqf deleted file mode 100644 index a8c3e49..0000000 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy (4).sqf +++ /dev/null @@ -1,586 +0,0 @@ -/* - Dynamic Mission Spawner (over-ground missions) - By Ghostrider GRG - Copyright 2016 - - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; -#define delayTime 1 -private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_assetKilledMsg","_enemyLeaderConfig", - "_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups","_loadCratesTiming","_spawnCratesTiming","_assetSpawned","_hostageConfig", - "_chanceHeliPatrol","_noPara","_reinforcementLootCounts","_chanceLoot","_heliCrew","_loadCratesTiming","_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius", - "_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_noChoppers","_chancePara","_marker"]; - -params["_coords","_markerClass","_aiDifficultyLevel"]; - -//////// -// set all variables needed for the missions -// data is pulled either from the mission description or from the _mission variable passsed as a parameter -// Deal with situations where some of these variables might not be defined as well. -//////// - -// _mission params["OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange]; -//_markerClass = _mission select 0; -// _aiDifficultyLevel = _mission select 1; - -[_markerClass, "active",_coords] call blck_fnc_updateMissionQue; -blck_ActiveMissionCoords pushback _coords; -diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; - -if (isNil "_assetKilledMsg") then {_assetKilledMsg = ""}; -if (isNil "_markerColor") then {_markerColor = "ColorBlack"}; -if (isNil "_markerType") then {_markerType = ["mil_box",[]]}; -//if (isNil "_timeOut") then {_timeOut = -1;}; -if (isNil "_spawnCratesTiming") then {_spawnCratesTiming = blck_spawnCratesTiming}; // Choices: "atMissionSpawnGround","atMissionStartAir","atMissionEndGround","atMissionEndAir". -if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn"; -if (isNil "_missionPatrolVehicles") then {_missionPatrolVehicles = []}; -if (isNil "_missionGroups") then {_missionGroups = []}; -if (isNil "_hostageConfig") then {_hostageConfig = []}; -if (isNil "_enemyLeaderConfig") then {_enemyLeaderConfig = []}; -if (isNil "_useMines") then {_useMines = blck_useMines;}; - -_objects = []; -_mines = []; -_crates = []; -_aiGroup = []; -_missionAIVehicles = []; -_blck_AllMissionAI = []; -_AI_Vehicles = []; -_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType]; -_delayTime = 1; -_groupPatrolRadius = 50; - -if (blck_labelMapMarkers select 0) then -{ - //diag_log "labeling map markers *****"; - _blck_localMissionMarker set [2, _markerMissionName]; -}; -if !(blck_preciseMapMarkers) then -{ - //diag_log "Map marker will be OFFSET from the mission position"; - _blck_localMissionMarker set [1,[_coords,75] call blck_fnc_randomPosition]; -}; -_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name? -[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers; -_marker = [_blck_localMissionMarker] call blck_fnc_spawnMarker; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (77) message players and spawn a mission marker";}; -if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (77) _marker = %1",_marker];}; -if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (77) waiting for player to trigger the mission";}; -#endif -//////// -// All parameters are defined, lets wait until a player is nearby or the mission has timed out -//////// - -_missionStartTime = diag_tickTime; -_playerInRange = false; -_missionTimedOut = false; -_wait = true; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (90) starting mission trigger loop"}; -#endif - -while {_wait} do -{ - #ifdef blck_debugMode - //diag_log "missionSpawner:: top of mission trigger loop"; - if (blck_debugLevel > 2) exitWith {_playerInRange = true;}; - #endif - - if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;}; - if ([_missionStartTime] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;}; - uiSleep 5; - - #ifdef blck_debugMode - if (blck_debugLevel > 2) then - { - diag_log format["missionSpawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords]; - diag_log format["missionSpawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers]; - diag_log format["missionSpawner:: Trigger Loop - timeout = %1", [_missionStartTime] call blck_fnc_timedOut]; - }; - #endif -}; - -if (_missionTimedOut) exitWith -{ - // Deal with the case in which the mission timed out. - blck_recentMissionCoords pushback [_coords,diag_tickTime]; - blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; - [_markerClass, "inactive",[0,0,0]] call blck_fnc_updateMissionQue; - blck_missionsRunning = blck_missionsRunning - 1; - [_blck_localMissionMarker select 0] call blck_fnc_deleteMarker; - [_objects, 0.1] spawn blck_fnc_cleanupObjects; - - #ifdef blck_debugMode - if (blck_debugLevel > 0) then - { - diag_log format["[blckeagls] missionSpawner:: (133) Mission Timed Out: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; - }; - #endif -}; - -//////// -// Spawn the mission objects, loot chest, and AI -//////// -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (142) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -if (blck_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate -{ - _temp = [_coords,blck_SmokeAtMissions select 1] call blck_fnc_smokeAtCrates; - if (typeName _temp isEqualTo "ARRAY") then - { - _objects append _temp; - }; -}; - -uiSleep _delayTime; -if (_useMines) then -{ - _mines = [_coords] call blck_fnc_spawnMines; - -}; -uiSleep _delayTime; -_temp = []; - -if (_missionLandscapeMode isEqualTo "random") then -{ - _temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape; -} else { - params["_center","_objects"]; - _temp = [_coords, _missionLandscape] call blck_fnc_spawnCompositionObjects; -}; -if (typeName _temp isEqualTo "ARRAY") then -{ - _objects append _temp; -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (190) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -uiSleep _delayTime;; - -_temp = [_coords,_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles; -//uisleep 1; -_crates append _temp; - -uiSleep _delayTime; - -_abort = false; -_temp = [[],[],false]; -_temp = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear,_missionGroups] call blck_fnc_spawnMissionAI; - -#ifdef blck_debugMode -if (blck_debugLevel > 2) then { - diag_log format["missionSpawner :: (209) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1; -}; - -_abort = _temp select 1; -if (blck_debugLevel > 2) then { - diag_log format["missionSpawner :: (214) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1; -}; -#endif - -if (_abort) exitWith -{ - if (blck_debugLevel > 1) then { - diag_log "missionSpawner:: (220) grpNull returned, mission termination criteria met, calling blck_fnc_endMission" - }; - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; -if !(_abort) then -{ - _blck_AllMissionAI append (_temp select 0); -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (235) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -_assetSpawned = objNull; -if !(_hostageConfig isEqualTo []) then -{ - _assetSpawned = [_coords,_hostageConfig] call blck_fnc_spawnHostage; - //diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - _blck_AllMissionAI pushBack _assetSpawned; -}; - -if !(_enemyLeaderConfig isEqualTo []) then -{ - _assetSpawned = [_coords,_enemyLeaderConfig] call blck_fnc_spawnLeader; - //diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - _blck_AllMissionAI pushBack _assetSpawned; -}; - -uiSleep _delayTime; -_temp = [[],[],false]; -_abort = false; - -_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange; -if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || count _missionPatrolVehicles > 0)) then -{ - _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_missionPatrolVehicles] call blck_fnc_spawnMissionVehiclePatrols; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then { - diag_log format["missionSpawner :: (251) blck_fnc_spawnMissionVehiclePatrols returned _temp = %1",_temp]; - }; - #endif - - if (typeName _temp isEqualTo "ARRAY") then - { - _abort = _temp select 2; - }; - if !(_abort) then - { - _patrolVehicles = _temp select 0; - _blck_AllMissionAI append (_temp select 1); - - #ifdef blck_debugMode - if (blck_debugLevel > 0) then - { - diag_log format["[blckeagls] missionSpawner:: (267) Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; - }; - #endif - - }; -}; - -if (_abort) exitWith -{ - #ifdef blck_debugMode - if (blck_debugLevel > 0) then { - diag_log "missionSpawner:: (279) grpNull returned, mission termination criteria met, calling blck_endMission"; - }; - #endif - - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; - -uiSleep _delayTime; -_temp = [[],[],false]; -_abort = false; - -// Deal with helicopter patrols -_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout; -_temp = []; - -#ifdef blck_debugMode -if (blck_debugLevel > 1) then -{ - diag_log format["[blckeagls] missionSpawner:: (298) calling in reinforcements: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -switch (toLower _aiDifficultyLevel) do -{ - case "blue":{ - _noChoppers = [blck_noPatrolHelisBlue] call blck_fnc_getNumberFromRange; - _chancePara = [blck_chanceParaBlue] call blck_fnc_getNumberFromRange; - }; - case "red":{ - _noChoppers = [blck_noPatrolHelisRed] call blck_fnc_getNumberFromRange; - _chancePara = [blck_chanceParaRed] call blck_fnc_getNumberFromRange; - }; - case "green":{ - _noChoppers = [blck_noPatrolHelisGreen] call blck_fnc_getNumberFromRange; - _chancePara = [blck_chanceParaGreen] call blck_fnc_getNumberFromRange; - }; - case "orange":{ - _noChoppers = [blck_noPatrolHelisOrange] call blck_fnc_getNumberFromRange; - _chancePara = [blck_chanceParaOrange] call blck_fnc_getNumberFromRange; - }; - default { - _chancePara = 0.5; - _noChoppers = 0; - }; -}; -#ifdef blck_debugMode -diag_log format["_missionSpawner(322):: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara]; -#endif -for "_i" from 1 to (_noChoppers) do -{ - _temp = [_coords,_aiDifficultyLevel,_weaponList,_uniforms,_headGear,_chancePara] call blck_fnc_spawnMissionReinforcements; - - #ifdef blck_debugMode - if (blck_debugLevel >= 2) then - { - diag_log format["missionSpawner(334):: blck_fnc_spawnMissionReinforcements call for chopper # %1 out of a total of %2 choppers",_i, _noChoppers]; - diag_log format["missionSpawner(335):: _temp = %1",_temp]; - }; - #endif - - if (typeName _temp isEqualTo "ARRAY") then - { - _abort = _temp select 2; - blck_monitoredVehicles pushBack (_temp select 0); - _blck_AllMissionAI append (_temp select 1); - }; - if (_abort) then - { - #ifdef blck_debugMode - if (blck_debugLevel > 2) then {diag_log "missionSpawner:: (349) grpNul or ERROR in blck_fnc_spawnMissionReinforcements, mission termination criteria met, calling blck_endMission"}; - #endif - _objects pushback (_temp select 0); - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; - }; -}; - -////////////////////////// -// Spawn Crates and Emplaced Weapons Last to try to force them to correct positions relative to spawned buildinga or other objects. -#ifdef blck_debugMode -if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (361) preparing to spawn emplaced weapons for _coords %4 | _markerClass %3 | blck_useStatic = %1 | _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass,_coords];}; -#endif -uiSleep 15; -private["_noEmplacedToSpawn"]; -_noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange; -if (blck_useStatic && (_noEmplacedToSpawn > 0)) then -{ - _temp = [_missionEmplacedWeapons,_noEmplacedToSpawn,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray; - - #ifdef blck_debugMode - if (blck_debugLevel > 2) then {diag_log format ["missionSpawner:: (375) blck_fnc_spawnEmplacedWeaponArray returned _temp = %1",_temp]}; - #endif - - if (typeName _temp isEqualTo "ARRAY") then - { - _abort = _temp select 2; - }; - - #ifdef blck_debugMode - if (blck_debugLevel > 2) then {diag_log format ["missionSpawner:: (387) _abort = %1",_abort]}; - #endif - - if !(_abort) then - { - _objects append (_temp select 0); - _blck_AllMissionAI append (_temp select 1); - - #ifdef blck_debugMode - if (blck_debugLevel > 0) then {diag_log format["[blckeagls] missionSpawner:: (400) Static Weapons Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]}; - #endif - }; -}; -if (_abort) exitWith -{ - #ifdef blck_debugMode - if (blck_debugLevel > 2) then {diag_log "missionSpawner:: (410) grpNull ERROR in blck_fnc_spawnEmplacedWeaponArray, mission termination criteria met, calling blck_endMission"}; - #endif - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; -#ifdef blck_debugMode -if (blck_debugLevel > 2) then {diag_log format["_fnc_missionSpawner: _spawnCratesTiming = %1", _spawnCratesTiming]}; -#endif -uiSleep _delayTime; -if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then -{ - if (count _missionLootBoxes > 0) then - { - _crates = [_coords,_missionLootBoxes,_loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - } - else - { - _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - - }; - - if (blck_cleanUpLootChests) then - { - _objects append _crates; - }; - - #ifdef blck_debugMode - if (blck_debugLevel > 0) then - { - diag_log format["[blckeagls] missionSpawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; - }; - #endif -}; -// Trigger for mission end - -private["_missionComplete","_endIfPlayerNear","_endIfAIKilled","_secureAsset","_crateStolen","_locations"]; -_missionComplete = -1; -_startTime = diag_tickTime; - -switch (_endCondition) do -{ - case "playerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = false;}; - case "allUnitsKilled": {_secureAsset = false; _endIfPlayerNear = false;_endIfAIKilled = true;}; - case "allKilledOrPlayerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = true;}; - case "assetSecured": {_secureAsset = true; _endIfPlayerNear = false; _endIfAIKilled = false;}; -}; - -#ifdef blck_debugMode -if (blck_debugLevel >2) then {diag_log format["_missionSpawner (464): _endCondition = %1",_endCondition]}; -diag_log format["missionSpawner :: (449) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; -#endif - -if (blck_showCountAliveAI) then -{ - if !(_marker isEqualTo "") then - { - [_marker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount; - blck_missionMarkers pushBack [_marker,_markerMissionName,_blck_AllMissionAI]; - }; -}; - -_crateStolen = false; -_locations = [_coords]; - -{ - _locations pushback (getPos _x); - _x setVariable["crateSpawnPos", (getPos _x)]; -} forEach _crates; - -#ifdef blck_debugMode -diag_log format["missionSpawner (458):: _coords = %1 | _crates = %2 | _locations = %3",_coords,_crates,_locations]; -diag_log format["missionSpawner(462):: Waiting for player to satisfy mission end criteria of _endIfPlayerNear %1 with _endIfAIKilled %2",_endIfPlayerNear,_endIfAIKilled]; -diag_log format["_fnc_missionSpawner(495) starting mission completion loop with _assetSpawned = %1",_assetSpawned]; -#endif - -while {_missionComplete isEqualTo -1} do -{ - //if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 180}; - if (_endIfPlayerNear) then - { - if ([_locations,10,true] call blck_fnc_playerInRangeArray) then {_missionComplete = 1}; - }; - if (_endIfAIKilled) then - { - if (({alive _x} count _blck_AllMissionAI) < 1) then {_missionComplete = 1}; - }; - if (_spawnCratesTiming isEqualTo "atMissionSpawn") then - { - { - if ({[_x] call blck_fnc_crateMoved} count _crates > 0) exitWith - { - _missionComplete = 1; - _crateStolen = true; - }; - }forEach _crates; - }; - if (_secureAsset) then - { - if !(alive _assetSpawned) then - { - _missionComplete = 1 - } else { - if (_assetSpawned getVariable["blck_AIState",0] > 0 && (({alive _x} count _blck_AllMissionAI) isEqualTo 1)) then {_missionComplete = 1}; - }; - }; - uiSleep 2; -}; - -if (_crateStolen) exitWith -{ - diag_log format["missionSpawner:: (491) Crate Stolen Callening _fnc_endMission - > players near = %1 and ai alive = %2 and crates stolen = %3",[_locations,10,true] call blck_fnc_playerInRangeArray, {alive _x} count _blck_AllMissionAI, _crateStolen]; - [_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission; -}; - -if ((_secureAsset) && !(alive _assetSpawned)) exitWith -{ - [_mines,_objects,_crates, _blck_AllMissionAI,_assetKilledMsg,_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission; -}; - -if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) then -{ - if (count _missionLootBoxes > 0) then - { - _crates = [_coords,_missionLootBoxes,_loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - } - else - { - _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - }; - - #ifdef blck_debugMode - if (blck_debugLevel > 0) then {diag_log format["_fnc_missionSpawner (531): _crates = %1", _crates]}; - #endif - - if (blck_cleanUpLootChests) then - { - _objects append _crates; - }; - - #ifdef blck_debugMode - if (blck_debugLevel > 0) then {diag_log format["[blckeagls] missionSpawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]}; - #endif -}; - -if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isEqualTo "atMissionCompletion") then -{ - { - [_x] call blck_fnc_loadMissionCrate; - } forEach _crates; -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (496) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; - diag_log format["missionSpawner :: (497) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; - diag_log format["[blckeagls] missionSpawner:: (498) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -private["_result"]; -// Force passing the mission name for informational purposes. -_blck_localMissionMarker set [2, _markerMissionName]; -if (blck_showCountAliveAI) then -{ - _marker setMarkerText format["%1: All AI Dead",_markerMissionName]; - { - if ((_x select 1) isEqualTo _markerMissionName) exitWith{blck_missionMarkers deleteAt _forEachIndex}; - }forEach blck_missionMarkers; -}; - -diag_log format["_fnc_missionSpawner (557) Build 123: _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]]; - -if (_assetSpawned getVariable["assetType",0] isEqualTo 1) then -{ - diag_log "Processing Mission End for Hostage Rescue"; - _assetSpawned setCaptive false; - _assetSpawned setVariable["GMSAnimations",{""],true]; - [_assetSpawned,""] remoteExec["switchMove",-2];; - uiSleep 0.1; - _assetSpawned enableAI "ALL"; - private _newPos = (getPos _assetSpawned) getPos [1000, random(360)]; - diag_log format["processing domove for hostage with current pos = %1 and new pos = %2",getPos _assetSpawned, _newPos]; - (group _assetSpawned) setCurrentWaypoint [group _assetSpawned, 0]; - [group _assetSpawned,0] setWaypointPosition [_newPos,0]; - [group _assetSpawned,0] setWaypointType "MOVE"; -}; -if (_assetSpawned getVariable["assetType",0] isEqualTo 2) then -{ - diag_log format["Processing Mission End for Arrest of Leader %1 with endAnimation %2",_assetSpawned,_assetSpawned getVariable["endAnimation",""]]; - [_assetSpawned,""] remoteExec["switchMove",-2]; - _assetSpawned setVariable["GMSAnimations",_assetSpawned getVariable["endAnimation","AidlPercMstpSnonWnonDnon_AI"],true]; - [_assetSpawned,selectRandom(_assetSpawned getVariable["endAnimation","AidlPercMstpSnonWnonDnon_AI"])] remoteExec["switchMove",-2]; -}; - -diag_log format["_fnc_missionSpawner (579) Build 123: _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]]; - -_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 0] call blck_fnc_endMission; - -#ifdef blck_debugMode -if (blck_debugLevel > 2) then {diag_log format["[blckeagls] missionSpawner:: (507)end of mission: blck_fnc_endMission has returned control to _fnc_missionSpawner"]}; -#endif diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy (5).sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy (5).sqf deleted file mode 100644 index 2bc71b1..0000000 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy (5).sqf +++ /dev/null @@ -1,633 +0,0 @@ -/* - Dynamic Mission Spawner (over-ground missions) - By Ghostrider GRG - Copyright 2016 - - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; -#define delayTime 1 -private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_assetKilledMsg","_enemyLeaderConfig", - "_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups","_loadCratesTiming","_spawnCratesTiming","_assetSpawned","_hostageConfig", - "_chanceHeliPatrol","_noPara","_chanceLoot","_heliCrew","_loadCratesTiming","_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius", - "_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_noChoppers","_chancePara","_marker"]; - -params["_coords","_markerClass","_aiDifficultyLevel"]; - -//////// -// set all variables needed for the missions -// data is pulled either from the mission description or from the _mission variable passsed as a parameter -// Deal with situations where some of these variables might not be defined as well. -//////// - -// _mission params["OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange]; -//_markerClass = _mission select 0; -// _aiDifficultyLevel = _mission select 1; - -[_markerClass, "active",_coords] call blck_fnc_updateMissionQue; -blck_ActiveMissionCoords pushback _coords; -diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; - -if (isNil "_assetKilledMsg") then {_assetKilledMsg = ""}; -if (isNil "_markerColor") then {_markerColor = "ColorBlack"}; -if (isNil "_markerType") then {_markerType = ["mil_box",[]]}; -//if (isNil "_timeOut") then {_timeOut = -1;}; -if (isNil "_spawnCratesTiming") then {_spawnCratesTiming = blck_spawnCratesTiming}; // Choices: "atMissionSpawnGround","atMissionStartAir","atMissionEndGround","atMissionEndAir". -if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn"; -if (isNil "_missionPatrolVehicles") then {_missionPatrolVehicles = []}; -if (isNil "_missionGroups") then {_missionGroups = []}; -if (isNil "_hostageConfig") then {_hostageConfig = []}; -if (isNil "_enemyLeaderConfig") then {_enemyLeaderConfig = []}; -if (isNil "_useMines") then {_useMines = blck_useMines;}; -if (isNil "_weaponList") then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout}; -if (isNil "_sideArms") then {_sideArms = blck_Pistols}; -if (isNil "_vests") then {_vests = blck_vests}; -if (isNil "_backpacks") then {_backpacks = blck_backpacks}; -diag_log format["_fnc_missionSpawner: -> blck_backpacks = %1", blck_backpacks]; -diag_log format["_fnc_missionSpawner: -> _backpacks = %1",_backpacks]; -if (isNil "_uniforms") then {_uniforms = blck_SkinList}; -if (isNil "_headGear") then {_headgear = blck_headgear}; - -if (isNil "_chanceHeliPatrol") then -{ - switch (toLower(_aiDifficultyLevel)) do - { - case "blue": {_chanceHeliPatrol = blck_chanceHeliPatrolBlue}; - case "red": {_chanceHeliPatrol = blck_noPatblck_chanceHeliPatrolRed}; - case "green": {_chanceHeliPatrol = blck_noPatblck_chanceHeliPatrolGreen}; - case "orange": {_chanceHeliPatrol = blck_chanceHeliPatrolOrange}; - default {_chanceHeliPatrol = 0}; - }; -}; -if (isNil "_noChoppers") then -{ - switch (toLower(_aiDifficultyLevel)) do - { - case "blue": {_noChoppers = blck_noPatrolHelisBlue}; - case "red": {_noChoppers = blck_noPatrolHelisRed}; - case "green": {_noChoppers = blck_noPatrolHelisGreen}; - case "orange": {_noChoppers = blck_noPatrolHelisOrange}; - default {_noChoppers = 0}; - }; -}; -if (isNil "_chancePara") then -{ - switch (toLower (_aiDifficultyLevel)) do - { - case "blue": {_chancePara = blck_chanceParaBlue}; - case "red": {_chancePara = blck_chanceParaRed}}; - case "green": {_chancePara = blck_chanceParaGreen}; - case "orange": {_chancePara = blck_chanceParaOrange; - default {_chancePara = 0}; - }; -}; -if (isNil "_missionHelis") then -{ - switch (toLower (_aiDifficultyLevel)) do - { - case "blue": {_missionHelis = blck_patrolHelisBlue}; - case "red": {_missionHelis = blck_patrolHelisRed}; - case "green": {_missionHelis = blck_patrolHelisGreen}; - case "orange": {_missionHelis = blck_patrolHelisOrange}; - default {_missionHelis = blck_patrolHelisBlue}; - }; -}; -if (isNil "_noPara") then -{ - switch (toLower (_aiDifficultyLevel)) do - { - case "blue": {_noPara = blck_noParaBlue}; - case "red": {_noPara = blck_noParaRed}; - case "green": {_noPara = blck_noParaGreen}; - case "orange": {_noPara = blck_noParaOrange}; - default {_noPara = 0}; - }; -}; -if (isNil "_chanceLoot") then {_chanceLoot = 0}; -if (isNil "_paraTriggerDistance") then {_paraTriggerDistance = 400;}; -if (isNil "_paraLoot") then {_paraLoot = blck_BoxLoot_Blue}; -if (isNil "_paraLootCounts") then {_paraLootCounts = blck_lootCountsRed}; - -_objects = []; -_mines = []; -_crates = []; -_aiGroup = []; -_missionAIVehicles = []; -_blck_AllMissionAI = []; -_AI_Vehicles = []; -_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType]; -_delayTime = 1; -_groupPatrolRadius = 50; - -diag_log "_missionSpawner: All variables initialized"; - -if (blck_labelMapMarkers select 0) then -{ - //diag_log "labeling map markers *****"; - _blck_localMissionMarker set [2, _markerMissionName]; -}; -if !(blck_preciseMapMarkers) then -{ - //diag_log "Map marker will be OFFSET from the mission position"; - _blck_localMissionMarker set [1,[_coords,75] call blck_fnc_randomPosition]; -}; -_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name? -[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers; -_marker = [_blck_localMissionMarker] call blck_fnc_spawnMarker; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (77) message players and spawn a mission marker";}; -if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (77) _marker = %1",_marker];}; -if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (77) waiting for player to trigger the mission";}; -#endif -//////// -// All parameters are defined, lets wait until a player is nearby or the mission has timed out -//////// - -_missionStartTime = diag_tickTime; -_playerInRange = false; -_missionTimedOut = false; -_wait = true; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (90) starting mission trigger loop"}; -#endif - -while {_wait} do -{ - #ifdef blck_debugMode - //diag_log "missionSpawner:: top of mission trigger loop"; - if (blck_debugLevel > 2) exitWith {_playerInRange = true;}; - #endif - - if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;}; - if ([_missionStartTime] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;}; - uiSleep 5; - - #ifdef blck_debugMode - if (blck_debugLevel > 2) then - { - diag_log format["missionSpawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords]; - diag_log format["missionSpawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers]; - diag_log format["missionSpawner:: Trigger Loop - timeout = %1", [_missionStartTime] call blck_fnc_timedOut]; - }; - #endif -}; - -if (_missionTimedOut) exitWith -{ - // Deal with the case in which the mission timed out. - blck_recentMissionCoords pushback [_coords,diag_tickTime]; - blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; - [_markerClass, "inactive",[0,0,0]] call blck_fnc_updateMissionQue; - blck_missionsRunning = blck_missionsRunning - 1; - [_blck_localMissionMarker select 0] call blck_fnc_deleteMarker; - [_objects, 0.1] spawn blck_fnc_cleanupObjects; -}; - -//////// -// Spawn the mission objects, loot chest, and AI -//////// -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (142) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -if (blck_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate -{ - _temp = [_coords,blck_SmokeAtMissions select 1] call blck_fnc_smokeAtCrates; - if (typeName _temp isEqualTo "ARRAY") then - { - _objects append _temp; - }; -}; - -uiSleep _delayTime; -if (_useMines) then -{ - _mines = [_coords] call blck_fnc_spawnMines; - -}; -uiSleep _delayTime; -_temp = []; - -if (_missionLandscapeMode isEqualTo "random") then -{ - _temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape; -} else { - params["_center","_objects"]; - _temp = [_coords, _missionLandscape] call blck_fnc_spawnCompositionObjects; -}; -if (typeName _temp isEqualTo "ARRAY") then -{ - _objects append _temp; -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (190) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -uiSleep _delayTime;; - -_temp = [_coords,_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles; -//uisleep 1; -_crates append _temp; - -uiSleep _delayTime; - -_abort = false; -_temp = [[],[],false]; - -// params["_coords",_minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests",_backpacks,_weapons,sideArms,_isScubaGroup]; -#ifdef blck_debugMode -private _params = [_coords,_minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms]; -{ - diag_log format["_fnc_missionSpawner: _param %1 label %2 = %3",_forEachIndex, _x, _params select _forEachIndex]; -}forEach ["_coords","_minNoAI","_maxNoAI","_missionGroups","_aiDifficultyLevel","_uniforms","_headgear","_vests","_backpacks","_weaponList","_sideArms"]; -#endif - -_temp = [_coords, _minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionAI; - -#ifdef blck_debugMode -if (blck_debugLevel > 2) then { - diag_log format["missionSpawner :: (209) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1; -}; - -_abort = _temp select 1; -if (blck_debugLevel > 2) then { - diag_log format["missionSpawner :: (214) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1; -}; -#endif - -if (_abort) exitWith -{ - if (blck_debugLevel > 1) then { - diag_log "missionSpawner:: (220) grpNull returned, mission termination criteria met, calling blck_fnc_endMission" - }; - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; -if !(_abort) then -{ - _blck_AllMissionAI append (_temp select 0); -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (235) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -_assetSpawned = objNull; -if !(_hostageConfig isEqualTo []) then -{ - _assetSpawned = [_coords,_hostageConfig] call blck_fnc_spawnHostage; - //diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - _blck_AllMissionAI pushBack _assetSpawned; -}; - -if !(_enemyLeaderConfig isEqualTo []) then -{ - _assetSpawned = [_coords,_enemyLeaderConfig] call blck_fnc_spawnLeader; - //diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - _blck_AllMissionAI pushBack _assetSpawned; -}; - -#ifdef blck_debugMode - if (blck_debugLevel >= 1) then { - diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - }; -#endif - -uiSleep _delayTime; -_temp = [[],[],false]; -_abort = false; - -_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange; -if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || count _missionPatrolVehicles > 0)) then -{ - #define useRelativePos true - //params[_coords,_noVehiclePatrols,_aiDifficultyLevel,_missionPatrolVehicles,_useRelativePos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms, _isScubaGroup]; - //_temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_missionPatrolVehicles] call blck_fnc_spawnMissionVehiclePatrols; - _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_missionPatrolVehicles,useRelativePos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionVehiclePatrols; - - if (typeName _temp isEqualTo "ARRAY") then - { - _abort = _temp select 2; - }; - if !(_abort) then - { - _patrolVehicles = _temp select 0; - _blck_AllMissionAI append (_temp select 1); - }; -}; - -if (_abort) exitWith -{ - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; - -uiSleep _delayTime; -_temp = [[],[],false]; -_abort = false; - -// Deal with helicopter patrols -_temp = []; - -#ifdef blck_debugMode -if (blck_debugLevel > 1) then -{ - diag_log format["[blckeagls] missionSpawner:: (298) calling in heli patrol: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -_noChoppers = [_noChoppers] call blck_fnc_getNumberFromRange; -//_noPara = [_noPara] call blck_fnc_getNumberFromRange; - -#ifdef blck_debugMode -if (blck_debugLevel > 1) then {diag_log format["_missionSpawner(322):: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara]}; -#endif -if (_noChoppers > 0) then -{ - for "_i" from 1 to (_noChoppers) do - { - if (random(1) < _chanceHeliPatrol) then - { - //_temp = [_coords,_missionHelis,spawnHeli,_aiDifficultyLevel,_chancePara,_noPara,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionReinforcements; - _temp = [_coords,_aiDifficultyLevel,_missionHelis,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList, _sideArms] call blck_fnc_spawnMissionHeli; - - if (typeName _temp isEqualTo "ARRAY") then - { - _abort = _temp select 2; - blck_monitoredVehicles pushBack (_temp select 0); - _blck_AllMissionAI append (_temp select 1); - }; - if (_abort) then - { - _objects pushback (_temp select 0); - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; - }; - }; - }; -}; - - -////////////////////////// -// Spawn Crates and Emplaced Weapons Last to try to force them to correct positions relative to spawned buildinga or other objects. -#ifdef blck_debugMode -if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (361) preparing to spawn emplaced weapons for _coords %4 | _markerClass %3 | blck_useStatic = %1 | _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass,_coords];}; -#endif -uiSleep 15; -private["_noEmplacedToSpawn"]; -_noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange; -diag_log format["_fnc_missionSpawner: -> _noEmplacedToSpawn = %1 | blck_useStatic = %2",_noEmplacedToSpawn,blck_useStatic]; -if (blck_useStatic && (_noEmplacedToSpawn > 0)) then -{ - // _params = ["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel","_uniforms","_headGear","_vests","_backpacks","_weaponList","_sideArms"]; - // _temp = [_missionEmplacedWeapons,_noEmplacedToSpawn,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray; - _temp = [_coords,_missionEmplacedWeapons,useRelativePos,_noEmplacedToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray; - - if (typeName _temp isEqualTo "ARRAY") then - { - _abort = _temp select 2; - }; - - if !(_abort) then - { - _objects append (_temp select 0); - _blck_AllMissionAI append (_temp select 1); - }; -}; -if (_abort) exitWith -{ - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; -uiSleep _delayTime; -if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then -{ - if (count _missionLootBoxes > 0) then - { - _crates = [_coords,_missionLootBoxes,_loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - } - else - { - _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - - }; - - if (blck_cleanUpLootChests) then - { - _objects append _crates; - }; -}; -if (_noPara > 0 && (random(1) < _chancePara) && _paraTriggerDistance == 0) then -{ - diag_log format["_fnc_missionSpawner (435): spawning %1 paraunits at mission spawn",_noPara]; - private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits; - if !(isNull _paratroops) then - { - _blck_AllMissionAI append (units _paratroops); - }; - if (random(1) < _chanceLoot) then - { - private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - if (blck_cleanUpLootChests) then - { - _objects append _extraCrates; - }; - }; -}; - -// Define Triggers for mission end -private["_missionComplete","_endIfPlayerNear","_endIfAIKilled","_secureAsset","_crateStolen","_locations"]; -_missionComplete = -1; -_startTime = diag_tickTime; - -switch (_endCondition) do -{ - case "playerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = false;}; - case "allUnitsKilled": {_secureAsset = false; _endIfPlayerNear = false;_endIfAIKilled = true;}; - case "allKilledOrPlayerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = true;}; - case "assetSecured": {_secureAsset = true; _endIfPlayerNear = false; _endIfAIKilled = false;}; -}; - -if (blck_showCountAliveAI) then -{ - if !(_marker isEqualTo "") then - { - [_marker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount; - blck_missionMarkers pushBack [_marker,_markerMissionName,_blck_AllMissionAI]; - }; -}; - -_crateStolen = false; -_locations = [_coords]; -private _spawnPara = if (random(1) < _chancePara) then {true} else {false}; -diag_log format["_fnc_missionSpawner (476): _spawnPara = %1 | _chancePara = %2",_spawnPara,_chancePara]; -{ - _locations pushback (getPos _x); - _x setVariable["crateSpawnPos", (getPos _x)]; -} forEach _crates; - -while {_missionComplete isEqualTo -1} do -{ - if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 180}; - if (_endIfPlayerNear) then - { - if ([_locations,10,true] call blck_fnc_playerInRangeArray) then {_missionComplete = 1}; - }; - if (_endIfAIKilled) then - { - if (({alive _x} count _blck_AllMissionAI) < 1) then {_missionComplete = 1}; - }; - if (_spawnCratesTiming isEqualTo "atMissionSpawn") then - { - { - if ({[_x] call blck_fnc_crateMoved} count _crates > 0) exitWith - { - _missionComplete = 1; - _crateStolen = true; - }; - }forEach _crates; - }; - if (_secureAsset) then - { - if !(alive _assetSpawned) then - { - _missionComplete = 1 - } else { - if (_assetSpawned getVariable["blck_AIState",0] > 0 && (({alive _x} count _blck_AllMissionAI) isEqualTo 1)) then {_missionComplete = 1}; - }; - }; - if (_spawnPara) then - { - - if ([_coords,_paraTriggerDistance,true] call blck_fnc_playerInRange) then - { - _spawnPara = false; // The player gets one try to spawn these. - if (random(1) < _chancePara) then // - { - private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits; - if !(isNull _paratroops) then - { - _blck_AllMissionAI append (units _paratroops); - }; - if (random(1) < _chanceLoot) then - { - private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - if (blck_cleanUpLootChests) then - { - _objects append _extraCrates; - }; - }; - }; - }; - }; - uiSleep 2; -}; - -if (_crateStolen) exitWith -{ - diag_log format["missionSpawner:: (491) Crate Stolen Callening _fnc_endMission - > players near = %1 and ai alive = %2 and crates stolen = %3",[_locations,10,true] call blck_fnc_playerInRangeArray, {alive _x} count _blck_AllMissionAI, _crateStolen]; - [_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission; -}; - -if ((_secureAsset) && !(alive _assetSpawned)) exitWith -{ - [_mines,_objects,_crates, _blck_AllMissionAI,_assetKilledMsg,_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission; -}; - -if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) then -{ - if (count _missionLootBoxes > 0) then - { - _crates = [_coords,_missionLootBoxes,_loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - } - else - { - _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - }; - - #ifdef blck_debugMode - if (blck_debugLevel > 0) then {diag_log format["_fnc_missionSpawner (531): _crates = %1", _crates]}; - #endif - - if (blck_cleanUpLootChests) then - { - _objects append _crates; - }; - - #ifdef blck_debugMode - if (blck_debugLevel > 0) then {diag_log format["[blckeagls] missionSpawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]}; - #endif -}; - -if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isEqualTo "atMissionCompletion") then -{ - { - [_x] call blck_fnc_loadMissionCrate; - } forEach _crates; -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (496) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; - diag_log format["missionSpawner :: (497) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; - diag_log format["[blckeagls] missionSpawner:: (498) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -private["_result"]; -// Force passing the mission name for informational purposes. -_blck_localMissionMarker set [2, _markerMissionName]; -if (blck_showCountAliveAI) then -{ - _marker setMarkerText format["%1: All AI Dead",_markerMissionName]; - { - if ((_x select 1) isEqualTo _markerMissionName) exitWith{blck_missionMarkers deleteAt _forEachIndex}; - }forEach blck_missionMarkers; -}; - -diag_log format["_fnc_missionSpawner (557) Build 123: _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]]; - -if (_assetSpawned getVariable["assetType",0] isEqualTo 1) then -{ - diag_log "Processing Mission End for Hostage Rescue"; - _assetSpawned setCaptive false; - _assetSpawned setVariable["GMSAnimations",[""],true]; - [_assetSpawned,""] remoteExec["switchMove",-2];; - uiSleep 0.1; - _assetSpawned enableAI "ALL"; - private _newPos = (getPos _assetSpawned) getPos [1000, random(360)]; - diag_log format["processing domove for hostage with current pos = %1 and new pos = %2",getPos _assetSpawned, _newPos]; - (group _assetSpawned) setCurrentWaypoint [group _assetSpawned, 0]; - [group _assetSpawned,0] setWaypointPosition [_newPos,0]; - [group _assetSpawned,0] setWaypointType "MOVE"; -}; - -if (_assetSpawned getVariable["assetType",0] isEqualTo 2) then -{ - diag_log format["Processing Mission End for Arrest of Leader %1 with endAnimation %2",_assetSpawned,_assetSpawned getVariable["endAnimation",""]]; - [_assetSpawned,""] remoteExec["switchMove",-2]; - _assetSpawned setVariable["GMSAnimations",_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]],true]; - [_assetSpawned,selectRandom(_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]])] remoteExec["switchMove",-2]; -}; - -diag_log format["_fnc_missionSpawner (579) Build 123: _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]]; - -_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 0] call blck_fnc_endMission; - -#ifdef blck_debugMode -if (blck_debugLevel > 2) then {diag_log format["[blckeagls] missionSpawner:: (507)end of mission: blck_fnc_endMission has returned control to _fnc_missionSpawner"]}; -#endif diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy (6).sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy (6).sqf deleted file mode 100644 index 3be764d..0000000 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy (6).sqf +++ /dev/null @@ -1,637 +0,0 @@ -/* - Dynamic Mission Spawner (over-ground missions) - By Ghostrider GRG - Copyright 2016 - - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; -#define delayTime 1 -private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_assetKilledMsg","_enemyLeaderConfig", - "_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups","_loadCratesTiming","_spawnCratesTiming","_assetSpawned","_hostageConfig", - "_chanceHeliPatrol","_noPara","_chanceLoot","_heliCrew","_loadCratesTiming","_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius", - "_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_noChoppers","_chancePara","_marker"]; - -params["_coords","_markerClass","_aiDifficultyLevel"]; - -//////// -// set all variables needed for the missions -// data is pulled either from the mission description or from the _mission variable passsed as a parameter -// Deal with situations where some of these variables might not be defined as well. -//////// - -// _mission params["OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange]; -//_markerClass = _mission select 0; -// _aiDifficultyLevel = _mission select 1; - -[_markerClass, "active",_coords] call blck_fnc_updateMissionQue; -blck_ActiveMissionCoords pushback _coords; -diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; - -if (isNil "_assetKilledMsg") then {_assetKilledMsg = ""}; -if (isNil "_markerColor") then {_markerColor = "ColorBlack"}; -if (isNil "_markerType") then {_markerType = ["mil_box",[]]}; -//if (isNil "_timeOut") then {_timeOut = -1;}; -if (isNil "_endCondition") then {_endCondition = blck_missionEndCondition}; // Options are "allUnitsKilled", "playerNear", "allKilledOrPlayerNear"}; -if (isNil "_spawnCratesTiming") then {_spawnCratesTiming = blck_spawnCratesTiming}; // Choices: "atMissionSpawnGround","atMissionStartAir","atMissionEndGround","atMissionEndAir". -if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn"; -if (isNil "_missionPatrolVehicles") then {_missionPatrolVehicles = []}; -if (isNil "_missionGroups") then {_missionGroups = []}; -if (isNil "_hostageConfig") then {_hostageConfig = []}; -if (isNil "_enemyLeaderConfig") then {_enemyLeaderConfig = []}; -if (isNil "_useMines") then {_useMines = blck_useMines;}; -if (isNil "_weaponList") then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout}; -if (isNil "_sideArms") then {_sideArms = blck_Pistols}; -if (isNil "_vests") then {_vests = blck_vests}; -if (isNil "_backpacks") then {_backpacks = blck_backpacks}; -//diag_log format["_fnc_missionSpawner: -> blck_backpacks = %1", blck_backpacks]; -//diag_log format["_fnc_missionSpawner: -> _backpacks = %1",_backpacks]; -if (isNil "_uniforms") then {_uniforms = blck_SkinList}; -if (isNil "_headGear") then {_headgear = blck_headgear}; - -if (isNil "_chanceHeliPatrol") then -{ - switch (toLower(_aiDifficultyLevel)) do - { - case "blue": {_chanceHeliPatrol = blck_chanceHeliPatrolBlue}; - case "red": {_chanceHeliPatrol = blck_chanceHeliPatrolRed}; - case "green": {_chanceHeliPatrol = blck_chanceHeliPatrolGreen}; - case "orange": {_chanceHeliPatrol = blck_chanceHeliPatrolOrange}; - default {_chanceHeliPatrol = 0}; - }; -}; -if (isNil "_noChoppers") then -{ - switch (toLower(_aiDifficultyLevel)) do - { - case "blue": {_noChoppers = blck_noPatrolHelisBlue}; - case "red": {_noChoppers = blck_noPatrolHelisRed}; - case "green": {_noChoppers = blck_noPatrolHelisGreen}; - case "orange": {_noChoppers = blck_noPatrolHelisOrange}; - default {_noChoppers = 0}; - }; -}; -if (isNil "_chancePara") then -{ - switch (toLower (_aiDifficultyLevel)) do - { - case "blue": {_chancePara = blck_chanceParaBlue}; - case "red": {_chancePara = blck_chanceParaRed}; - case "green": {_chancePara = blck_chanceParaGreen}; - case "orange": {_chancePara = blck_chanceParaOrange}; - default {_chancePara = 0}; - }; -}; -if (isNil "_missionHelis") then -{ - switch (toLower (_aiDifficultyLevel)) do - { - case "blue": {_missionHelis = blck_patrolHelisBlue}; - case "red": {_missionHelis = blck_patrolHelisRed}; - case "green": {_missionHelis = blck_patrolHelisGreen}; - case "orange": {_missionHelis = blck_patrolHelisOrange}; - default {_missionHelis = blck_patrolHelisBlue}; - }; -}; -if (isNil "_noPara") then -{ - switch (toLower (_aiDifficultyLevel)) do - { - case "blue": {_noPara = blck_noParaBlue}; - case "red": {_noPara = blck_noParaRed}; - case "green": {_noPara = blck_noParaGreen}; - case "orange": {_noPara = blck_noParaOrange}; - default {_noPara = 0}; - }; -}; -if (isNil "_chanceLoot") then {_chanceLoot = 0.5}; -if (isNil "_paraTriggerDistance") then {_paraTriggerDistance = 400;}; -if (isNil "_paraLoot") then {_paraLoot = blck_BoxLoot_Red}; -if (isNil "_paraLootCounts") then {_paraLootCounts = blck_lootCountsRed}; - -_objects = []; -_mines = []; -_crates = []; -_aiGroup = []; -_missionAIVehicles = []; -_blck_AllMissionAI = []; -_AI_Vehicles = []; -_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType]; -#define delayTime 1 -//_groupPatrolRadius = 50; - -#ifdef blck_debugMode -diag_log "_missionSpawner: All variables initialized"; -#endif - -if (blck_labelMapMarkers select 0) then -{ - //diag_log "labeling map markers *****"; - _blck_localMissionMarker set [2, _markerMissionName]; -}; -if !(blck_preciseMapMarkers) then -{ - //diag_log "Map marker will be OFFSET from the mission position"; - _blck_localMissionMarker set [1,[_coords,75] call blck_fnc_randomPosition]; -}; -_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name? -[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers; -_marker = [_blck_localMissionMarker] call blck_fnc_spawnMarker; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (145) message players and spawn a mission marker";}; -if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (146) _marker = %1",_marker];}; -if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (147) waiting for player to trigger the mission";}; -#endif -//////// -// All parameters are defined, lets wait until a player is nearby or the mission has timed out -//////// - -_missionStartTime = diag_tickTime; -_playerInRange = false; -_missionTimedOut = false; -_wait = true; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (90) starting mission trigger loop"}; -#endif - -while {_wait} do -{ - #ifdef blck_debugMode - //diag_log "missionSpawner:: top of mission trigger loop"; - if (blck_debugLevel > 2) exitWith {_playerInRange = true;}; - #endif - - if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;}; - if ([_missionStartTime] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;}; - uiSleep 5; - - #ifdef blck_debugMode - if (blck_debugLevel > 2) then - { - diag_log format["missionSpawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords]; - diag_log format["missionSpawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers]; - diag_log format["missionSpawner:: Trigger Loop - timeout = %1", [_missionStartTime] call blck_fnc_timedOut]; - }; - #endif -}; - -if (_missionTimedOut) exitWith -{ - // Deal with the case in which the mission timed out. - blck_recentMissionCoords pushback [_coords,diag_tickTime]; - blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; - [_markerClass, "inactive",[0,0,0]] call blck_fnc_updateMissionQue; - blck_missionsRunning = blck_missionsRunning - 1; - [_blck_localMissionMarker select 0] call blck_fnc_deleteMarker; - [_objects, 0.1] spawn blck_fnc_cleanupObjects; -}; - -//////// -// Spawn the mission objects, loot chest, and AI -//////// -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (200) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -if (blck_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate -{ - _temp = [_coords,blck_SmokeAtMissions select 1] call blck_fnc_smokeAtCrates; - if (typeName _temp isEqualTo "ARRAY") then - { - _objects append _temp; - }; -}; - -uiSleep delayTime; -if (_useMines) then -{ - _mines = [_coords] call blck_fnc_spawnMines; - -}; -uiSleep delayTime; -_temp = []; - -if (_missionLandscapeMode isEqualTo "random") then -{ - _temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape; -} else { - params["_center","_objects"]; - _temp = [_coords, _missionLandscape] call blck_fnc_spawnCompositionObjects; -}; -if (typeName _temp isEqualTo "ARRAY") then -{ - _objects append _temp; -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (237) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -uiSleep delayTime;; - -_temp = [_coords,_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles; -//uisleep 1; -_crates append _temp; - -uiSleep delayTime; - -_abort = false; -_temp = [[],[],false]; - -// params["_coords",_minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests",_backpacks,_weapons,sideArms,_isScubaGroup]; -#ifdef blck_debugMode -private _params = [_coords,_minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms]; -{ - diag_log format["_fnc_missionSpawner: _param %1 label %2 = %3",_forEachIndex, _x, _params select _forEachIndex]; -}forEach ["_coords","_minNoAI","_maxNoAI","_missionGroups","_aiDifficultyLevel","_uniforms","_headgear","_vests","_backpacks","_weaponList","_sideArms"]; -#endif - -_temp = [_coords, _minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionAI; - -#ifdef blck_debugMode -if (blck_debugLevel > 2) then { - diag_log format["missionSpawner :: (264) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1; -}; - -_abort = _temp select 1; -if (blck_debugLevel > 2) then { - diag_log format["missionSpawner :: (269) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1; -}; -#endif - -if (_abort) exitWith -{ - if (blck_debugLevel > 1) then { - diag_log "missionSpawner:: (277) grpNull returned, mission termination criteria met, calling blck_fnc_endMission" - }; - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; -if !(_abort) then -{ - _blck_AllMissionAI append (_temp select 0); -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (288) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -_assetSpawned = objNull; -if !(_hostageConfig isEqualTo []) then -{ - _assetSpawned = [_coords,_hostageConfig] call blck_fnc_spawnHostage; - //diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - _blck_AllMissionAI pushBack _assetSpawned; -}; - -if !(_enemyLeaderConfig isEqualTo []) then -{ - _assetSpawned = [_coords,_enemyLeaderConfig] call blck_fnc_spawnLeader; - //diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - _blck_AllMissionAI pushBack _assetSpawned; -}; - -#ifdef blck_debugMode - if (blck_debugLevel >= 1) then { - diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - }; -#endif - -uiSleep delayTime; -_temp = [[],[],false]; -_abort = false; - -_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange; -if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || count _missionPatrolVehicles > 0)) then -{ - #define useRelativePos true - //params[_coords,_noVehiclePatrols,_aiDifficultyLevel,_missionPatrolVehicles,_useRelativePos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms, _isScubaGroup]; - //_temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_missionPatrolVehicles] call blck_fnc_spawnMissionVehiclePatrols; - _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_missionPatrolVehicles,useRelativePos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionVehiclePatrols; - - if (typeName _temp isEqualTo "ARRAY") then - { - _abort = _temp select 2; - }; - if !(_abort) then - { - _patrolVehicles = _temp select 0; - _blck_AllMissionAI append (_temp select 1); - }; -}; - -if (_abort) exitWith -{ - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; - -uiSleep delayTime; -_temp = [[],[],false]; -_abort = false; - -// Deal with helicopter patrols -_temp = []; - -#ifdef blck_debugMode -if (blck_debugLevel > 1) then -{ - diag_log format["[blckeagls] missionSpawner:: (351) calling in heli patrol: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -_noChoppers = [_noChoppers] call blck_fnc_getNumberFromRange; -//_noPara = [_noPara] call blck_fnc_getNumberFromRange; - -#ifdef blck_debugMode -if (blck_debugLevel > 1) then {diag_log format["_missionSpawner(322):: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara]}; -#endif -if (_noChoppers > 0) then -{ - for "_i" from 1 to (_noChoppers) do - { - if (random(1) < _chanceHeliPatrol) then - { - //_temp = [_coords,_missionHelis,spawnHeli,_aiDifficultyLevel,_chancePara,_noPara,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionReinforcements; - _temp = [_coords,_aiDifficultyLevel,_missionHelis,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList, _sideArms] call blck_fnc_spawnMissionHeli; - - if (typeName _temp isEqualTo "ARRAY") then - { - _abort = _temp select 2; - blck_monitoredVehicles pushBack (_temp select 0); - _blck_AllMissionAI append (_temp select 1); - }; - if (_abort) then - { - _objects pushback (_temp select 0); - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; - }; - }; - }; -}; - - -////////////////////////// -// Spawn Crates and Emplaced Weapons Last to try to force them to correct positions relative to spawned buildinga or other objects. -#ifdef blck_debugMode -if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (389) preparing to spawn emplaced weapons for _coords %4 | _markerClass %3 | blck_useStatic = %1 | _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass,_coords];}; -#endif -uiSleep 15; -private["_noEmplacedToSpawn"]; -_noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange; -diag_log format["_fnc_missionSpawner: -> _noEmplacedToSpawn = %1 | blck_useStatic = %2",_noEmplacedToSpawn,blck_useStatic]; -if (blck_useStatic && (_noEmplacedToSpawn > 0)) then -{ - // _params = ["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel","_uniforms","_headGear","_vests","_backpacks","_weaponList","_sideArms"]; - // _temp = [_missionEmplacedWeapons,_noEmplacedToSpawn,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray; - _temp = [_coords,_missionEmplacedWeapons,useRelativePos,_noEmplacedToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray; - - if (typeName _temp isEqualTo "ARRAY") then - { - _abort = _temp select 2; - }; - - if !(_abort) then - { - _objects append (_temp select 0); - _blck_AllMissionAI append (_temp select 1); - }; -}; -if (_abort) exitWith -{ - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; -uiSleep delayTime; -if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then -{ - if (count _missionLootBoxes > 0) then - { - _crates = [_coords,_missionLootBoxes,_loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - } - else - { - _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - - }; - - if (blck_cleanUpLootChests) then - { - _objects append _crates; - }; -}; -if (_noPara > 0 && (random(1) < _chancePara) && _paraTriggerDistance == 0) then -{ - diag_log format["_fnc_missionSpawner (436): spawning %1 paraunits at mission spawn",_noPara]; - private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits; - if !(isNull _paratroops) then - { - _blck_AllMissionAI append (units _paratroops); - }; - if (random(1) < _chanceLoot) then - { - private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - if (blck_cleanUpLootChests) then - { - _objects append _extraCrates; - }; - }; -}; - -// Define Triggers for mission end -private["_missionComplete","_endIfPlayerNear","_endIfAIKilled","_secureAsset","_crateStolen","_locations"]; -_missionComplete = -1; -_startTime = diag_tickTime; - -switch (_endCondition) do -{ - case "playerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = false;}; - case "allUnitsKilled": {_secureAsset = false; _endIfPlayerNear = false;_endIfAIKilled = true;}; - case "allKilledOrPlayerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = true;}; - case "assetSecured": {_secureAsset = true; _endIfPlayerNear = false; _endIfAIKilled = false;}; -}; - -if (blck_showCountAliveAI) then -{ - if !(_marker isEqualTo "") then - { - [_marker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount; - blck_missionMarkers pushBack [_marker,_markerMissionName,_blck_AllMissionAI]; - }; -}; - -_crateStolen = false; -_locations = [_coords]; -private _spawnPara = if (random(1) < _chancePara) then {true} else {false}; -diag_log format["_fnc_missionSpawner (477): _spawnPara = %1 | _chancePara = %2",_spawnPara,_chancePara]; -{ - _locations pushback (getPos _x); - _x setVariable["crateSpawnPos", (getPos _x)]; -} forEach _crates; - -while {_missionComplete isEqualTo -1} do -{ - if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 180}; - if (_endIfPlayerNear) then - { - if ([_locations,10,true] call blck_fnc_playerInRangeArray) then {_missionComplete = 1}; - }; - if (_endIfAIKilled) then - { - if (({alive _x} count _blck_AllMissionAI) < 1) then {_missionComplete = 1}; - }; - if (_spawnCratesTiming isEqualTo "atMissionSpawn") then - { - { - if ({[_x] call blck_fnc_crateMoved} count _crates > 0) exitWith - { - _missionComplete = 1; - _crateStolen = true; - }; - }forEach _crates; - }; - if (_secureAsset) then - { - if !(alive _assetSpawned) then - { - _missionComplete = 1 - } else { - if (_assetSpawned getVariable["blck_AIState",0] > 0 && (({alive _x} count _blck_AllMissionAI) isEqualTo 1)) then {_missionComplete = 1}; - }; - }; - if (_spawnPara) then - { - - if ([_coords,_paraTriggerDistance,true] call blck_fnc_playerInRange) then - { - _spawnPara = false; // The player gets one try to spawn these. - if (random(1) < _chancePara) then // - { - private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits; - if !(isNull _paratroops) then - { - _blck_AllMissionAI append (units _paratroops); - }; - if (random(1) < _chanceLoot) then - { - private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - if (blck_cleanUpLootChests) then - { - _objects append _extraCrates; - }; - }; - }; - }; - }; - uiSleep 2; -}; - -if (_crateStolen) exitWith -{ - diag_log format["missionSpawner:: (542) Crate Stolen Callening _fnc_endMission - > players near = %1 and ai alive = %2 and crates stolen = %3",[_locations,10,true] call blck_fnc_playerInRangeArray, {alive _x} count _blck_AllMissionAI, _crateStolen]; - [_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission; -}; - -if ((_secureAsset) && !(alive _assetSpawned)) exitWith -{ - [_mines,_objects,_crates, _blck_AllMissionAI,_assetKilledMsg,_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission; -}; - -if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) then -{ - if (count _missionLootBoxes > 0) then - { - _crates = [_coords,_missionLootBoxes,_loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - } - else - { - _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - }; - - #ifdef blck_debugMode - if (blck_debugLevel > 0) then {diag_log format["_fnc_missionSpawner (531): _crates = %1", _crates]}; - #endif - - if (blck_cleanUpLootChests) then - { - _objects append _crates; - }; - - #ifdef blck_debugMode - if (blck_debugLevel > 0) then {diag_log format["[blckeagls] missionSpawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]}; - #endif -}; - -if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isEqualTo "atMissionCompletion") then -{ - { - [_x] call blck_fnc_loadMissionCrate; - } forEach _crates; -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (586) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; - diag_log format["missionSpawner :: (587) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; - diag_log format["[blckeagls] missionSpawner:: (588) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -private["_result"]; -// Force passing the mission name for informational purposes. -_blck_localMissionMarker set [2, _markerMissionName]; -if (blck_showCountAliveAI) then -{ - _marker setMarkerText format["%1: All AI Dead",_markerMissionName]; - { - if ((_x select 1) isEqualTo _markerMissionName) exitWith{blck_missionMarkers deleteAt _forEachIndex}; - }forEach blck_missionMarkers; -}; - -diag_log format["_fnc_missionSpawner (557) Build 123: _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]]; - -if (_assetSpawned getVariable["assetType",0] isEqualTo 1) then -{ - diag_log "Processing Mission End for Hostage Rescue"; - _assetSpawned setCaptive false; - _assetSpawned setVariable["GMSAnimations",[""],true]; - [_assetSpawned,""] remoteExec["switchMove",-2];; - uiSleep 0.1; - _assetSpawned enableAI "ALL"; - private _newPos = (getPos _assetSpawned) getPos [1000, random(360)]; - diag_log format["processing domove for hostage with current pos = %1 and new pos = %2",getPos _assetSpawned, _newPos]; - (group _assetSpawned) setCurrentWaypoint [group _assetSpawned, 0]; - [group _assetSpawned,0] setWaypointPosition [_newPos,0]; - [group _assetSpawned,0] setWaypointType "MOVE"; -}; - -if (_assetSpawned getVariable["assetType",0] isEqualTo 2) then -{ - diag_log format["Processing Mission End for Arrest of Leader %1 with endAnimation %2",_assetSpawned,_assetSpawned getVariable["endAnimation",""]]; - [_assetSpawned,""] remoteExec["switchMove",-2]; - _assetSpawned setVariable["GMSAnimations",_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]],true]; - [_assetSpawned,selectRandom(_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]])] remoteExec["switchMove",-2]; -}; - -diag_log format["_fnc_missionSpawner (579) Build 123: _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]]; - -_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 0] call blck_fnc_endMission; - -#ifdef blck_debugMode -if (blck_debugLevel > 2) then {diag_log format["[blckeagls] missionSpawner:: (507)end of mission: blck_fnc_endMission has returned control to _fnc_missionSpawner"]}; -#endif -diag_log format["_fnc_missionSpawner (637) Mission Completed | _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf deleted file mode 100644 index fe8a8d3..0000000 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf +++ /dev/null @@ -1,633 +0,0 @@ -/* - Dynamic Mission Spawner (over-ground missions) - By Ghostrider GRG - Copyright 2016 - - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; -#define delayTime 1 -private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_assetKilledMsg","_enemyLeaderConfig", - "_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups","_loadCratesTiming","_spawnCratesTiming","_assetSpawned","_hostageConfig", - "_chanceHeliPatrol","_noPara","_chanceLoot","_heliCrew","_loadCratesTiming","_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius", - "_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_noChoppers","_chancePara","_marker"]; - -params["_coords","_markerClass","_aiDifficultyLevel"]; - -//////// -// set all variables needed for the missions -// data is pulled either from the mission description or from the _mission variable passsed as a parameter -// Deal with situations where some of these variables might not be defined as well. -//////// - -// _mission params["OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange]; -//_markerClass = _mission select 0; -// _aiDifficultyLevel = _mission select 1; - -[_markerClass, "active",_coords] call blck_fnc_updateMissionQue; -blck_ActiveMissionCoords pushback _coords; -diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; - -if (isNil "_assetKilledMsg") then {_assetKilledMsg = ""}; -if (isNil "_markerColor") then {_markerColor = "ColorBlack"}; -if (isNil "_markerType") then {_markerType = ["mil_box",[]]}; -//if (isNil "_timeOut") then {_timeOut = -1;}; -if (isNil "_spawnCratesTiming") then {_spawnCratesTiming = blck_spawnCratesTiming}; // Choices: "atMissionSpawnGround","atMissionStartAir","atMissionEndGround","atMissionEndAir". -if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn"; -if (isNil "_missionPatrolVehicles") then {_missionPatrolVehicles = []}; -if (isNil "_missionGroups") then {_missionGroups = []}; -if (isNil "_hostageConfig") then {_hostageConfig = []}; -if (isNil "_enemyLeaderConfig") then {_enemyLeaderConfig = []}; -if (isNil "_useMines") then {_useMines = blck_useMines;}; -if (isNil "_weaponList") then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout}; -if (isNil "_sideArms") then {_sideArms = blck_Pistols}; -if (isNil "_vests") then {_vests = blck_vests}; -if (isNil "_backpacks") then {_backpacks = blck_backpacks}; -//diag_log format["_fnc_missionSpawner: -> blck_backpacks = %1", blck_backpacks]; -//diag_log format["_fnc_missionSpawner: -> _backpacks = %1",_backpacks]; -if (isNil "_uniforms") then {_uniforms = blck_SkinList}; -if (isNil "_headGear") then {_headgear = blck_headgear}; - -if (isNil "_chanceHeliPatrol") then -{ - switch (toLower(_aiDifficultyLevel)) do - { - case "blue": {_chanceHeliPatrol = blck_chanceHeliPatrolBlue}; - case "red": {_chanceHeliPatrol = blck_noPatblck_chanceHeliPatrolRed}; - case "green": {_chanceHeliPatrol = blck_noPatblck_chanceHeliPatrolGreen}; - case "orange": {_chanceHeliPatrol = blck_chanceHeliPatrolOrange}; - default {_chanceHeliPatrol = 0}; - }; -}; -if (isNil "_noChoppers") then -{ - switch (toLower(_aiDifficultyLevel)) do - { - case "blue": {_noChoppers = blck_noPatrolHelisBlue}; - case "red": {_noChoppers = blck_noPatrolHelisRed}; - case "green": {_noChoppers = blck_noPatrolHelisGreen}; - case "orange": {_noChoppers = blck_noPatrolHelisOrange}; - default {_noChoppers = 0}; - }; -}; -if (isNil "_chancePara") then -{ - switch (toLower (_aiDifficultyLevel)) do - { - case "blue": {_chancePara = blck_chanceParaBlue}; - case "red": {_chancePara = blck_chanceParaRed}}; - case "green": {_chancePara = blck_chanceParaGreen}; - case "orange": {_chancePara = blck_chanceParaOrange; - default {_chancePara = 0}; - }; -}; -if (isNil "_missionHelis") then -{ - switch (toLower (_aiDifficultyLevel)) do - { - case "blue": {_missionHelis = blck_patrolHelisBlue}; - case "red": {_missionHelis = blck_patrolHelisRed}; - case "green": {_missionHelis = blck_patrolHelisGreen}; - case "orange": {_missionHelis = blck_patrolHelisOrange}; - default {_missionHelis = blck_patrolHelisBlue}; - }; -}; -if (isNil "_noPara") then -{ - switch (toLower (_aiDifficultyLevel)) do - { - case "blue": {_noPara = blck_noParaBlue}; - case "red": {_noPara = blck_noParaRed}; - case "green": {_noPara = blck_noParaGreen}; - case "orange": {_noPara = blck_noParaOrange}; - default {_noPara = 0}; - }; -}; -if (isNil "_chanceLoot") then {_chanceLoot = 0}; -if (isNil "_paraTriggerDistance") then {_paraTriggerDistance = 400;}; -if (isNil "_paraLoot") then {_paraLoot = blck_BoxLoot_Blue}; -if (isNil "_paraLootCounts") then {_paraLootCounts = blck_lootCountsRed}; - -_objects = []; -_mines = []; -_crates = []; -_aiGroup = []; -_missionAIVehicles = []; -_blck_AllMissionAI = []; -_AI_Vehicles = []; -_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType]; -_delayTime = 1; -_groupPatrolRadius = 50; - -diag_log "_missionSpawner: All variables initialized"; - -if (blck_labelMapMarkers select 0) then -{ - //diag_log "labeling map markers *****"; - _blck_localMissionMarker set [2, _markerMissionName]; -}; -if !(blck_preciseMapMarkers) then -{ - //diag_log "Map marker will be OFFSET from the mission position"; - _blck_localMissionMarker set [1,[_coords,75] call blck_fnc_randomPosition]; -}; -_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name? -[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers; -_marker = [_blck_localMissionMarker] call blck_fnc_spawnMarker; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (77) message players and spawn a mission marker";}; -if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (77) _marker = %1",_marker];}; -if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (77) waiting for player to trigger the mission";}; -#endif -//////// -// All parameters are defined, lets wait until a player is nearby or the mission has timed out -//////// - -_missionStartTime = diag_tickTime; -_playerInRange = false; -_missionTimedOut = false; -_wait = true; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (90) starting mission trigger loop"}; -#endif - -while {_wait} do -{ - #ifdef blck_debugMode - //diag_log "missionSpawner:: top of mission trigger loop"; - if (blck_debugLevel > 2) exitWith {_playerInRange = true;}; - #endif - - if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;}; - if ([_missionStartTime] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;}; - uiSleep 5; - - #ifdef blck_debugMode - if (blck_debugLevel > 2) then - { - diag_log format["missionSpawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords]; - diag_log format["missionSpawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers]; - diag_log format["missionSpawner:: Trigger Loop - timeout = %1", [_missionStartTime] call blck_fnc_timedOut]; - }; - #endif -}; - -if (_missionTimedOut) exitWith -{ - // Deal with the case in which the mission timed out. - blck_recentMissionCoords pushback [_coords,diag_tickTime]; - blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; - [_markerClass, "inactive",[0,0,0]] call blck_fnc_updateMissionQue; - blck_missionsRunning = blck_missionsRunning - 1; - [_blck_localMissionMarker select 0] call blck_fnc_deleteMarker; - [_objects, 0.1] spawn blck_fnc_cleanupObjects; -}; - -//////// -// Spawn the mission objects, loot chest, and AI -//////// -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (142) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -if (blck_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate -{ - _temp = [_coords,blck_SmokeAtMissions select 1] call blck_fnc_smokeAtCrates; - if (typeName _temp isEqualTo "ARRAY") then - { - _objects append _temp; - }; -}; - -uiSleep _delayTime; -if (_useMines) then -{ - _mines = [_coords] call blck_fnc_spawnMines; - -}; -uiSleep _delayTime; -_temp = []; - -if (_missionLandscapeMode isEqualTo "random") then -{ - _temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape; -} else { - params["_center","_objects"]; - _temp = [_coords, _missionLandscape] call blck_fnc_spawnCompositionObjects; -}; -if (typeName _temp isEqualTo "ARRAY") then -{ - _objects append _temp; -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (190) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -uiSleep _delayTime;; - -_temp = [_coords,_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles; -//uisleep 1; -_crates append _temp; - -uiSleep _delayTime; - -_abort = false; -_temp = [[],[],false]; - -// params["_coords",_minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests",_backpacks,_weapons,sideArms,_isScubaGroup]; -#ifdef blck_debugMode -private _params = [_coords,_minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms]; -{ - diag_log format["_fnc_missionSpawner: _param %1 label %2 = %3",_forEachIndex, _x, _params select _forEachIndex]; -}forEach ["_coords","_minNoAI","_maxNoAI","_missionGroups","_aiDifficultyLevel","_uniforms","_headgear","_vests","_backpacks","_weaponList","_sideArms"]; -#endif - -_temp = [_coords, _minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionAI; - -#ifdef blck_debugMode -if (blck_debugLevel > 2) then { - diag_log format["missionSpawner :: (209) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1; -}; - -_abort = _temp select 1; -if (blck_debugLevel > 2) then { - diag_log format["missionSpawner :: (214) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1; -}; -#endif - -if (_abort) exitWith -{ - if (blck_debugLevel > 1) then { - diag_log "missionSpawner:: (220) grpNull returned, mission termination criteria met, calling blck_fnc_endMission" - }; - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; -if !(_abort) then -{ - _blck_AllMissionAI append (_temp select 0); -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (235) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -_assetSpawned = objNull; -if !(_hostageConfig isEqualTo []) then -{ - _assetSpawned = [_coords,_hostageConfig] call blck_fnc_spawnHostage; - //diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - _blck_AllMissionAI pushBack _assetSpawned; -}; - -if !(_enemyLeaderConfig isEqualTo []) then -{ - _assetSpawned = [_coords,_enemyLeaderConfig] call blck_fnc_spawnLeader; - //diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - _blck_AllMissionAI pushBack _assetSpawned; -}; - -#ifdef blck_debugMode - if (blck_debugLevel >= 1) then { - diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - }; -#endif - -uiSleep _delayTime; -_temp = [[],[],false]; -_abort = false; - -_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange; -if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || count _missionPatrolVehicles > 0)) then -{ - #define useRelativePos true - //params[_coords,_noVehiclePatrols,_aiDifficultyLevel,_missionPatrolVehicles,_useRelativePos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms, _isScubaGroup]; - //_temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_missionPatrolVehicles] call blck_fnc_spawnMissionVehiclePatrols; - _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_missionPatrolVehicles,useRelativePos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionVehiclePatrols; - - if (typeName _temp isEqualTo "ARRAY") then - { - _abort = _temp select 2; - }; - if !(_abort) then - { - _patrolVehicles = _temp select 0; - _blck_AllMissionAI append (_temp select 1); - }; -}; - -if (_abort) exitWith -{ - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; - -uiSleep _delayTime; -_temp = [[],[],false]; -_abort = false; - -// Deal with helicopter patrols -_temp = []; - -#ifdef blck_debugMode -if (blck_debugLevel > 1) then -{ - diag_log format["[blckeagls] missionSpawner:: (298) calling in heli patrol: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -_noChoppers = [_noChoppers] call blck_fnc_getNumberFromRange; -_noPara = [_noPara] call blck_fnc_getNumberFromRange; - -#ifdef blck_debugMode -if (blck_debugLevel > 1) then {diag_log format["_missionSpawner(322):: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara]}; -#endif -if (_noChoppers > 0) then -{ - for "_i" from 1 to (_noChoppers) do - { - if (random(1) < _chanceHeliPatrol) then - { - //_temp = [_coords,_missionHelis,spawnHeli,_aiDifficultyLevel,_chancePara,_noPara,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionReinforcements; - _temp = [_coords,_aiDifficultyLevel,_missionHelis,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList, _sideArms] call blck_fnc_spawnMissionHeli; - - if (typeName _temp isEqualTo "ARRAY") then - { - _abort = _temp select 2; - blck_monitoredVehicles pushBack (_temp select 0); - _blck_AllMissionAI append (_temp select 1); - }; - if (_abort) then - { - _objects pushback (_temp select 0); - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; - }; - }; - }; -}; - - -////////////////////////// -// Spawn Crates and Emplaced Weapons Last to try to force them to correct positions relative to spawned buildinga or other objects. -#ifdef blck_debugMode -if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (361) preparing to spawn emplaced weapons for _coords %4 | _markerClass %3 | blck_useStatic = %1 | _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass,_coords];}; -#endif -uiSleep 15; -private["_noEmplacedToSpawn"]; -_noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange; -diag_log format["_fnc_missionSpawner: -> _noEmplacedToSpawn = %1 | blck_useStatic = %2",_noEmplacedToSpawn,blck_useStatic]; -if (blck_useStatic && (_noEmplacedToSpawn > 0)) then -{ - // _params = ["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel","_uniforms","_headGear","_vests","_backpacks","_weaponList","_sideArms"]; - // _temp = [_missionEmplacedWeapons,_noEmplacedToSpawn,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray; - _temp = [_coords,_missionEmplacedWeapons,useRelativePos,_noEmplacedToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray; - - if (typeName _temp isEqualTo "ARRAY") then - { - _abort = _temp select 2; - }; - - if !(_abort) then - { - _objects append (_temp select 0); - _blck_AllMissionAI append (_temp select 1); - }; -}; -if (_abort) exitWith -{ - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; -uiSleep _delayTime; -if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then -{ - if (count _missionLootBoxes > 0) then - { - _crates = [_coords,_missionLootBoxes,_loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - } - else - { - _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - - }; - - if (blck_cleanUpLootChests) then - { - _objects append _crates; - }; -}; -if (_noPara > 0 && (random(1) < _chancePara) && _paraTriggerDistance == 0) then -{ - diag_log format["_fnc_missionSpawner (435): spawning %1 paraunits at mission spawn",_noPara]; - private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits; - if !(isNull _paratroops) then - { - _blck_AllMissionAI append (units _paratroops); - }; - if (random(1) < _chanceLoot) then - { - private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - if (blck_cleanUpLootChests) then - { - _objects append _extraCrates; - }; - }; -}; - -// Define Triggers for mission end -private["_missionComplete","_endIfPlayerNear","_endIfAIKilled","_secureAsset","_crateStolen","_locations"]; -_missionComplete = -1; -_startTime = diag_tickTime; - -switch (_endCondition) do -{ - case "playerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = false;}; - case "allUnitsKilled": {_secureAsset = false; _endIfPlayerNear = false;_endIfAIKilled = true;}; - case "allKilledOrPlayerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = true;}; - case "assetSecured": {_secureAsset = true; _endIfPlayerNear = false; _endIfAIKilled = false;}; -}; - -if (blck_showCountAliveAI) then -{ - if !(_marker isEqualTo "") then - { - [_marker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount; - blck_missionMarkers pushBack [_marker,_markerMissionName,_blck_AllMissionAI]; - }; -}; - -_crateStolen = false; -_locations = [_coords]; -private _spawnPara = if (random(1) < _chancePara) then {true} else {false}; -diag_log format["_fnc_missionSpawner (476): _spawnPara = %1 | _chancePara = %2",_spawnPara,_chancePara]; -{ - _locations pushback (getPos _x); - _x setVariable["crateSpawnPos", (getPos _x)]; -} forEach _crates; - -while {_missionComplete isEqualTo -1} do -{ - if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 180}; - if (_endIfPlayerNear) then - { - if ([_locations,10,true] call blck_fnc_playerInRangeArray) then {_missionComplete = 1}; - }; - if (_endIfAIKilled) then - { - if (({alive _x} count _blck_AllMissionAI) < 1) then {_missionComplete = 1}; - }; - if (_spawnCratesTiming isEqualTo "atMissionSpawn") then - { - { - if ({[_x] call blck_fnc_crateMoved} count _crates > 0) exitWith - { - _missionComplete = 1; - _crateStolen = true; - }; - }forEach _crates; - }; - if (_secureAsset) then - { - if !(alive _assetSpawned) then - { - _missionComplete = 1 - } else { - if (_assetSpawned getVariable["blck_AIState",0] > 0 && (({alive _x} count _blck_AllMissionAI) isEqualTo 1)) then {_missionComplete = 1}; - }; - }; - if (_spawnPara) then - { - - if ([_coords,_paraTriggerDistance,true] call blck_fnc_playerInRange) then - { - _spawnPara = false; // The player gets one try to spawn these. - if (random(1) < _chancePara) then // - { - private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits; - if !(isNull _paratroops) then - { - _blck_AllMissionAI append (units _paratroops); - }; - if (random(1) < _chanceLoot) then - { - private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - if (blck_cleanUpLootChests) then - { - _objects append _extraCrates; - }; - }; - }; - }; - }; - uiSleep 2; -}; - -if (_crateStolen) exitWith -{ - diag_log format["missionSpawner:: (491) Crate Stolen Callening _fnc_endMission - > players near = %1 and ai alive = %2 and crates stolen = %3",[_locations,10,true] call blck_fnc_playerInRangeArray, {alive _x} count _blck_AllMissionAI, _crateStolen]; - [_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission; -}; - -if ((_secureAsset) && !(alive _assetSpawned)) exitWith -{ - [_mines,_objects,_crates, _blck_AllMissionAI,_assetKilledMsg,_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission; -}; - -if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) then -{ - if (count _missionLootBoxes > 0) then - { - _crates = [_coords,_missionLootBoxes,_loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - } - else - { - _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - }; - - #ifdef blck_debugMode - if (blck_debugLevel > 0) then {diag_log format["_fnc_missionSpawner (531): _crates = %1", _crates]}; - #endif - - if (blck_cleanUpLootChests) then - { - _objects append _crates; - }; - - #ifdef blck_debugMode - if (blck_debugLevel > 0) then {diag_log format["[blckeagls] missionSpawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]}; - #endif -}; - -if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isEqualTo "atMissionCompletion") then -{ - { - [_x] call blck_fnc_loadMissionCrate; - } forEach _crates; -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (496) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; - diag_log format["missionSpawner :: (497) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; - diag_log format["[blckeagls] missionSpawner:: (498) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -private["_result"]; -// Force passing the mission name for informational purposes. -_blck_localMissionMarker set [2, _markerMissionName]; -if (blck_showCountAliveAI) then -{ - //_marker setMarkerText format["%1: All AI Dead",_markerMissionName]; - { - if ((_x select 1) isEqualTo _markerMissionName) exitWith{blck_missionMarkers deleteAt _forEachIndex}; - }forEach blck_missionMarkers; -}; - -diag_log format["_fnc_missionSpawner (557) Build 123: _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]]; - -if (_assetSpawned getVariable["assetType",0] isEqualTo 1) then -{ - diag_log "Processing Mission End for Hostage Rescue"; - _assetSpawned setCaptive false; - _assetSpawned setVariable["GMSAnimations",[""],true]; - [_assetSpawned,""] remoteExec["switchMove",-2];; - uiSleep 0.1; - _assetSpawned enableAI "ALL"; - private _newPos = (getPos _assetSpawned) getPos [1000, random(360)]; - diag_log format["processing domove for hostage with current pos = %1 and new pos = %2",getPos _assetSpawned, _newPos]; - (group _assetSpawned) setCurrentWaypoint [group _assetSpawned, 0]; - [group _assetSpawned,0] setWaypointPosition [_newPos,0]; - [group _assetSpawned,0] setWaypointType "MOVE"; -}; - -if (_assetSpawned getVariable["assetType",0] isEqualTo 2) then -{ - diag_log format["Processing Mission End for Arrest of Leader %1 with endAnimation %2",_assetSpawned,_assetSpawned getVariable["endAnimation",""]]; - [_assetSpawned,""] remoteExec["switchMove",-2]; - _assetSpawned setVariable["GMSAnimations",_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]],true]; - [_assetSpawned,selectRandom(_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]])] remoteExec["switchMove",-2]; -}; - -diag_log format["_fnc_missionSpawner (579) Build 123: _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]]; - -_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 0] call blck_fnc_endMission; - -#ifdef blck_debugMode -if (blck_debugLevel >= 2) then {diag_log format["[blckeagls] missionSpawner:: (507)end of mission: blck_fnc_endMission has returned control to _fnc_missionSpawner"]}; -#endif diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf.bak b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf.bak deleted file mode 100644 index 5503a8f..0000000 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf.bak +++ /dev/null @@ -1,640 +0,0 @@ -/* - Dynamic Mission Spawner (over-ground missions) - By Ghostrider GRG - Copyright 2016 - - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; -#define delayTime 1 -private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_assetKilledMsg","_enemyLeaderConfig", - "_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups","_loadCratesTiming","_spawnCratesTiming","_assetSpawned","_hostageConfig", - "_chanceHeliPatrol","_noPara","_chanceLoot","_heliCrew","_loadCratesTiming","_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius", - "_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_noChoppers","_chancePara","_marker"]; - -params["_coords","_markerClass","_aiDifficultyLevel"]; - -//////// -// set all variables needed for the missions -// data is pulled either from the mission description or from the _mission variable passsed as a parameter -// Deal with situations where some of these variables might not be defined as well. -//////// - -// _mission params["OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange]; -//_markerClass = _mission select 0; -// _aiDifficultyLevel = _mission select 1; - -[_markerClass, "active",_coords] call blck_fnc_updateMissionQue; -blck_ActiveMissionCoords pushback _coords; - blck_missionsRunning = blck_missionsRunning + 1; -diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; - -if (isNil "_assetKilledMsg") then {_assetKilledMsg = ""}; -if (isNil "_markerColor") then {_markerColor = "ColorBlack"}; -if (isNil "_markerType") then {_markerType = ["mil_box",[]]}; -//if (isNil "_timeOut") then {_timeOut = -1;}; -if (isNil "_endCondition") then {_endCondition = blck_missionEndCondition}; // Options are "allUnitsKilled", "playerNear", "allKilledOrPlayerNear"}; -if (isNil "_spawnCratesTiming") then {_spawnCratesTiming = blck_spawnCratesTiming}; // Choices: "atMissionSpawnGround","atMissionStartAir","atMissionEndGround","atMissionEndAir". -if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn"; -if (isNil "_missionPatrolVehicles") then {_missionPatrolVehicles = []}; -if (isNil "_missionGroups") then {_missionGroups = []}; -if (isNil "_hostageConfig") then {_hostageConfig = []}; -if (isNil "_enemyLeaderConfig") then {_enemyLeaderConfig = []}; -if (isNil "_useMines") then {_useMines = blck_useMines;}; -if (isNil "_weaponList") then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout}; -if (isNil "_sideArms") then {_sideArms = blck_Pistols}; -if (isNil "_vests") then {_vests = blck_vests}; -if (isNil "_backpacks") then {_backpacks = blck_backpacks}; -//diag_log format["_fnc_missionSpawner: -> blck_backpacks = %1", blck_backpacks]; -//diag_log format["_fnc_missionSpawner: -> _backpacks = %1",_backpacks]; -if (isNil "_uniforms") then {_uniforms = blck_SkinList}; -if (isNil "_headGear") then {_headgear = blck_headgear}; - -if (isNil "_chanceHeliPatrol") then -{ - switch (toLower(_aiDifficultyLevel)) do - { - case "blue": {_chanceHeliPatrol = blck_chanceHeliPatrolBlue}; - case "red": {_chanceHeliPatrol = blck_chanceHeliPatrolRed}; - case "green": {_chanceHeliPatrol = blck_chanceHeliPatrolGreen}; - case "orange": {_chanceHeliPatrol = blck_chanceHeliPatrolOrange}; - default {_chanceHeliPatrol = 0}; - }; -}; -if (isNil "_noChoppers") then -{ - switch (toLower(_aiDifficultyLevel)) do - { - case "blue": {_noChoppers = blck_noPatrolHelisBlue}; - case "red": {_noChoppers = blck_noPatrolHelisRed}; - case "green": {_noChoppers = blck_noPatrolHelisGreen}; - case "orange": {_noChoppers = blck_noPatrolHelisOrange}; - default {_noChoppers = 0}; - }; -}; -if (isNil "_chancePara") then -{ - switch (toLower (_aiDifficultyLevel)) do - { - case "blue": {_chancePara = blck_chanceParaBlue}; - case "red": {_chancePara = blck_chanceParaRed}; - case "green": {_chancePara = blck_chanceParaGreen}; - case "orange": {_chancePara = blck_chanceParaOrange}; - default {_chancePara = 0}; - }; -}; -if (isNil "_missionHelis") then -{ - switch (toLower (_aiDifficultyLevel)) do - { - case "blue": {_missionHelis = blck_patrolHelisBlue}; - case "red": {_missionHelis = blck_patrolHelisRed}; - case "green": {_missionHelis = blck_patrolHelisGreen}; - case "orange": {_missionHelis = blck_patrolHelisOrange}; - default {_missionHelis = blck_patrolHelisBlue}; - }; -}; -if (isNil "_noPara") then -{ - switch (toLower (_aiDifficultyLevel)) do - { - case "blue": {_noPara = blck_noParaBlue}; - case "red": {_noPara = blck_noParaRed}; - case "green": {_noPara = blck_noParaGreen}; - case "orange": {_noPara = blck_noParaOrange}; - default {_noPara = 0}; - }; -}; -if (isNil "_chanceLoot") then {_chanceLoot = 1.0}; //0.5}; -if (isNil "_paraTriggerDistance") then {_paraTriggerDistance = 400;}; -if (isNil "_paraLoot") then {_paraLoot = blck_BoxLoot_Red}; -if (isNil "_paraLootCounts") then {_paraLootCounts = blck_lootCountsRed}; - -_objects = []; -_mines = []; -_crates = []; -_aiGroup = []; -_missionAIVehicles = []; -_blck_AllMissionAI = []; -_AI_Vehicles = []; -_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType]; -#define delayTime 1 -//_groupPatrolRadius = 50; - -#ifdef blck_debugMode -diag_log "_missionSpawner: All variables initialized"; -#endif - -if (blck_labelMapMarkers select 0) then -{ - //diag_log "labeling map markers *****"; - _blck_localMissionMarker set [2, _markerMissionName]; -}; -if !(blck_preciseMapMarkers) then -{ - //diag_log "Map marker will be OFFSET from the mission position"; - _blck_localMissionMarker set [1,[_coords,75] call blck_fnc_randomPosition]; -}; -_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name? -[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers; -_marker = [_blck_localMissionMarker] call blck_fnc_spawnMarker; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (145) message players and spawn a mission marker";}; -if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (146) _marker = %1",_marker];}; -if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (147) waiting for player to trigger the mission";}; -#endif -//////// -// All parameters are defined, lets wait until a player is nearby or the mission has timed out -//////// - -_missionStartTime = diag_tickTime; -_playerInRange = false; -_missionTimedOut = false; -_wait = true; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then { - diag_log "missionSpawner:: (90) starting mission trigger loop"}; - diag_log format["missionSpawner (163) blck_missionTimout = %1", blck_MissionTimout]; -#endif - -while {_wait} do -{ - #ifdef blck_debugMode - //diag_log "missionSpawner:: top of mission trigger loop"; - if (blck_debugLevel > 2) exitWith {_playerInRange = true;diag_log "_fnc_missionSpawner (168): player trigger loop triggered by scripting";}; - #endif - - if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;}; - if ([_missionStartTime,blck_MissionTimout] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;}; - uiSleep 5; - - #ifdef blck_debugMode - if (blck_debugLevel > 2) then - { - diag_log format["missionSpawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords]; - diag_log format["missionSpawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers]; - diag_log format["missionSpawner:: Trigger Loop - timeout = %1", [_missionStartTime,blck_MissionTimout] call blck_fnc_timedOut]; - }; - #endif -}; - -if (_missionTimedOut) exitWith -{ - diag_log format["_fnc_missionSpawner (187): mission timed out"]; - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; - -//////// -// Spawn the mission objects, loot chest, and AI -//////// -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (200) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -if (blck_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate -{ - _temp = [_coords,blck_SmokeAtMissions select 1] call blck_fnc_smokeAtCrates; - if (typeName _temp isEqualTo "ARRAY") then - { - _objects append _temp; - }; -}; - -uiSleep delayTime; -if (_useMines) then -{ - _mines = [_coords] call blck_fnc_spawnMines; - -}; -uiSleep delayTime; -_temp = []; - -if (_missionLandscapeMode isEqualTo "random") then -{ - _temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape; -} else { - params["_center","_objects"]; - _temp = [_coords, _missionLandscape] call blck_fnc_spawnCompositionObjects; -}; -if (typeName _temp isEqualTo "ARRAY") then -{ - _objects append _temp; -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (237) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -uiSleep delayTime;; - -_temp = [_coords,_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles; -//uisleep 1; -_crates append _temp; - -uiSleep delayTime; - -_abort = false; -_temp = [[],[],false]; - -// params["_coords",_minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests",_backpacks,_weapons,sideArms,_isScubaGroup]; -#ifdef blck_debugMode -private _params = [_coords,_minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms]; -{ - diag_log format["_fnc_missionSpawner: _param %1 label %2 = %3",_forEachIndex, _x, _params select _forEachIndex]; -}forEach ["_coords","_minNoAI","_maxNoAI","_missionGroups","_aiDifficultyLevel","_uniforms","_headgear","_vests","_backpacks","_weaponList","_sideArms"]; -#endif - -_temp = [_coords, _minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionAI; - -#ifdef blck_debugMode -if (blck_debugLevel > 2) then { - diag_log format["missionSpawner :: (264) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1; -}; - -_abort = _temp select 1; -if (blck_debugLevel > 2) then { - diag_log format["missionSpawner :: (269) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1; -}; -#endif - -if (_abort) exitWith -{ - if (blck_debugLevel > 1) then { - diag_log "missionSpawner:: (277) grpNull returned, mission termination criteria met, calling blck_fnc_endMission" - }; - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; -if !(_abort) then -{ - _blck_AllMissionAI append (_temp select 0); -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (288) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -_assetSpawned = objNull; -if !(_hostageConfig isEqualTo []) then -{ - _assetSpawned = [_coords,_hostageConfig] call blck_fnc_spawnHostage; - //diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - _blck_AllMissionAI pushBack _assetSpawned; -}; - -if !(_enemyLeaderConfig isEqualTo []) then -{ - _assetSpawned = [_coords,_enemyLeaderConfig] call blck_fnc_spawnLeader; - //diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - _blck_AllMissionAI pushBack _assetSpawned; -}; - -#ifdef blck_debugMode - if (blck_debugLevel >= 1) then { - diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - }; -#endif - -uiSleep delayTime; -_temp = [[],[],false]; -_abort = false; - -_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange; -if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || count _missionPatrolVehicles > 0)) then -{ - #define useRelativePos true - //params[_coords,_noVehiclePatrols,_aiDifficultyLevel,_missionPatrolVehicles,_useRelativePos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms, _isScubaGroup]; - //_temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_missionPatrolVehicles] call blck_fnc_spawnMissionVehiclePatrols; - _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_missionPatrolVehicles,useRelativePos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionVehiclePatrols; - - if (typeName _temp isEqualTo "ARRAY") then - { - _abort = _temp select 2; - }; - if !(_abort) then - { - _patrolVehicles = _temp select 0; - _blck_AllMissionAI append (_temp select 1); - }; -}; - -if (_abort) exitWith -{ - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; - -uiSleep delayTime; -_temp = [[],[],false]; -_abort = false; - -// Deal with helicopter patrols -_temp = []; - -#ifdef blck_debugMode -if (blck_debugLevel > 1) then -{ - diag_log format["[blckeagls] missionSpawner:: (351) calling in heli patrol: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -_noChoppers = [_noChoppers] call blck_fnc_getNumberFromRange; -//_noPara = [_noPara] call blck_fnc_getNumberFromRange; - -#ifdef blck_debugMode -if (blck_debugLevel > 1) then {diag_log format["_missionSpawner(322):: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara]}; -#endif -if (_noChoppers > 0) then -{ - for "_i" from 1 to (_noChoppers) do - { - if (random(1) < _chanceHeliPatrol) then - { - //_temp = [_coords,_missionHelis,spawnHeli,_aiDifficultyLevel,_chancePara,_noPara,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionReinforcements; - _temp = [_coords,_aiDifficultyLevel,_missionHelis,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList, _sideArms] call blck_fnc_spawnMissionHeli; - - if (typeName _temp isEqualTo "ARRAY") then - { - _abort = _temp select 2; - blck_monitoredVehicles pushBack (_temp select 0); - _blck_AllMissionAI append (_temp select 1); - }; - if (_abort) then - { - _objects pushback (_temp select 0); - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; - }; - }; - }; -}; - - -////////////////////////// -// Spawn Crates and Emplaced Weapons Last to try to force them to correct positions relative to spawned buildinga or other objects. -#ifdef blck_debugMode -if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (389) preparing to spawn emplaced weapons for _coords %4 | _markerClass %3 | blck_useStatic = %1 | _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass,_coords];}; -#endif -uiSleep 15; -private["_noEmplacedToSpawn"]; -_noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange; -//diag_log format["_fnc_missionSpawner: -> _noEmplacedToSpawn = %1 | blck_useStatic = %2",_noEmplacedToSpawn,blck_useStatic]; -if (blck_useStatic && (_noEmplacedToSpawn > 0)) then -{ - // _params = ["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel","_uniforms","_headGear","_vests","_backpacks","_weaponList","_sideArms"]; - // _temp = [_missionEmplacedWeapons,_noEmplacedToSpawn,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray; - _temp = [_coords,_missionEmplacedWeapons,useRelativePos,_noEmplacedToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray; - - if (typeName _temp isEqualTo "ARRAY") then - { - _abort = _temp select 2; - }; - - if !(_abort) then - { - _objects append (_temp select 0); - _blck_AllMissionAI append (_temp select 1); - }; -}; -if (_abort) exitWith -{ - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; -uiSleep delayTime; -if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then -{ - if (count _missionLootBoxes > 0) then - { - _crates = [_coords,_missionLootBoxes,_loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - } - else - { - _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - - }; - - if (blck_cleanUpLootChests) then - { - _objects append _crates; - }; -}; -if (_noPara > 0 && (random(1) < _chancePara) && _paraTriggerDistance == 0) then -{ - diag_log format["_fnc_missionSpawner (436): spawning %1 paraunits at mission spawn",_noPara]; - private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits; - if !(isNull _paratroops) then - { - _blck_AllMissionAI append (units _paratroops); - }; - if (random(1) < _chanceLoot) then - { - diag_log format["_fnc_missionSpawner (446): spawning supplemental loot with _chanceLoot = %1",_chanceLoot]; - private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - if (blck_cleanUpLootChests) then - { - _objects append _extraCrates; - }; - }; -}; - -// Define Triggers for mission end -private["_missionComplete","_endIfPlayerNear","_endIfAIKilled","_secureAsset","_crateStolen","_locations"]; -_missionComplete = -1; -_startTime = diag_tickTime; - -switch (_endCondition) do -{ - case "playerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = false;}; - case "allUnitsKilled": {_secureAsset = false; _endIfPlayerNear = false;_endIfAIKilled = true;}; - case "allKilledOrPlayerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = true;}; - case "assetSecured": {_secureAsset = true; _endIfPlayerNear = false; _endIfAIKilled = false;}; -}; - -if (blck_showCountAliveAI) then -{ - if !(_marker isEqualTo "") then - { - [_marker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount; - blck_missionMarkers pushBack [_marker,_markerMissionName,_blck_AllMissionAI]; - }; -}; - -_crateStolen = false; -_locations = [_coords]; -private _spawnPara = if (random(1) < _chancePara) then {true} else {false}; -//diag_log format["_fnc_missionSpawner (477): _spawnPara = %1 | _chancePara = %2",_spawnPara,_chancePara]; -{ - _locations pushback (getPos _x); - _x setVariable["crateSpawnPos", (getPos _x)]; -} forEach _crates; - -while {_missionComplete isEqualTo -1} do -{ - #ifdef blck_debugMode - if (blck_debugLevel > 2) exitWith {uiSleep blck_triggerLoopCompleteTime;diag_log "_missionSpawner (492) scripted Mission End blck_debugLevel = 3";}; - #endif - if (_endIfPlayerNear) then - { - if ([_locations,10,true] call blck_fnc_playerInRangeArray) then {_missionComplete = 1}; - }; - if (_endIfAIKilled) then - { - if (({alive _x} count _blck_AllMissionAI) < 1) then {_missionComplete = 1}; - }; - if (_spawnCratesTiming isEqualTo "atMissionSpawn") then - { - { - if ({[_x] call blck_fnc_crateMoved} count _crates > 0) exitWith - { - _missionComplete = 1; - _crateStolen = true; - }; - }forEach _crates; - }; - if (_secureAsset) then - { - if !(alive _assetSpawned) then - { - _missionComplete = 1 - } else { - if (_assetSpawned getVariable["blck_AIState",0] > 0 && (({alive _x} count _blck_AllMissionAI) isEqualTo 1)) then {_missionComplete = 1}; - }; - }; - if (_spawnPara) then - { - - if ([_coords,_paraTriggerDistance,true] call blck_fnc_playerInRange) then - { - _spawnPara = false; // The player gets one try to spawn these. - if (random(1) < _chancePara) then // - { - private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits; - if !(isNull _paratroops) then - { - _blck_AllMissionAI append (units _paratroops); - }; - if (random(1) < _chanceLoot) then - { - private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - if (blck_cleanUpLootChests) then - { - _objects append _extraCrates; - }; - }; - }; - }; - }; - uiSleep 2; -}; - -if (_crateStolen) exitWith -{ - diag_log format["missionSpawner:: (542) Crate Stolen Callening _fnc_endMission - > players near = %1 and ai alive = %2 and crates stolen = %3",[_locations,10,true] call blck_fnc_playerInRangeArray, {alive _x} count _blck_AllMissionAI, _crateStolen]; - [_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission; -}; - -if ((_secureAsset) && !(alive _assetSpawned)) exitWith -{ - [_mines,_objects,_crates, _blck_AllMissionAI,_assetKilledMsg,_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission; -}; - -if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) then -{ - if (count _missionLootBoxes > 0) then - { - _crates = [_coords,_missionLootBoxes,_loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - } - else - { - _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - }; - - #ifdef blck_debugMode - if (blck_debugLevel > 0) then {diag_log format["_fnc_missionSpawner (531): _crates = %1", _crates]}; - #endif - - if (blck_cleanUpLootChests) then - { - _objects append _crates; - }; - - #ifdef blck_debugMode - if (blck_debugLevel > 0) then {diag_log format["[blckeagls] missionSpawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]}; - #endif -}; - -if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isEqualTo "atMissionCompletion") then -{ - { - [_x] call blck_fnc_loadMissionCrate; - } forEach _crates; -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (586) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; - diag_log format["missionSpawner :: (587) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; - diag_log format["[blckeagls] missionSpawner:: (588) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - -private["_result"]; -// Force passing the mission name for informational purposes. -_blck_localMissionMarker set [2, _markerMissionName]; -if (blck_showCountAliveAI) then -{ - _marker setMarkerText format["%1: All AI Dead",_markerMissionName]; - { - if ((_x select 1) isEqualTo _markerMissionName) exitWith{blck_missionMarkers deleteAt _forEachIndex}; - }forEach blck_missionMarkers; -}; - -diag_log format["_fnc_missionSpawner (557) Build 123: _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]]; - -if (_assetSpawned getVariable["assetType",0] isEqualTo 1) then -{ - diag_log "Processing Mission End for Hostage Rescue"; - _assetSpawned setCaptive false; - _assetSpawned setVariable["GMSAnimations",[""],true]; - [_assetSpawned,""] remoteExec["switchMove",-2];; - uiSleep 0.1; - _assetSpawned enableAI "ALL"; - private _newPos = (getPos _assetSpawned) getPos [1000, random(360)]; - diag_log format["processing domove for hostage with current pos = %1 and new pos = %2",getPos _assetSpawned, _newPos]; - (group _assetSpawned) setCurrentWaypoint [group _assetSpawned, 0]; - [group _assetSpawned,0] setWaypointPosition [_newPos,0]; - [group _assetSpawned,0] setWaypointType "MOVE"; -}; - -if (_assetSpawned getVariable["assetType",0] isEqualTo 2) then -{ - diag_log format["Processing Mission End for Arrest of Leader %1 with endAnimation %2",_assetSpawned,_assetSpawned getVariable["endAnimation",""]]; - [_assetSpawned,""] remoteExec["switchMove",-2]; - _assetSpawned setVariable["GMSAnimations",_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]],true]; - [_assetSpawned,selectRandom(_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]])] remoteExec["switchMove",-2]; -}; - -diag_log format["_fnc_missionSpawner (579) Build 123: _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]]; - -_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 0] call blck_fnc_endMission; - -#ifdef blck_debugMode -if (blck_debugLevel > 2) then {diag_log format["[blckeagls] missionSpawner:: (507)end of mission: blck_fnc_endMission has returned control to _fnc_missionSpawner"]}; -#endif -diag_log format["_fnc_missionSpawner (643) Mission Completed | _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -blck_missionsRun = blck_missionsRun + 1; -diag_log format["_fnc_missionSpawner (644): Total Dyanamic Land and UMS Run = %1", blck_missionsRun]; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf.bak b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf.bak deleted file mode 100644 index 3c19801..0000000 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf.bak +++ /dev/null @@ -1,140 +0,0 @@ -/* - - [_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray; - Last modified 4/27/17 - By Ghostrider [GRG] - - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; - -params["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel",["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols]]; -#ifdef blck_debugMode -if (blck_debugLevel >=2) then -{ - private _params = ["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel","_uniforms","_headGear","_vests","_backpacks","_weaponList","_sideArms"]; - { - diag_log format["blck_fnc_spawnEmplacedWeaponArray:: param %1 | isEqualTo %2 | _forEachIndex %3",_params select _forEachIndex,_this select _forEachIndex, _forEachIndex]; - }forEach _this; -}; -#endif - -private["_return","_emplacedWeps","_emplacedAI","_wep","_units","_gunner","_abort","_pos","_mode","_useRelativePos","_useRelativePos"]; -_emplacedWeps = []; -_emplacedAI = []; -_units = []; -_abort = false; -_pos = []; - -#ifdef blck_debugMode -//diag_log "_fnc_spawnEmplacedWeaponArray start"; -#endif - -// Define _missionEmplacedWeapons if not already configured. -if (_missionEmplacedWeapons isEqualTo []) then -{ - _missionEmplacedWeaponPositions = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius; - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnEmplacedWeaponArray(38): creating random spawn locations: _missionEmplacedWeaponsPositions = %1", _missionEmplacedWeaponPositions]; - }; - #endif - { - _static = selectRandom blck_staticWeapons; - //diag_log format["_fnc_spawnEmplacedWeaponArray: creating spawn element [%1,%2]",_static,_x]; - _missionEmplacedWeapons pushback [_static,_x]; - //diag_log format["_fnc_spawnEmplacedWeaponArray: _mi updated to %1",_missionEmplacedWeapons]; - } forEach _missionEmplacedWeaponPositions; - _useRelativePos = false; -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 1) then -{ - diag_log format["_fnc_spawnEmplacedWeaponArray(52):: starting static weapon spawner with _missionEmplacedWeapons = %1", _missionEmplacedWeapons]; -}; -#endif - -{ - if (_useRelativePos) then - { - _pos = _coords vectorAdd (_x select 1); - } else { - _pos = (_x select 1); - }; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnEmplacedWeaponArray(67):: _coords = %1 | offset = %2 | final _pos = %3",_coords,_x select 1, _pos]; - }; - #endif - #define configureWaypoints false - #define minAI 1 - #define maxAI 1 - #define minDist 1 - #define maxDist 2 - - /// // params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ]; - _empGroup = [(_x select 1),_pos,minAI,maxAI,_aiDifficultyLevel,minDist,maxDist,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnGroup; - - _empGroup setcombatmode "RED"; - _empGroup setBehaviour "COMBAT"; - [(_x select 1),0.01,0.02,_empGroup,"random","SAD","emplaced"] spawn blck_fnc_setupWaypoints; - if (isNull _empGroup) exitWith {_abort = _true}; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnEmplacedWeaponArray(82):: typeName _empGroup = %1 and _empGroup = %2 and _x = %3",typeName _empGroup, _empGroup,_x]; - }; - #endif - - // params["_vehType","_pos",["_clearInventory",true]]; - _wep = [(_x select 0),[0,0,0],false] call blck_fnc_spawnVehicle; - //_wep addEventHandler["HandleDamage",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}]; - _wep addMPEventHandler["MPHit",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}]; - _empGroup setVariable["groupVehicle",_wep]; - _wep setVariable["vehicleGroup",_empGroup]; - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnEmplacedWeaponArray (94) spawnVehicle returned value of _wep = %1",_wep]; - }; - #endif - - _wep setVariable["DBD_vehType","emplaced"]; - _wep setPos _pos; - [_wep,false] call blck_fnc_configureMissionVehicle; - _emplacedWeps pushback _wep; - _units = units _empGroup; - _gunner = _units select 0; - _gunner moveingunner _wep; - _emplacedAI append _units; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnEmplacedWeaponArray(110):: position of emplaced weapon = %1 and targetd position is %2",getPos _wep, _pos]; - diag_log format["_fnc_spawnEmplacedWeaponArray(111):: _gunner = %1 and crew _wep = %2",_gunner, crew _wep]; - }; - #endif - -} forEach _missionEmplacedWeapons; -blck_monitoredVehicles append _emplacedWeps; -_return = [_emplacedWeps,_emplacedAI,_abort]; - -#ifdef blck_debugMode -if (blck_debugLevel > 1) then -{ - diag_log format["_fnc_spawnEmplacedWeaponArray:: returning with _return = _emplacedWeps = %1",_return]; -}; -#endif - -_return diff --git a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill - Copy (2).sqf b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill - Copy (2).sqf deleted file mode 100644 index 3f28a46..0000000 --- a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill - Copy (2).sqf +++ /dev/null @@ -1,79 +0,0 @@ -/* - Handle AI Deaths - Last Modified 7/27/17 - By Ghostrider [GRG] - Copyright 2016 - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; - -private["_group","_isLegal","_weapon","_lastkill","_kills","_message","_killstreakMsg"]; -params["_unit","_killer","_isLegal"]; -//diag_log format["_fnc_processAIKills:: function called with _this = %1",_this]; -_unit setVariable ["blck_cleanupAt", (diag_tickTime) + blck_bodyCleanUpTimer, true]; - -blck_deadAI pushback _unit; -_group = group _unit; -[_unit] joinSilent grpNull; -if (count(units _group) < 1) then { - #ifdef useDynamicSimulation - _group enableDynamicSimulation false; - #endif - deleteGroup _group; -}; -if (blck_launcherCleanup) then {[_unit] spawn blck_fnc_removeLaunchers;}; -if (blck_removeNVG) then {[_unit] spawn blck_fnc_removeNVG;}; -if !(isPlayer _killer) exitWith {}; -[_unit,_killer] call blck_fnc_alertGroupUnits; -[_killer] call blck_fnc_alertNearbyVehicles; -_group = group _unit; -_wp = [_group, currentWaypoint _group]; -_wp setWaypointBehaviour "COMBAT"; -_group setCombatMode "RED"; -_wp setWaypointCombatMode "RED"; -_isLegal = [_unit,_killer] call blck_fnc_processIlleagalAIKills; -if !(_isLegal) exitWith {}; -_lastkill = _killer getVariable["blck_lastkill",diag_tickTime]; -_killer setVariable["blck_lastkill",diag_tickTime]; -_kills = (_killer getVariable["blck_kills",0]) + 1; -if ((diag_tickTime - _lastkill) < 240) then -{ - _killer setVariable["blck_kills",_kills]; -} else { - _killer setVariable["blck_kills",0]; -}; - -_unit action ["Eject", vehicle _unit]; - -if (blck_useKillMessages) then -{ - _weapon = currentWeapon _killer; - _killstreakMsg = format[" %1X KILLSTREAK",_kills]; - - if (blck_useKilledAIName) then - { - _message = format["[blck] %2: killed by %1 from %3m",name _killer,name _unit,round(_unit distance _killer)]; - }else{ - _message = format["[blck] %1 killed with %2 from %3 meters",name _killer,getText(configFile >> "CfgWeapons" >> _weapon >> "DisplayName"), round(_unit distance _killer)]; - }; - _message =_message + _killstreakMsg; - //diag_log format["[blck] unit killed message is %1",_message,""]; - [["aikilled",_message,"victory"],playableUnits] call blck_fnc_messageplayers; -}; - -[_unit,_killer] call blck_fnc_rewardKiller; -if (blck_showCountAliveAI) then -{ - //diag_log "_fnc_processAIKills: Updating Map Marker AI Counts - blck_missionMarkers items are"; - { - //diag_log format["_fnc_processAIKills: blck_missionMarkers itm %1 = %2",_forEachIndex,_x]; - [_x select 0, _x select 1, _x select 2] call blck_fnc_updateMarkerAliveCount; - } forEach blck_missionMarkers; - //call blck_fnc_updateAllMarkerAliveCounts; -}; - diff --git a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill - Copy.sqf b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill - Copy.sqf deleted file mode 100644 index 27ca0f2..0000000 --- a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill - Copy.sqf +++ /dev/null @@ -1,76 +0,0 @@ -/* - Handle AI Deaths - Last Modified 7/27/17 - By Ghostrider [GRG] - Copyright 2016 - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; - -private["_group","_isLegal","_weapon","_lastkill","_kills","_message","_killstreakMsg"]; -params["_unit","_killer","_isLegal"]; -//diag_log format["_fnc_processAIKills:: function called with _this = %1",_this]; -_unit setVariable ["blck_cleanupAt", (diag_tickTime) + blck_bodyCleanUpTimer, true]; - -blck_deadAI pushback _unit; -_group = group _unit; -[_unit] joinSilent grpNull; -if (count(units _group) < 1) then { - #ifdef useDynamicSimulation - _group enableDynamicSimulation false; - #endif - deleteGroup _group; -}; -if (blck_launcherCleanup) then {[_unit] spawn blck_fnc_removeLaunchers;}; -if (blck_removeNVG) then {[_unit] spawn blck_fnc_removeNVG;}; -if !(isPlayer _killer) exitWith {}; -[_unit,_killer] call blck_fnc_alertGroupUnits; -[_killer] call blck_fnc_alertNearbyVehicles; -_group = group _unit; -_wp = [_group, currentWaypoint _group]; -_wp setWaypointBehaviour "COMBAT"; -_group setCombatMode "RED"; -_wp setWaypointCombatMode "RED"; -_isLegal = [_unit,_killer] call blck_fnc_processIlleagalAIKills; -if !(_isLegal) exitWith {}; -_lastkill = _killer getVariable["blck_lastkill",diag_tickTime]; -_killer setVariable["blck_lastkill",diag_tickTime]; -_kills = (_killer getVariable["blck_kills",0]) + 1; -if ((diag_tickTime - _lastkill) < 240) then -{ - _killer setVariable["blck_kills",_kills]; -} else { - _killer setVariable["blck_kills",0]; -}; - -if (blck_useKillMessages) then -{ - _weapon = currentWeapon _killer; - _killstreakMsg = format[" %1X KILLSTREAK",_kills]; - - if (blck_useKilledAIName) then - { - _message = format["[blck] %2: killed by %1 from %3m",name _killer,name _unit,round(_unit distance _killer)]; - }else{ - _message = format["[blck] %1 killed with %2 from %3 meters",name _killer,getText(configFile >> "CfgWeapons" >> _weapon >> "DisplayName"), round(_unit distance _killer)]; - }; - _message =_message + _killstreakMsg; - //diag_log format["[blck] unit killed message is %1",_message,""]; - [["aikilled",_message,"victory"],playableUnits] call blck_fnc_messageplayers; -}; -[_unit,_killer] call blck_fnc_rewardKiller; -if (blck_showCountAliveAI) then -{ - //diag_log "_fnc_processAIKills: Updating Map Marker AI Counts - blck_missionMarkers items are"; - { - //diag_log format["_fnc_processAIKills: blck_missionMarkers itm %1 = %2",_forEachIndex,_x]; - [_x select 0, _x select 1, _x select 2] call blck_fnc_updateMarkerAliveCount; - } forEach blck_missionMarkers; - //call blck_fnc_updateAllMarkerAliveCounts; -}; - diff --git a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnParaUnits - Copy.sqf b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnParaUnits - Copy.sqf deleted file mode 100644 index 90454d1..0000000 --- a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnParaUnits - Copy.sqf +++ /dev/null @@ -1,83 +0,0 @@ -/* - Author: Ghostrider [GRG] - Inspiration: blckeagls / A3EAI / VEMF / IgiLoad / SDROP - License: Attribution-NonCommercial-ShareAlike 4.0 International - 3/17/17 - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; - -params["_missionPos","_paraGroup","_numAI","_skillAI","_weapons","_uniforms","_headGear",["_heli",objNull]]; -private["_arc","_dir","_spawnPos","_chute","_unit","_launcherType","_aborted"]; -_aborted = false; - -#ifdef blck_debugMode -diag_log format["_fnc_spawnParaUnits (17)::_missionPos %1 | _paraGroup %2 | _numAI %3 | _skillAI %4 | _heli = %5",_missionPos,_paraGroup,_numAI,_skillAI,_heli]; -#endif - -if (isNull _paraGroup) then -{ - _aborted = true; -} else { - _paraGroup setVariable["groupVehicle",objNull]; - _launcherType = "none"; - private ["_arc","_spawnPos"]; - _arc = 45; - _dir = 0; - _pos = _missionPos; - for "_i" from 1 to _numAI do - { - if (_heli isKindOf "Air") then {_pos = getPos _heli}; - _spawnPos = _pos getPos[1.5,_dir]; - _chute = createVehicle ["Steerable_Parachute_F", [100, 100, 200], [], 0, "FLY"]; - [_chute] call blck_fnc_protectVehicle; - // params["_pos","_aiGroup",["_skillLevel","red"],["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]],["_scuba",false]]; - _unit = [[_spawnPos select 0, _spawnPos select 1, 100],_paraGroup,_skillAI,_uniforms,_headGear,blck_vests,blck_backpacks,_launcherType,_weapons] call blck_fnc_spawnUnit; - _chute setPos [_spawnPos select 0, _spawnPos select 1, 125]; //(_offset select 2) - 10]; - _unit assignAsDriver _chute; - _unit moveInDriver _chute; - _unit allowDamage true; - _dir = _dir + _arc; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnParaUnits:: spawned unit %1, at location %2 and vehicle _unit %1",_unit,getPos _unit, vehicle _unit]; - }; - #endif - - uiSleep 2; - }; - _paraGroup selectLeader ((units _paraGroup) select 0); - //params["_pos","_minDis","_maxDis","_group"]; - // [_pos,_minDist,_maxDist,_groupSpawned,"random","SAD"] spawn blck_fnc_setupWaypoints; - [_missionPos,20,30,_paraGroup,"random","SAD","paraUnits"] call blck_fnc_setupWaypoints; - blck_monitoredMissionAIGroups pushback _paraGroup; - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log "_fnc_spawnParaUnits (44): All Units spawned"; - }; - #endif - -}; - -#ifdef blck_debugMode -diag_log format["_fnc_spawnParaUnits: _aborted = %1",_aborted]; -#endif - -_aborted; - - - diff --git a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit - Copy.sqf b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit - Copy.sqf deleted file mode 100644 index 45a72de..0000000 --- a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit - Copy.sqf +++ /dev/null @@ -1,192 +0,0 @@ -/* - blck_fnc_spawnUnit - Original Code by blckeagls - Modified by Ghostrider - - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; - -private ["_i","_weap","_skin","_ai1","_skillLevel","_aiSkills","_launcherRound","_index","_ammoChoices","_modType","_optics","_pointers","_muzzles","_underbarrel","_legalOptics"]; -params["_pos","_aiGroup",["_skillLevel","red"],["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]],["_scuba",false]]; -#ifdef blck_debugMode -if (blck_debugLevel > 2) then -{ - private _params = ["_pos","_aiGroup","_skillLevel","_uniforms","_headGear","_vests","_backpacks","_Launcher","_weaponList","_sideArms","_scuba"]; //"_weaponList", "_Launcher" - { - diag_log format["_fnc_spawnUnit::-> _this select %1 (%2) = %3",_forEachIndex, _params select _forEachIndex, _this select _forEachIndex]; - }forEach _this; - //{ - //diag_log format["_fnc_spawnUnit:: _this select %1 = %2",_forEachIndex,_x]; - //}forEach _this; -}; -#endif -if (isNull _aiGroup) exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnUnit"}; - -_ai1 = ObjNull; -_modType = call blck_fnc_getModType; -if (_modType isEqualTo "Epoch") then -{ - "I_Soldier_EPOCH" createUnit [_pos, _aiGroup, "_ai1 = this", blck_baseSkill, "COLONEL"]; - _ai1 setVariable ["LAST_CHECK",28800,true]; - switch(_skillLevel) do - { - case "blue":{_ai1 setVariable["Crypto",1 + floor(random(blck_maxMoneyBlue)),true];}; - case "red":{_ai1 setVariable["Crypto",2 + floor(random(blck_maxMoneyRed)),true];}; - case "green":{_ai1 setVariable["Crypto",3 + floor(random(blck_maxMoneyGreen)),true];}; - case "orange":{_ai1 setVariable["Crypto",4 + floor(random(blck_maxMoneyOrange)),true];}; - }; -}; -if (_modType isEqualTo "Exile") then -{ - "i_g_soldier_unarmed_f" createUnit [_pos, _aiGroup, "_ai1 = this", blck_baseSkill, "COLONEL"]; - switch(_skillLevel) do - { - case "blue":{_ai1 setVariable["ExileMoney",2 + floor(random(blck_maxMoneyBlue)),true];}; - case "red":{_ai1 setVariable["ExileMoney",4 + floor(random(blck_maxMoneyRed)),true];}; - case "green":{_ai1 setVariable["ExileMoney",6 + floor(random(blck_maxMoneyGreen)),true];}; - case "orange":{_ai1 setVariable["ExileMoney",8 + floor(random(blck_maxMoneyOrange)),true];}; - }; -}; -#ifdef blck_debugMode -if (blck_debugLevel >= 2) then -{ - diag_log format["_fnc_spawnUnit::-->> unit spawned = %1",_ai1]; -}; -#endif -[_ai1] call blck_fnc_removeGear; -if (_scuba) then -{ - _ai1 swiminDepth (_pos select 2); - #ifdef blck_debugMode - if (blck_debugLevel >= 2) then - { - diag_log format["_fnc_spawnUnit:: -- >> unit depth = %1 and underwater for unit = %2",_pos select 2, underwater _ai1]; - }; - #endif -}; -_skin = ""; -_counter = 1; -diag_log format["_fnc_spawnUnit: _uniforms = %1",_uniforms]; -while {_skin isEqualTo "" && _counter < 10} do -{ - _ai1 forceAddUniform (selectRandom _uniforms); - _skin = uniform _ai1; - #ifdef blck_debugMode - if (blck_debugLevel > 2) then - { - diag_log format["_fnc_spawnUnit::-->> for unit _ai1 % uniform is %2",_ai1, uniform _ai1]; - }; - #endif - _counter =+1; -}; -//Sets AI Tactics -_ai1 enableAI "ALL"; -_ai1 allowDammage true; -_ai1 setBehaviour "COMBAT"; -_ai1 setunitpos "AUTO"; - -if (count _headGear > 0) then {_ai1 addHeadgear (selectRandom _headGear)}; -if (count _vests > 0) then {_ai1 addVest (selectRandom _vests)}; -if (count _weaponList isEqualTo 0) then {_weaponList = call blck_fnc_selectAILoadout}; -_weap = selectRandom _weaponList; -_ai1 addWeaponGlobal _weap; -_ammoChoices = getArray (configFile >> "CfgWeapons" >> _weap >> "magazines"); -_optics = getArray (configfile >> "CfgWeapons" >> _weap >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems"); -_pointers = getArray (configFile >> "CfgWeapons" >> _weap >> "WeaponSlotsInfo" >> "PointerSlot" >> "compatibleItems"); -_muzzles = getArray (configFile >> "CfgWeapons" >> _weap >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems"); -_underbarrel = getArray (configFile >> "CfgWeapons" >> _weap >> "WeaponSlotsInfo" >> "UnderBarrelSlot" >> "compatibleItems"); -_legalOptics = _optics - blck_blacklistedOptics; - -_ai1 addMagazines [selectRandom _ammoChoices, 3]; - -if (random 1 < 0.4) then {_ai1 addPrimaryWeaponItem (selectRandom _muzzles)}; -if (random 1 < 0.4) then {_ai1 addPrimaryWeaponItem (selectRandom _legalOptics)}; -if (random 1 < 0.4) then {_ai1 addPrimaryWeaponItem (selectRandom _pointers)}; -if (random 1 < 0.4) then {_ai1 addPrimaryWeaponItem (selectRandom _muzzles)}; -if (random 1 < 0.4) then {_ai1 addPrimaryWeaponItem (selectRandom _underbarrel)}; -if ((count(getArray (configFile >> "cfgWeapons" >> _weap >> "muzzles"))) > 1) then -{ - _ai1 addMagazine "1Rnd_HE_Grenade_shell"; -}; - -if (count _sideArms > 0) then -{ - _weap = selectRandom _sideArms; - //diag_log format["[spawnUnit.sqf] _weap os %1",_weap]; - _ai1 addWeaponGlobal _weap; - _ammoChoices = getArray (configFile >> "CfgWeapons" >> _weap >> "magazines"); - _ai1 addMagazines [selectRandom _ammoChoices, 2]; -}; -for "_i" from 1 to (1+floor(random(4))) do -{ - _ai1 addItem (selectRandom blck_ConsumableItems); -}; - -// Add First Aid or Grenade 50% of the time -if (round(random 10) <= 5) then -{ - //diag_log format["spawnUnit.sqf] -- Item is %1", _item]; - _ai1 addItem selectRandom blck_specialItems; -}; - -if (_Launcher != "none" and (count _backpacks > 0)) then -{ - private["_bpck"]; - _ai1 addWeaponGlobal _Launcher; - _ai1 addBackpack (selectRandom _backpacks); - for "_i" from 1 to 3 do - { - _ai1 addItemToBackpack (getArray (configFile >> "CfgWeapons" >> _Launcher >> "magazines") select 0); // call BIS_fnc_selectRandom; - }; - _ai1 setVariable["Launcher",_launcher,true]; -} else { - if ( random (1) < blck_chanceBackpack and (count _backpacks > 0)) then - { - _ai1 addBackpack selectRandom _backpacks; - }; -}; - -if(sunOrMoon < 0.2 && blck_useNVG)then -{ - _ai1 addWeapon selectRandom blck_NVG; - _ai1 setVariable ["hasNVG", true,true]; -} -else -{ - _ai1 setVariable ["hasNVG", false,true]; -}; - -#ifdef blck_debugMode -if (blck_debugLevel > 2) then -{ - diag_log format["_fnc_spawnUnit:: --> unit loadout = %1", getUnitLoadout _ai1]; -}; -#endif - -_ai1 addEventHandler ["Reloaded", {_this call compile preprocessfilelinenumbers blck_EH_unitWeaponReloaded;}]; -_ai1 addMPEventHandler ["MPKilled", {[(_this select 0), (_this select 1)] call compile preprocessfilelinenumbers blck_EH_AIKilled;}]; // changed to reduce number of concurrent threads, but also works as spawn blck_AIKilled; }]; -_ai1 addMPEventHandler ["MPHit",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIHit;}]; - -switch (_skillLevel) do -{ - case "blue": {_index = 0;_aiSkills = blck_SkillsBlue;}; - case "red": {_index = 1;_aiSkills = blck_SkillsRed;}; - case "green": {_index = 2;_aiSkills = blck_SkillsGreen;}; - case "orange": {_index = 3;_aiSkills = blck_SkillsOrange;}; - default {_index = 0;_aiSkills = blck_SkillsBlue;}; -}; - -[_ai1,_aiSkills] call blck_fnc_setSkill; -_ai1 setVariable ["alertDist",blck_AIAlertDistance select _index,true]; -_ai1 setVariable ["intelligence",blck_AIIntelligence select _index,true]; -_ai1 setVariable ["GMS_AI",true,true]; - -_ai1 - - diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnMissionHeli - Copy (2).sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnMissionHeli - Copy (2).sqf deleted file mode 100644 index 6547113..0000000 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnMissionHeli - Copy (2).sqf +++ /dev/null @@ -1,200 +0,0 @@ -/* - - By Ghostrider [GRG] - Copyright 2016 - - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; -private["_grpPilot","_chopperType","_patrolHeli","_launcherType","_unitPilot","_unitCrew","_mags","_turret","_return","_abort","_supplyHeli"]; -params["_coords","_skillAI","_weapons","_uniforms","_headGear","_helis",["_chanceParas",0]]; - -//diag_log format["_fnc_spawnMissionHeli:: _this = %1",_this]; -//diag_log format["_fnc_spawnMissionHeli:: _helis = %1 && _chanceParas = %2",_helis,_chanceParas]; -/* - Handles upper level functions of reinforcements utilizing helicoptor patrols and/or spawned from a helicopter. - Calls on functions that spawn paratroops and/or loot chests at the heli's location. - - Tasks are: - 1) spawn a heli over the mission center. - 2) add crew and gunners - 3) spawn paratroops if needed - 4) configure waypointScript - 5) return the _heli that was spawned. -*/ -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["_fnc_spawnMissionHeli (38):: _helis = %1",_helis]; -}; -#endif - -_abort = false; -_grpPilot = createGroup blck_AI_Side; -if (isNull _grpPilot) then -{ - diag_log "BLCK_ERROR: _fnc_spawnMissionHeli::_->> NULL GROUP Returned for _grpPilot"; - _abort = true; -}; - -if !(isNull _grpPilot) then -{ - _grpPilot setBehaviour "COMBAT"; - _grpPilot setCombatMode "RED"; - _grpPilot setSpeedMode "NORMAL"; - _grpPilot allowFleeing 0; - _grpPilot setVariable["patrolCenter",_coords]; - _grpPilot setVariable["minDis",15]; - _grpPilot setVariable["maxDis",30]; - _grpPilot setVariable["timeStamp",diag_tickTime]; - _grpPilot setVariable["arc",0]; - _grpPilot setVariable["wpRadius",30]; - _grpPilot setVariable["wpMode","SAD"]; - - //create helicopter and spawn it - if (( typeName _helis) isEqualTo "ARRAY") then - { - _chopperType = selectRandom _helis - } else { - _chopperType = _helis - }; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (78):: _chopperType selected = %1",_chopperType]; - }; - #endif - - _patrolHeli = createVehicle [_chopperType, _coords, [], 90, "FLY"]; - _grpPilot setVariable["groupVehicle",_patrolHeli]; - [_patrolHeli] call blck_fnc_protectVehicle; - _patrolHeli setFuel 1; - _patrolHeli engineOn true; - _patrolHeli flyInHeight 100; - _patrolHeli setVehicleLock "LOCKED"; - //_patrolHeli addEventHandler ["GetOut",{(_this select 0) setFuel 0;(_this select 0) setDamage 1;}]; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (93):: heli %1 spawned",_patrolHeli]; - }; - #endif - - [_patrolHeli] call blck_fnc_emptyObject; - - _launcherType = "none"; - //params["_pos","_aiGroup",["_skillLevel","red"],["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]],["_scuba",false]]; - _unitPilot = [[100,100,100],_grpPilot,_skillAI,_uniforms,_headGear_weapons] call blck_fnc_spawnUnit; - _unitPilot setSkill 1; - _unitPilot assignAsDriver _patrolHeli; - _unitPilot moveInDriver _patrolHeli; - _grpPilot selectLeader _unitPilot; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (113):: pilot %1 spawned",_unitPilot]; - }; - #endif - - _turrets = allTurrets [_patrolHeli,false]; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log "_fnc_spawnMissionHeli (103): preparing to clear out blacklisted turrets"; - }; - #endif - - { - if ( (_patrolHeli weaponsTurret _x) in blck_blacklisted_heli_weapons) then - { - private["_mags","_turret"]; - _mags = _patrolHeli magazinesTurret _x; - _turret = _x; - { - _patrolHeli removeMagazines [_x,_turret]; - } forEach _mags; - _patrolHeli removeWeaponTurret _turret; - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (118)::-->> weapon %1 and its ammo removed from heli %2 for turret %3",_patrolHeli weaponsTurret _x,_patrolHeli, _x]; - }; - } - else - { - //params["_pos","_aiGroup",["_skillLevel","red"],["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]],["_scuba",false]]; - _unitCrew = [(getPosATL _patrolHeli),_grpPilot,_skillAI,_uniforms,_headGear] call blck_fnc_spawnUnit; - _unitCrew assignAsTurret [_patrolHeli, _x]; - _unitCrew moveInTurret [_patrolHeli, _x]; - - #ifdef blck_debugMode - diag_log format["_fnc_spawnMissionHeli (12798)::-- >> unit %1 moved into turret %2 of vehicle %3",_unitCrew,_x,_patrolHeli]; - #endif - }; - }forEach _turrets; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (133)::-->> Heli %1 outfited with a crew numbering %2",_patrolHeli, crew _patrolHeli]; - }; - #endif - - /* - if (random(1) < _chanceParas) then - { - _grpParatroops = createGroup blck_AI_Side; - if (isNull _grpParatroops) then - { - diag_log "BLCK_ERROR: _fnc_spawnMissionHeli::_->> NULL GROUP Returned for _grpParatroops"; - _abort = true; - }; - // params["_missionPos","_paraGroup",["_numAI",3],"_skillAI","_weapons","_uniforms","_headGear",["_heli",objNull],_grpParatroops]; - //params["_coords","_skillAI","_weapons","_uniforms","_headGear",["_grpParatroops",grpNull],["_heli",objNull]]; - if !(isNull _grpParatroops) then - { - [_coords,_skillAI,_weapons,_uniforms,_headGear,_grpParatroops,_patrolHeli] call blck_fnc_spawnMissionParatroops; - }; - }; - //set waypoint for helicopter - [_coords,30,35,_grpPilot,"random","SAD"] spawn blck_fnc_setupWaypoints; - */ - blck_monitoredMissionAIGroups pushBack _grpPilot; - /* - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (153):: initial pilot waypoints set"]; - [_patrolHeli] spawn { - params["_patrolHeli"]; - diag_log "_fnc_spawnMissionHeli:-> spawning crew monitoring loop"; - while {!isNull _patrolHeli} do - { - uiSleep 120; - diag_log format["_fnc_spawnMissionHeli:-> heli %1 has %2 crew alive",_patrolHeli, {alive _x} count crew _patrolHeli]; - diag_log format["_fnc_spawnMissionHeli:-> heli %1 fullCrew = %2",_patrolHeli, fullCrew _patrolHeli]; - }; - }; - }; - #endif - */ -}; -diag_log format["[blckeagls] _fnc_spawnMissionHeli:: _patrolHeli %1 | _grpPilot %2 | _abort %3",_patrolHeli,_grpPilot,_abort]; -_return = [_patrolHeli,units _grpPilot,_abort]; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["_fnc_spawnMissionHeli:: function returning value for _return of %1",_return]; -}; -#endif -diag_log format["_fnc_spawnMissionHeli:: function returning value for _return of %1",_return]; -_return; diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnMissionHeli - Copy (3).sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnMissionHeli - Copy (3).sqf deleted file mode 100644 index 88ea996..0000000 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnMissionHeli - Copy (3).sqf +++ /dev/null @@ -1,151 +0,0 @@ -/* - - By Ghostrider [GRG] - Copyright 2016 - - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; -private["_grpPilot","_chopperType","_patrolHeli","_launcherType","_unitPilot","_unitCrew","_mags","_turret","_return","_abort","_supplyHeli"]; -params["_coords","_skillAI","_helis",["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]], ["_sideArms",[]] ]; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["_fnc_spawnMissionHeli (38):: _helis = %1",_helis]; -}; -#endif - -_abort = false; -_grpPilot = createGroup blck_AI_Side; -if (isNull _grpPilot) then -{ - diag_log "BLCK_ERROR: _fnc_spawnMissionHeli::_->> NULL GROUP Returned for _grpPilot"; - _abort = true; -}; - -if !(isNull _grpPilot) then -{ - _grpPilot setBehaviour "COMBAT"; - _grpPilot setCombatMode "RED"; - _grpPilot setSpeedMode "NORMAL"; - _grpPilot allowFleeing 0; - _grpPilot setVariable["patrolCenter",_coords]; - _grpPilot setVariable["minDis",15]; - _grpPilot setVariable["maxDis",30]; - _grpPilot setVariable["timeStamp",diag_tickTime]; - _grpPilot setVariable["arc",0]; - _grpPilot setVariable["wpRadius",30]; - _grpPilot setVariable["wpMode","SAD"]; - - //create helicopter and spawn it - if (( typeName _helis) isEqualTo "ARRAY") then - { - _chopperType = selectRandom _helis - } else { - _chopperType = _helis - }; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (78):: _chopperType selected = %1",_chopperType]; - }; - #endif - - _patrolHeli = createVehicle [_chopperType, _coords, [], 90, "FLY"]; - _grpPilot setVariable["groupVehicle",_patrolHeli]; - [_patrolHeli] call blck_fnc_protectVehicle; - _patrolHeli setFuel 1; - _patrolHeli engineOn true; - _patrolHeli flyInHeight 100; - _patrolHeli setVehicleLock "LOCKED"; - //_patrolHeli addEventHandler ["GetOut",{(_this select 0) setFuel 0;(_this select 0) setDamage 1;}]; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (93):: heli %1 spawned",_patrolHeli]; - }; - #endif - - [_patrolHeli] call blck_fnc_emptyObject; - - _launcherType = "none"; - //params["_pos","_aiGroup",["_skillLevel","red"],["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]],["_scuba",false]]; - _unitPilot = [[100,100,100],_grpPilot,_skillAI,_uniforms,_headGear,_vests,_backpacks,_Launcher,_weaponList,_sideArms] call blck_fnc_spawnUnit; - _unitPilot setSkill 1; - _unitPilot assignAsDriver _patrolHeli; - _unitPilot moveInDriver _patrolHeli; - _grpPilot selectLeader _unitPilot; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (113):: pilot %1 spawned",_unitPilot]; - }; - #endif - - _turrets = allTurrets [_patrolHeli,false]; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log "_fnc_spawnMissionHeli (103): preparing to clear out blacklisted turrets"; - }; - #endif - - { - if ( (_patrolHeli weaponsTurret _x) in blck_blacklisted_heli_weapons) then - { - private["_mags","_turret"]; - _mags = _patrolHeli magazinesTurret _x; - _turret = _x; - { - _patrolHeli removeMagazines [_x,_turret]; - } forEach _mags; - _patrolHeli removeWeaponTurret _turret; - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (118)::-->> weapon %1 and its ammo removed from heli %2 for turret %3",_patrolHeli weaponsTurret _x,_patrolHeli, _x]; - }; - } - else - { - //params["_pos","_aiGroup",["_skillLevel","red"],["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]],["_scuba",false]]; - //_unitCrew = [(getPosATL _patrolHeli),_grpPilot,_skillAI,_uniforms,_headGear] call blck_fnc_spawnUnit; - _unitCrew = [(getPosATL _patrolHeli),_grpPilot,_skillAI,_uniforms,_headGear,_vests,_backpacks,_Launcher,_weaponList,_sideArms] call blck_fnc_spawnUnit; - _unitCrew assignAsTurret [_patrolHeli, _x]; - _unitCrew moveInTurret [_patrolHeli, _x]; - - #ifdef blck_debugMode - diag_log format["_fnc_spawnMissionHeli (12798)::-- >> unit %1 moved into turret %2 of vehicle %3",_unitCrew,_x,_patrolHeli]; - #endif - }; - }forEach _turrets; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (133)::-->> Heli %1 outfited with a crew numbering %2",_patrolHeli, crew _patrolHeli]; - }; - #endif - - blck_monitoredMissionAIGroups pushBack _grpPilot; -}; -//diag_log format["[blckeagls] _fnc_spawnMissionHeli:: _patrolHeli %1 | _grpPilot %2 | _abort %3",_patrolHeli,_grpPilot,_abort]; -_return = [_patrolHeli,units _grpPilot,_abort]; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["_fnc_spawnMissionHeli:: function returning value for _return of %1",_return]; -}; -#endif -diag_log format["_fnc_spawnMissionHeli:: function returning value for _return of %1",_return]; -_return; diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnMissionHeli - Copy - Copy - Copy.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnMissionHeli - Copy - Copy - Copy.sqf deleted file mode 100644 index b76133e..0000000 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnMissionHeli - Copy - Copy - Copy.sqf +++ /dev/null @@ -1,209 +0,0 @@ -/* - for ghostridergaming - By Ghostrider [GRG] - Copyright 2016 - Last Modified 8-15-17 - - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; - -params["_coords","_skillAI","_weapons","_uniforms","_headGear","_helis",["_chanceParas",0]]; -/* -_coords = _this select 0; -_skillAI = _this select 1; -_weapons = _this select 2; -_uniforms = _this select 3; -_headGear = _this select 4; -_helis = _this select 5; -*/ -//diag_log format["_fnc_spawnMissionHeli:: _this = %1",_this]; -//diag_log format["_fnc_spawnMissionHeli:: _helis = %1 && _chanceParas = %2",_helis,_chanceParas]; -/* - Handles upper level functions of reinforcements utilizing helicoptor patrols and/or spawned from a helicopter. - Calls on functions that spawn paratroops and/or loot chests at the heli's location. - - Tasks are: - 1) spawn a heli over the mission center. - 2) add crew and gunners - 3) spawn paratroops if needed - 4) configure waypointScript - 5) return the _heli that was spawned. -*/ -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["_fnc_spawnMissionHeli (38):: _helis = %1",_helis]; -}; -#endif - -private["_grpPilot","_chopperType","_patrolHeli","_launcherType","_unitPilot","_unitCrew","_mags","_turret","_return","_abort"]; -_abort = false; -_grpParatroops = grpNull; -_grpPilot = createGroup blck_AI_Side; -if (isNull _grpPilot) then -{ - diag_log "BLCK_ERROR: _fnc_spawnMissionHeli::_->> NULL GROUP Returned for _grpPilot"; - _abort = true; -}; - -if !(isNull _grpPilot) then -{ - _grpPilot setBehaviour "COMBAT"; - _grpPilot setCombatMode "RED"; - _grpPilot setSpeedMode "NORMAL"; - _grpPilot allowFleeing 0; - _grpPilot setVariable["patrolCenter",_coords]; - _grpPilot setVariable["minDis",15]; - _grpPilot setVariable["maxDis",30]; - _grpPilot setVariable["timeStamp",diag_tickTime]; - _grpPilot setVariable["arc",0]; - _grpPilot setVariable["wpRadius",30]; - _grpPilot setVariable["wpMode","SAD"]; - - private["_supplyHeli"]; - //create helicopter and spawn it - if (( typeName _helis) isEqualTo "ARRAY") then {_chopperType = selectRandom _helis} - else - {_chopperType = _helis}; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (78):: _chopperType seleted = %1",_chopperType]; - }; - #endif - - _patrolHeli = createVehicle [_chopperType, _coords, [], 90, "FLY"]; - _grpPilot setVariable["groupVehicle",_patrolHeli]; - [_patrolHeli] call blck_fnc_protectVehicle; - _patrolHeli setFuel 1; - _patrolHeli engineOn true; - _patrolHeli flyInHeight 100; - _patrolHeli setVehicleLock "LOCKED"; - _patrolHeli addEventHandler ["GetOut",{(_this select 0) setFuel 0;(_this select 0) setDamage 1;}]; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (93):: heli %1 spawned",_patrolHeli]; - }; - #endif - - [_patrolHeli] call blck_fnc_emptyObject; - - _launcherType = "none"; - _unitPilot = _grpPilot createUnit ["I_helipilot_F", getPos _patrolHeli, [], 0, "FORM"]; - _unitPilot = [[100,100,100],_weapons,_grpPilot,_skillAI,_launcherType,_uniforms,_headGear] call blck_fnc_spawnAI; - _unitPilot setSkill 1; - _unitPilot assignAsDriver _patrolHeli; - _unitPilot moveInDriver _patrolHeli; - _grpPilot selectLeader _unitPilot; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (113):: pilot %1 spawned",_unitPilot]; - }; - #endif - - _turrets = allTurrets [_patrolHeli,false]; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log "_fnc_spawnMissionHeli (103): preparing to clear out blacklisted turrets"; - }; - #endif - - { - if ( (_patrolHeli weaponsTurret _x) in blck_blacklisted_heli_weapons) then - { - private["_mags","_turret"]; - _mags = _patrolHeli magazinesTurret _x; - _turret = _x; - { - _patrolHeli removeMagazines [_x,_turret]; - } forEach _mags; - _patrolHeli removeWeaponTurret _turret; - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (118)::-->> weapon %1 and its ammo removed from heli %2 for turret %3",_patrolHeli weaponsTurret _x,_patrolHeli, _x]; - }; - } - else - { - // B_helicrew_F - _unitCrew = [(getPosATL _patrolHeli),_weapons,_grpPilot,_skillAI,_launcherType,_uniforms,_headGear] call blck_fnc_spawnAI; - _unitCrew assignAsTurret [_patrolHeli, _x]; - _unitCrew moveInTurret [_patrolHeli, _x]; - - #ifdef blck_debugMode - diag_log format["_fnc_spawnMissionHeli (12798)::-- >> unit %1 moved into turret %2 of vehicle %3",_unitCrew,_x,_patrolHeli]; - #endif - }; - }forEach _turrets; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (133)::-->> Heli %1 outfited with a crew numbering %2",_patrolHeli, crew _patrolHeli]; - }; - #endif - - if (random(1) < _chanceParas) then - { - _grpParatroops = createGroup blck_AI_Side; - if (isNull _grpParatroops) then - { - diag_log "BLCK_ERROR: _fnc_spawnMissionHeli::_->> NULL GROUP Returned for _grpParatroops"; - _abort = true; - }; - // params["_missionPos","_paraGroup",["_numAI",3],"_skillAI","_weapons","_uniforms","_headGear",["_heli",objNull],_grpParatroops]; - //params["_coords","_skillAI","_weapons","_uniforms","_headGear",["_grpParatroops",grpNull],["_heli",objNull]]; - if !(isNull _grpParatroops) then - { - [_coords,_skillAI,_weapons,_uniforms,_headGear,_grpParatroops,_patrolHeli] call blck_fnc_spawnMissionParatroops; - }; - }; - //set waypoint for helicopter - [_coords,30,35,_grpPilot,"random","SAD"] spawn blck_fnc_setupWaypoints; - - blck_monitoredMissionAIGroups pushBack _grpPilot; - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (153):: initial pilot waypoints set"]; - [_patrolHeli] spawn { - params["_patrolHeli"]; - diag_log "_fnc_spawnMissionHeli:-> spawning crew monitoring loop"; - while {!isNull _patrolHeli} do - { - uiSleep 120; - diag_log format["_fnc_spawnMissionHeli:-> heli %1 has %2 crew alive",_patrolHeli, {alive _x} count crew _patrolHeli]; - diag_log format["_fnc_spawnMissionHeli:-> heli %1 fullCrew = %2",_patrolHeli, fullCrew _patrolHeli]; - }; - }; - }; - #endif - -}; -private["_ai"]; -_ai = (units _grpPilot); -if !(isNull _grpParatroops) then {_ai = _ai + (units _grpParatroops);}; - -_return = [_patrolHeli,_ai,_abort]; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["_fnc_spawnMissionHeli:: function returning value for _return of %1",_return]; -}; -#endif - -_return; diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnMissionHeli - Copy.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnMissionHeli - Copy.sqf deleted file mode 100644 index cbd3a3c..0000000 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnMissionHeli - Copy.sqf +++ /dev/null @@ -1,209 +0,0 @@ -/* - for ghostridergaming - By Ghostrider [GRG] - Copyright 2016 - Last Modified 8-15-17 - - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; - -params["_coords","_skillAI","_weapons","_uniforms","_headGear","_helis",["_chanceParas",0]]; -/* -_coords = _this select 0; -_skillAI = _this select 1; -_weapons = _this select 2; -_uniforms = _this select 3; -_headGear = _this select 4; -_helis = _this select 5; -*/ -//diag_log format["_fnc_spawnMissionHeli:: _this = %1",_this]; -//diag_log format["_fnc_spawnMissionHeli:: _helis = %1 && _chanceParas = %2",_helis,_chanceParas]; -/* - Handles upper level functions of reinforcements utilizing helicoptor patrols and/or spawned from a helicopter. - Calls on functions that spawn paratroops and/or loot chests at the heli's location. - - Tasks are: - 1) spawn a heli over the mission center. - 2) add crew and gunners - 3) spawn paratroops if needed - 4) configure waypointScript - 5) return the _heli that was spawned. -*/ -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["_fnc_spawnMissionHeli (38):: _helis = %1",_helis]; -}; -#endif - -private["_grpPilot","_chopperType","_patrolHeli","_launcherType","_unitPilot","_unitCrew","_mags","_turret","_return","_abort"]; -_abort = false; -_grpParatroops = grpNull; -_grpPilot = createGroup blck_AI_Side; -if (isNull _grpPilot) then -{ - diag_log "BLCK_ERROR: _fnc_spawnMissionHeli::_->> NULL GROUP Returned for _grpPilot"; - _abort = true; -}; - -if !(isNull _grpPilot) then -{ - _grpPilot setBehaviour "COMBAT"; - _grpPilot setCombatMode "RED"; - _grpPilot setSpeedMode "NORMAL"; - _grpPilot allowFleeing 0; - _grpPilot setVariable["patrolCenter",_coords]; - _grpPilot setVariable["minDis",15]; - _grpPilot setVariable["maxDis",30]; - _grpPilot setVariable["timeStamp",diag_tickTime]; - _grpPilot setVariable["arc",0]; - _grpPilot setVariable["wpRadius",30]; - _grpPilot setVariable["wpMode","SAD"]; - - private["_supplyHeli"]; - //create helicopter and spawn it - if (( typeName _helis) isEqualTo "ARRAY") then {_chopperType = selectRandom _helis} - else - {_chopperType = _helis}; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (78):: _chopperType seleted = %1",_chopperType]; - }; - #endif - - _patrolHeli = createVehicle [_chopperType, _coords, [], 90, "FLY"]; - _grpPilot setVariable["groupVehicle",_patrolHeli]; - [_patrolHeli] call blck_fnc_protectVehicle; - _patrolHeli setFuel 1; - _patrolHeli engineOn true; - _patrolHeli flyInHeight 100; - _patrolHeli setVehicleLock "LOCKED"; - _patrolHeli addEventHandler ["GetOut",{(_this select 0) setFuel 0;(_this select 0) setDamage 1;}]; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (93):: heli %1 spawned",_patrolHeli]; - }; - #endif - - [_patrolHeli] call blck_fnc_emptyObject; - - _launcherType = "none"; - _unitPilot = _grpPilot createUnit ["I_helipilot_F", getPos _patrolHeli, [], 0, "FORM"]; - _unitPilot = [[100,100,100],_weapons,_grpPilot,_skillAI,_launcherType,_uniforms,_headGear] call blck_fnc_spawnUnit; - _unitPilot setSkill 1; - _unitPilot assignAsDriver _patrolHeli; - _unitPilot moveInDriver _patrolHeli; - _grpPilot selectLeader _unitPilot; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (113):: pilot %1 spawned",_unitPilot]; - }; - #endif - - _turrets = allTurrets [_patrolHeli,false]; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log "_fnc_spawnMissionHeli (103): preparing to clear out blacklisted turrets"; - }; - #endif - - { - if ( (_patrolHeli weaponsTurret _x) in blck_blacklisted_heli_weapons) then - { - private["_mags","_turret"]; - _mags = _patrolHeli magazinesTurret _x; - _turret = _x; - { - _patrolHeli removeMagazines [_x,_turret]; - } forEach _mags; - _patrolHeli removeWeaponTurret _turret; - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (118)::-->> weapon %1 and its ammo removed from heli %2 for turret %3",_patrolHeli weaponsTurret _x,_patrolHeli, _x]; - }; - } - else - { - // B_helicrew_F - _unitCrew = [(getPosATL _patrolHeli),_weapons,_grpPilot,_skillAI,_launcherType,_uniforms,_headGear] call blck_fnc_spawnUnit; - _unitCrew assignAsTurret [_patrolHeli, _x]; - _unitCrew moveInTurret [_patrolHeli, _x]; - - #ifdef blck_debugMode - diag_log format["_fnc_spawnMissionHeli (12798)::-- >> unit %1 moved into turret %2 of vehicle %3",_unitCrew,_x,_patrolHeli]; - #endif - }; - }forEach _turrets; - - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (133)::-->> Heli %1 outfited with a crew numbering %2",_patrolHeli, crew _patrolHeli]; - }; - #endif - - if (random(1) < _chanceParas) then - { - _grpParatroops = createGroup blck_AI_Side; - if (isNull _grpParatroops) then - { - diag_log "BLCK_ERROR: _fnc_spawnMissionHeli::_->> NULL GROUP Returned for _grpParatroops"; - _abort = true; - }; - // params["_missionPos","_paraGroup",["_numAI",3],"_skillAI","_weapons","_uniforms","_headGear",["_heli",objNull],_grpParatroops]; - //params["_coords","_skillAI","_weapons","_uniforms","_headGear",["_grpParatroops",grpNull],["_heli",objNull]]; - if !(isNull _grpParatroops) then - { - [_coords,_skillAI,_weapons,_uniforms,_headGear,_grpParatroops,_patrolHeli] call blck_fnc_spawnMissionParatroops; - }; - }; - //set waypoint for helicopter - [_coords,30,35,_grpPilot,"random","SAD"] spawn blck_fnc_setupWaypoints; - - blck_monitoredMissionAIGroups pushBack _grpPilot; - #ifdef blck_debugMode - if (blck_debugLevel > 1) then - { - diag_log format["_fnc_spawnMissionHeli (153):: initial pilot waypoints set"]; - [_patrolHeli] spawn { - params["_patrolHeli"]; - diag_log "_fnc_spawnMissionHeli:-> spawning crew monitoring loop"; - while {!isNull _patrolHeli} do - { - uiSleep 120; - diag_log format["_fnc_spawnMissionHeli:-> heli %1 has %2 crew alive",_patrolHeli, {alive _x} count crew _patrolHeli]; - diag_log format["_fnc_spawnMissionHeli:-> heli %1 fullCrew = %2",_patrolHeli, fullCrew _patrolHeli]; - }; - }; - }; - #endif - -}; -private["_ai"]; -_ai = (units _grpPilot); -if !(isNull _grpParatroops) then {_ai = _ai + (units _grpParatroops);}; - -_return = [_patrolHeli,_ai,_abort]; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["_fnc_spawnMissionHeli:: function returning value for _return of %1",_return]; -}; -#endif - -_return;