diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_restoreHiddenObjects.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_restoreHiddenObjects.sqf new file mode 100644 index 0000000..4a3b2e6 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_restoreHiddenObjects.sqf @@ -0,0 +1,27 @@ +/* + 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"; + + +for "_i" from 1 to (count blck_hiddenTerrainObjects) do +{ + if (_i > (count blck_hiddenTerrainObjects)) exitWith {}; + private _el = blck_hiddenTerrainObjects deleteAt 0; + diag_log format["_restoreHiddenObjects: _el = %1 | blck_hiddenTerrainObjects = %2",_el,blck_hiddenTerrainObjects]; + _el params["_obj","_timeout"]; + diag_log format["_restoreHiddenObjects: _timeOut = %1 | _obj = %2",_timeout,_obj]; + if (diag_tickTime > _timeOut) then + { + {_x hideObjectGlobal false} forEach _obj; + } else { + blck_hiddenTerrainObjects pushBack _el; + }; +}; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf index 841b52c..5186a8c 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf @@ -56,6 +56,22 @@ params[ ["_isScubaMission",false] ]; +/* +{ + diag_log format["_endMission: %1 = %2",_x, _this select _forEachIndex]; +} forEach [ "_coords", + "_mines", + "_objects", + "_hiddenObjects", + "_crates", + "_blck_AllMissionAI", + "_endMsg", + "_markers", + "_markerPos", + "_markerName", + "_markerLabel" + ]; +*/ { [_x] call blck_fnc_deleteMarker; }forEach (_markers); @@ -70,7 +86,7 @@ switch (_endCondition) do if (local _x) then {deleteVehicle _x}; }forEach _crates; - [_coords,_mines,_objects,_hiddenObjects,_blck_AllMissionAI,_markerName,cleanupAliveAITimer,cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup; + [_coords,_mines,_objects,_simpleObjects,_hiddenObjects,_blck_AllMissionAI,_markerName,cleanupAliveAITimer,cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup; [format["Mission | _coords %1 : _markerClass %2 : _markerMissionName %3",_coords,_markerName,_markerLabel]] call blck_fnc_log; }; case 1: { // Normal End diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_initializeMission.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_initializeMission.sqf index 3693cef..2592e51 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_initializeMission.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_initializeMission.sqf @@ -50,6 +50,7 @@ _missionParameters params[ "_garrisonedBuildings_BuildingPosnSystem", "_garrisonedBuilding_ATLsystem", "_missionLandscape", + "_simpleObjects", "_missionLootBoxes", "_missionLootVehicles", "_missionPatrolVehicles", diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf index 130baa9..755076a 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -15,7 +15,7 @@ #define delayTime 1 private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_assetKilledMsg","_enemyLeaderConfig", "_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups","_loadCratesTiming","_spawnCratesTiming","_assetSpawned","_hostageConfig", - "_chanceHeliPatrol","_noPara","_chanceLoot","_heliCrew","_loadCratesTiming","_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius", + "_chanceHeliPatrol","_noPara","_chanceLoot","_heliCrew","_loadCratesTiming","_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius","_simpleObjects", "_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_noChoppers","_chancePara","_paraSkill","_marker","_vehicleCrewCount", "_defaultMissionLocations","_garrisonedbuildings_buildingposnsystem","_garrisonedBuilding_ATLsystem", "_isScubaMission","_markerlabel","_missionLootBoxes","_airpatrols"]; @@ -66,6 +66,7 @@ if (isNil "_lootCratePositions") then {_lootCratePositions = []}; if (isNil "_isScubaMission") then {_isScubaMission = false}; if (isNil "_missionLootBoxes") then {_missionLootBoxes = []}; if (isNil "_defaultMissionLocations") then {_defaultMissionLocations = []}; +if (isNil "_simpleObjects") then {_simpleObjects = []}; if !(_defaultMissionLocations isEqualTo []) then { _coords = selectRandom _defaultMissionLocations; @@ -106,6 +107,7 @@ private _table = [ _garrisonedBuildings_BuildingPosnSystem, _garrisonedBuilding_ATLsystem, _missionLandscape, + _simpleObjects, _missionLootBoxes, _missionLootVehicles, _missionPatrolVehicles, diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_monitorInitializedMissions.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_monitorInitializedMissions.sqf index a42d191..8aad41b 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_monitorInitializedMissions.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_monitorInitializedMissions.sqf @@ -3,6 +3,11 @@ by Ghostrider-GRG- */ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +#define missionData 4 +#define noActive 2 +#define waitTime 5 + for "_i" from 1 to (count blck_activeMissionsList) do { @@ -16,14 +21,10 @@ for "_i" from 1 to (count blck_activeMissionsList) do "_missionTimeoutAt", // 1 "_triggered", // 2 "_spawnPara", // 3 - "_missionData", // 6 - "_missionParameters" // 7 + "_missionData", // 4 + "_missionParameters" // 5 ]; - #define noActive 2 - #define waitTime 5 - #define missionData 6 - _missionCategoryDescriptors params [ "_difficulty", "_noMissions", // Max no missions of this category @@ -33,64 +34,75 @@ for "_i" from 1 to (count blck_activeMissionsList) do "_waitTime", // time at which a mission should be spawned "_missionsData" // ]; - - _missionData params ["_coords","_mines","_objects","_hiddenObjects","_crates","_blck_AllMissionAI","_assetSpawned","_missionAIVehicles","_markers"]; + //_missionData = [_coords,_mines,_objects,_hiddenObjects,_crates,_blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_markers]; + _missionData params [ + "_coords", + "_mines", + "_objects", + "_hiddenObjects", + "_crates", + "_blck_AllMissionAI", + "_assetSpawned", + "_missionAIVehicles", + "_markers" + ]; -_missionParameters params[ - "_markerName", - "_markerMissionName", - "_endMsg", - "_startMsg", - "_defaultMissionLocations", - "_crateLoot", - "_lootCounts", - "_markerType", - "_markerColor", - "_markerSize", - "_markerBrush", - "_missionLandscapeMode", - "_garrisonedBuildings_BuildingPosnSystem", - "_garrisonedBuilding_ATLsystem", - "_missionLandscape", - "_missionLootBoxes", - "_missionLootVehicles", - "_missionPatrolVehicles", - "_submarinePatrolParameters", - "_airPatrols", - "_noVehiclePatrols", - "_vehicleCrewCount", - "_missionEmplacedWeapons", - "_noEmplacedWeapons", - "_useMines", - "_minNoAI", - "_maxNoAI", - "_noAIGroups", - "_missionGroups", - "_scubaGroupParameters", - "_hostageConfig", - "_enemyLeaderConfig", - "_assetKilledMsg", - "_uniforms", - "_headgear", - "_vests", - "_backpacks", - "_weaponList", - "_sideArms", - "_chanceHeliPatrol", - "_noChoppers", - "_missionHelis", - "_chancePara", - "_noPara", - "_paraTriggerDistance", - "_paraSkill", - "_chanceLoot", - "_paraLoot", - "_paraLootCounts", - "_spawnCratesTiming", - "_loadCratesTiming", - "_endCondition", - "_isScubaMission" -]; + _missionParameters params[ + "_markerName", + "_markerMissionName", + "_endMsg", + "_startMsg", + "_defaultMissionLocations", + "_crateLoot", + "_lootCounts", + "_markerType", + "_markerColor", + "_markerSize", + "_markerBrush", + "_missionLandscapeMode", + "_garrisonedBuildings_BuildingPosnSystem", + "_garrisonedBuilding_ATLsystem", + "_missionLandscape", + "_simpleObjects", + "_missionLootBoxes", + "_missionLootVehicles", + "_missionPatrolVehicles", + "_submarinePatrolParameters", + "_airPatrols", + "_noVehiclePatrols", + "_vehicleCrewCount", + "_missionEmplacedWeapons", + "_noEmplacedWeapons", + "_useMines", + "_minNoAI", + "_maxNoAI", + "_noAIGroups", + "_missionGroups", + "_scubaGroupParameters", + "_hostageConfig", + "_enemyLeaderConfig", + "_assetKilledMsg", + "_uniforms", + "_headgear", + "_vests", + "_backpacks", + "_weaponList", + "_sideArms", + "_chanceHeliPatrol", + "_noChoppers", + "_missionHelis", + "_chancePara", + "_noPara", + "_paraTriggerDistance", + "_paraSkill", + "_chanceLoot", + "_paraLoot", + "_paraLootCounts", + "_spawnCratesTiming", + "_loadCratesTiming", + "_endCondition", + "_isScubaMission" + ]; private _playerInRange = [_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange; #define delayTime 1 @@ -161,6 +173,9 @@ _missionParameters params[ _hiddenObjects append [_temp select 1]; uiSleep delayTime; + _temp = [_coords,_simpleObjects,true] call blck_fnc_spawnSimpleObjects; + _objects append _temp; + try { _temp = [_coords, _minNoAI,_maxNoAI,_noAIGroups,_missionGroups,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionAI; _temp params["_ai","_abort"]; @@ -174,7 +189,6 @@ _missionParameters params[ if (_temp isEqualTo grpNull) then {throw 1} else { _assetSpawned = _temp select 0; - _missionData set[5,_assetSpawned]; _objects pushBack (_temp select 1); _blck_AllMissionAI pushBack _assetSpawned; }; @@ -186,7 +200,6 @@ _missionParameters params[ if (_temp isEqualTo grpNull) then {throw 1} else { _assetSpawned = _temp select 0; - _missiondata set[5,_assetSpawned]; _objects pushBack (_temp select 1); _blck_AllMissionAI pushBack _assetSpawned; }; @@ -207,7 +220,10 @@ _missionParameters params[ if (typeName _temp isEqualTo "ARRAY") then { blck_monitoredVehicles pushBack (_temp select 0); + _missionAIVehicles append (_temp select 0); _blck_AllMissionAI append (_temp select 1); + //diag_log format["_monitorInitializeMissions(238): _temp select 0 = %1",_temp select 0]; + //diag_log format["_monitorInitializedMissions(239): _temp select 1 = %1",_temp select 1]; } else { if (typeName _temp isEqualTo "GROUP") then { @@ -267,7 +283,9 @@ _missionParameters params[ // TODO: add grpNull checks to missionVehicleSpawner if (_temp isEqualTo grpNull) then {throw 1} else { - _patrolVehicles = _temp select 0; + //diag_log format["_monitorInitializeMissions(299): _temp select 0 = %1",_temp select 0]; + //diag_log format["_monitorInitializedMissions(300): _temp select 1 = %1",_temp select 1]; + _missionAIVehicles = _temp select 0; _blck_AllMissionAI append (_temp select 1); }; }; @@ -284,7 +302,7 @@ _missionParameters params[ { _crates = [_coords,_missionLootBoxes,_loadCratesTiming, _spawnCratesTiming, "start", _difficulty] call blck_fnc_spawnMissionCrates; }; - + //diag_log format["_monitorInitializeMissions (318): crates spawned = %1",_crates]; if (blck_cleanUpLootChests) then { _objects append _crates; @@ -297,8 +315,6 @@ _missionParameters params[ } forEach _crates; }; }; - _missionData set[2,_objects]; - _missionData set[3,_crates]; uiSleep delayTime; @@ -311,8 +327,20 @@ _missionParameters params[ _x setVariable["crateSpawnPos", (getPos _x)]; } forEach _crates; private _spawnPara = if (random(1) < _chancePara) then {true} else {false}; - _missionData = [_coords,_mines,_objects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_markers]; + /* + private _vars = ["_objects","_hiddenObjects","_crates"]; + { + diag_log format["_monitorInitializedMissions(322): %1 = %2",_vars select _forEachIndex,_x]; + } forEach [_objects,_hiddenObjects,_crates]; + */ // 0 1 2 3 4 5 + _missionData = [_coords,_mines,_objects,_hiddenObjects,_crates,_blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_markers]; + + /* + { + diag_log format["_monitorInitializedMission (327): _missionData %1 = %2",_vars select _foreachIndex,_missionData select _x]; + } forEach [2,3,4,5]; + */ _el set[missionData, _missionData]; // Everything spawned withouth serious errors so lets keep the mission active for future monitoring @@ -325,7 +353,7 @@ _missionParameters params[ if (_exception isEqualTo 1) then { _missionCategoryDescriptors set[noActive, _noActive - 1]; - [_coords,_mines,_objects,_hiddenObjects,_crates, _blck_AllMissionAI,_endMsg,_markers,markerPos (_markers select 1),_markerName,_markerMissionName, 1] call blck_fnc_endMission; + [_coords,_mines,_objects,_hiddenObjects,_crates,_blck_AllMissionAI,_endMsg,_markers,markerPos (_markers select 1),_markerName,_markerMissionName, 1] call blck_fnc_endMission; ["Critial Error returned by one or more critical functions, mission spawning aborted!",'error'] call blck_fnc_log; }; }; @@ -356,6 +384,16 @@ _missionParameters params[ private _minNoAliveForCompletion = (count _blck_AllMissionAI) - (round(blck_killPercentage * (count _blck_AllMissionAI))); private _aiKilled = if (({alive _x} count _blck_AllMissionAI) <= _minNoAliveForCompletion) then {true} else {false}; // mission complete + /* + private _vars = ["_objects","_hiddenObjects","_crates"]; + { + diag_log format["_monitorInitializedMissions (363): %1 = %2",_vars select _forEachIndex,_x]; + } forEach [_objects,_hiddenObjects,_crates]; + { + diag_log format["_monitorInitializedMission (369): _missionData %1 = %2",_vars select _foreachIndex,_missionData select _x]; + } forEach [2,3,4,5]; + */ + //_el set[missionData, _missionData]; if (_endIfPlayerNear) then { if (_playerIsNear) throw 1; // mission complete @@ -423,7 +461,16 @@ _missionParameters params[ } forEach _crates; }; - _missionData = [_coords,_mines,_objects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_markers]; + _missionData = [_coords,_mines,_objects,_hiddenObjects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_markers]; + + /* + { + diag_log format["_monitorInitializedMissions (363): %1 = %2",_vars select _forEachIndex,_x]; + } forEach [_objects,_hiddenObjects,_crates]; + { + diag_log format["_monitorInitializedMission (369): _missionData %1 = %2",_vars select _foreachIndex,_missionData select _x]; + } forEach [2,3,4,5]; + */ _el set[missionData, _missionData]; diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_signalEnd.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_signalEnd.sqf index cd6e4ff..e7eaf28 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_signalEnd.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_signalEnd.sqf @@ -14,8 +14,7 @@ private ["_start","_maxHeight","_smokeShell","_light","_lightSource"]; params[["_crate",objNull],["_time",60]]; -if (isNull _crate) exitWith {}; -_start = diag_tickTime; +//diag_log format["_signalEnd: _crate = %1 | _time = %2",_crate,_time]; _smokeShell = selectRandom ["SmokeShellOrange","SmokeShellBlue","SmokeShellPurple","SmokeShellRed","SmokeShellGreen","SmokeShellYellow"]; _lightSource = selectRandom ["Chemlight_green","Chemlight_red","Chemlight_yellow","Chemlight_blue"]; diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnBaseObjects.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnBaseObjects.sqf deleted file mode 100644 index 46d0548..0000000 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnBaseObjects.sqf +++ /dev/null @@ -1,48 +0,0 @@ -/* - Spawn objects from an array using offsects from a central location. - The code provided by M3Editor EDEN has been addapted to add checks for vehicles, should they be present. - Returns an array of spawned objects. - - -------------------------- - 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["_center","_objects"]; -if (count _center == 2) then {_center pushBack 0}; -private ["_newObjs","_sim","_dam","_obj","_spawnPos"]; -_newObjs = []; -_obj = createVehicle ["RoadCone_L_F", _coords]; // To designate the mission center -_obj allowDamage true; -_obj enableSimulation false; -_obj enableSimulationGlobal false; -_obj enableDynamicSimulation false; -_newObjs pushBack _obj; -{ - if (typeName (_x select 3) isEqualTo "ARRAY") then // assum simulation and damage settings are defined in the old way as [bool,bool] - { - _sim = (_x select 3) select 0; - _dam = (_x select 3) select 1; - }; - if (typeName (_x select 3) isEqualTo "BOOL") then // assume simulation and damage settings are defined in the new way as , bool, bool, ... - { - _sim = _x select 3; - _dam = _x select 4; - }; - - _obj = createVehicle[(_x select 0),_center vectorAdd (_x select 1),[],0,"CAN_COLLIDE"]; - _newObjs pushback _obj; - [_obj, (_x select 2)] call blck_fnc_setDirUp; - _obj enableDynamicSimulation _sim; - _obj allowDamage _dam; - if ((typeOf _obj) isKindOf "LandVehicle" || (typeOf _obj) isKindOf "Air" || (typeOf _obj) isKindOf "Sea") then - { - [_obj] call blck_fnc_configureMissionVehicle; - }; -} forEach _objects; -_newObjs - diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnCompositionObjects.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnCompositionObjects.sqf new file mode 100644 index 0000000..d79316c --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnCompositionObjects.sqf @@ -0,0 +1,63 @@ +/* + -------------------------- + 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["_center","_objects"]; +private ["_dam","_sim"]; +if (count _center == 2) then {_center pushBack 0}; +private _newObjs = []; +private _hiddenObjs = []; + +{ + // ["Land_Bunker_01_blocks_3_F",[-13.762,17.5518,-0.00143909],270.35,true,true], + _x params["_className","_relPos","_dir","_booleans"]; + + //diag_log format["_spawnCompsitionObjects: _x = %1",_x]; + //diag_log format["_spawnCompositionObjects: _className = %1 | _relPos = %2 | _dir = %3 | _booleans",_className,_relPos,_dir,_booleans]; + if (typeName (_booleans) isEqualTo "ARRAY") then // assum simulation and damage settings are defined in the old way as [bool,bool] + { + _dam = (_booleans) select 0; + _sim = (_booleans) select 1; + }; + if ((typeName _booleans) isEqualTo "BOOL") then // assume simulation and damage settings are defined in the new way as , bool, bool, ... + { + _sim = _x select 4; + _dam = _x select 3; + }; + + private _objPos = _center vectorAdd _relPos; + + //diag_log format["_spawnCompositionObjects: _sim = %1 | _dam = %2",_sim,_dam]; + //diag_log format["_spawnCompsitionObjects: _relPos = %1 | _objPos = %2",_relPos, _objPos]; + if (_className isKindOf "House" && blck_hideRocksAndPlants) then + { + private _shrubs = nearestTerrainObjects[_objPos,["TREE", "SMALL TREE", "BUSH","FENCE", "WALL","ROCK"], sizeOf _className]; + if !(_shrubs isEqualTo []) then + { + _hiddenObjs append _shrubs; + diag_log format["_spawnCompositionObjects: _hiddenObjs = %1",_hiddenObjs]; + {_x hideObjectGlobal true} forEach _shrubs; + }; + }; + _obj = createVehicle[_className,[0,0,0],[],0,"CAN_COLLIDE"]; + _obj setPosATL _objPos; + _newObjs pushback _obj; + [_obj, _dir] call blck_fnc_setDirUp; + _obj setVectorUp [0,0,1]; + _obj enableDynamicSimulation _sim; + _obj allowDamage _dam; + if ((typeOf _obj) isKindOf "LandVehicle" || (typeOf _obj) isKindOf "Air" || (typeOf _obj) isKindOf "Ship") then + { + [_obj] call blck_fnc_configureMissionVehicle; + }; +} forEach _objects; +diag_log format["_spawnCompositionObjects: _objects = %1",_objects]; +diag_log format["_spawnCompositionObjects: _hiddenObjs = %1",_hiddenObjs]; +[_newObjs,_hiddenObjs]; + diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnGarrisonInsideBuilding_relPos.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnGarrisonInsideBuilding_relPos.sqf index 7d17a2e..5a8e53a 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnGarrisonInsideBuilding_relPos.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnGarrisonInsideBuilding_relPos.sqf @@ -19,18 +19,20 @@ if (_vests isEqualTo []) then {_vests = [_aiDifficultyLevel] call blck_fnc_ if (_backpacks isEqualTo []) then {_backpacks = [_aiDifficultyLevel] call blck_fnc_selectAIBackpacks}; private["_unit","_obj","_staticClassName","_usedBldPsn","_pos","_obj"]; -private _allBldPsn = [_building] call BIS_fnc_buildingPositions; -private _usedBldPsn = []; -private _floor = floor((count _allBldPsn)/2); -private _ceil = ceil((count _allBldPsn)/2); +private _allBldPsn = [[_building] call BIS_fnc_buildingPositions] call BIS_fnc_arrayShuffle; +private _countBldPsn = count _allBldPsn; +private _floor = floor(_countBldPsn/2); +private _ceil = ceil(_countBldPsn/2); private _statics = if (_ceil > _noStatics) then {_noStatics} else {_ceil}; private _units = if (_floor > _noUnits) then {_noUnits} else {_floor}; private _staticsSpawned = []; +private _locsUsed = []; uiSleep 1; for "_i" from 1 to _statics do { - _pos = selectRandom _allBldPsn; - _allBldPsn = _allBldPsn - [_pos]; + if (_allBldPsn isEqualTo []) exitWith {}; + _pos = _allBldPsn deleteAt 0; + _locsUsed pushBack _pos; _staticClassName = selectRandom _typesStatics; _obj = [_staticClassName, [0,0,0]] call blck_fnc_spawnVehicle; _obj setVariable["GRG_vehType","emplaced"]; @@ -39,12 +41,20 @@ for "_i" from 1 to _statics do _unit = [[0,0,0],_group,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_launcher,_weaponList,_sideArms,false,true] call blck_fnc_spawnUnit; _unit moveInGunner _obj; }; - +private _infantryPos = _allBldPsn; for "_i" from 1 to _units do { - _pos = selectRandom _allBldPsn; - _allBldPsn = _allBldPsn - [_pos]; + if (_allBldPsn isEqualTo []) exitWith {}; + _pos = _allBldPsn deleteAt 0; _unit = [[0,0,0],_group,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_launcher,_weaponList,_sideArms,false,true] call blck_fnc_spawnUnit; _unit setPosATL _pos; + { + _wp = _group addWaypoint [_x, 0]; + _wp setWaypointType "MOVE"; + _wp setWaypointCompletionRadius 0; + _wp waypointAttachObject _building; + _wp setWaypointHousePosition _foreachindex; + _wp setWaypointTimeout [15, 20, 30]; + } forEach (_building buildingPos -1); }; _staticsSpawned diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnSimpleObjects.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnSimpleObjects.sqf new file mode 100644 index 0000000..dfd11e0 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnSimpleObjects.sqf @@ -0,0 +1,23 @@ +/* + 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"; + +params["_center","_objects","_relative"]; +private _spawnedObjects = []; +{ + _x params["_className","_relPos","_dir","_booleans"]; + private _objPos = _center vectorAdd _relPos; + private _obj = createSimpleObject [_className,ATLToASL _objPos]; + _obj setDir _dir; + _obj setVectorUp [0,0,1]; + _spawnedObjects pushBack _obj; +} forEach _objects; +_spawnedObjects \ No newline at end of file diff --git a/@GMS/addons/custom_server/Compiles/blck_functions.sqf b/@GMS/addons/custom_server/Compiles/blck_functions.sqf index 71faa96..9ddbca8 100644 --- a/@GMS/addons/custom_server/Compiles/blck_functions.sqf +++ b/@GMS/addons/custom_server/Compiles/blck_functions.sqf @@ -118,7 +118,8 @@ private _functions = [ ["blck_fnc_sm_AddGroupToArray", "\q\addons\custom_server\Compiles\Missions\GMS_fnc_sm_AddGroupToArray.sqf"], ["blck_fnc_initializeMission", "\q\addons\custom_server\Compiles\Missions\GMS_fnc_initializeMission.sqf"], ["blck_fnc_monitorInitializedMissions","\q\addons\custom_server\Compiles\Missions\GMS_fnc_monitorInitializedMissions.sqf"], - + ["blck_fnc_spawnSimpleObjects","\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnSimpleObjects.sqf"], + // Group-related functions ["blck_fnc_spawnGroup","\q\addons\custom_server\Compiles\Groups\GMS_fnc_spawnGroup.sqf"], // Spawn a single group and populate it with AI units] ["blck_fnc_setupWaypoints","\q\addons\custom_server\Compiles\Groups\GMS_fnc_setupWaypoints.sqf"], // Set default waypoints for a group diff --git a/@GMS/addons/custom_server/Configs/blck_configs.sqf b/@GMS/addons/custom_server/Configs/blck_configs.sqf index 3962068..8fb3a3e 100644 --- a/@GMS/addons/custom_server/Configs/blck_configs.sqf +++ b/@GMS/addons/custom_server/Configs/blck_configs.sqf @@ -14,11 +14,11 @@ #include "\q\addons\custom_server\Configs\blck_defines.hpp" #include "\q\addons\custom_server\init\build.sqf" /* - changing any of these variables may break the mission systemChat + changing any of these variables may break the mission system */ blck_locationBlackList = []; // Do not touch ... - blck_debugON = false; // Do not touch ... - blck_debugLevel = 0; // Do not touch ... + blck_debugON = false; // should be set to false; ... + blck_debugLevel = 0; // should be set to 0 ... #ifdef blck_milServer if (true) exitWith { @@ -45,7 +45,8 @@ blck_spawnMapAddons = false; // When true map addons will be spawned based on parameters define in custum_server\MapAddons\MapAddons_init.sqf blck_spawnStaticLootCrates = false; // When true, static loot crates will be spawned and loaded with loot as specified in custom_server\SLS\SLS_init_Epoch.sqf (or its exile equivalent). blck_simulationManager = blck_useBlckeaglsSimulationManager; - //diag_log format["[blckeagls] blck_configs: blck_simulationManager = %1",blck_simulationManager]; + blck_hideRocksAndPlants = true; // When true, any rocks, trees or bushes under enterable buildings will be 'hidden' + /* blck_simulationManagementOff - no simulation management occurs blck_useBlckeaglsSimulationManager - simulation is enabled/disabled by periodic checks for nearby players; a 'wake' function is included when a units simulation is turned on