diff --git a/config.sqf b/config.sqf index 04e258e..17aab91 100644 --- a/config.sqf +++ b/config.sqf @@ -2,7 +2,6 @@ // // Server Occupation script by second_coming // -// // http://www.exilemod.com/profile/60-second_coming/ // // This script uses the fantastic DMS by Defent and eraser1 @@ -14,8 +13,8 @@ // Shared Config for each occupation monitor SC_debug = false; // set to true to turn on debug features (not for live servers) -SC_extendedLogging = true; // set to true for additional logging -SC_infiSTAR_log = false; // true Use infiSTAR logging, false logs to server rpt +SC_extendedLogging = false; // set to true for additional logging +SC_infiSTAR_log = true; // true Use infiSTAR logging, false logs to server rpt SC_maxAIcount = 100; // the maximum amount of AI, if the AI count is above this then additional AI won't spawn SC_mapMarkers = false; // Place map markers at the occupied areas (occupyPlaces and occupyMilitary only) true/false @@ -27,7 +26,8 @@ SC_useWaypoints = true; // When spawning AI create waypoints to make t // (can affect performance when the AI is spawned and the waypoints are calculated) // Occupation Places (towns, villages & cities roaming AI) -SC_occupyPlaces = true; // true if you want villages,towns,cities patrolled +SC_occupyPlaces = true; // true if you want villages,towns,cities patrolled by bandits +SC_occupyPlacesSurvivors = true; // true if you want a chance to spawn survivor AI as well as bandits (SC_occupyPlaces must be true to use this option) // Occupation Military (roaming AI near military buildings) SC_occupyMilitary = false; // true if you want military buildings patrolled (specify which types of building below) @@ -41,13 +41,16 @@ SC_buildings = [ "Land_Cargo_Patrol_V1_F","Land_i_Barracks_V1_F", "Land_Army_hut_int","Land_Army_hut2_int" ]; -SC_occupyStatic = false; // true if you want to garrison AI in specific locations (not working yet) +SC_occupyStatic = false; // true if you want to garrison AI in specific locations (not working yet) SC_occupyVehicle = true; // true if you want to have roaming AI vehicles +SC_occupyVehiclesLocked = true; // true if AI vehicles to stay locked until all the linked AI are dead + SC_occupySky = true; // true if you want to have roaming AI helis SC_occupySea = false; // true if you want to have roaming AI boats - +SC_occupyPublicBus = true; // true if you want a roaming bus service +SC_occupyPublicBusClass = "Exile_Car_Ikarus_Party"; // class name for the vehicle to use as the public bus SC_occupyLootCrates = true; // true if you want to have random loot crates with guards SC_numberofLootCrates = 6; // if SC_occupyLootCrates = true spawn this many loot crates (overrided below for Namalsk) @@ -86,6 +89,7 @@ if (worldName == 'Namalsk') then SC_numberofLootCrates = 3; SC_numberofHeliCrashes = 2; SC_maxNumberofBoats = 1; + SC_occupyPublicBusClass = "Exile_Car_LandRover_Urban"; // the ikarus bus gets stuck on Namalsk }; @@ -97,6 +101,7 @@ SC_liveHelis = 0; SC_liveHelisArray = []; SC_liveBoats = 0; SC_liveBoatsArray = []; +SC_publicBusArray = []; publicVariable "SC_liveVehicles"; publicVariable "SC_liveVehiclesArray"; @@ -104,4 +109,5 @@ publicVariable "SC_liveHelis"; publicVariable "SC_liveHelisArray"; publicVariable "SC_liveBoats"; publicVariable "SC_liveBoatsArray"; -publicVariable "SC_numberofLootCrates"; \ No newline at end of file +publicVariable "SC_numberofLootCrates"; +publicVariable "SC_publicBusArray"; \ No newline at end of file diff --git a/initServer.sqf b/initServer.sqf index 5669593..27cdf9e 100644 --- a/initServer.sqf +++ b/initServer.sqf @@ -2,7 +2,7 @@ // // Server Occupation script by second_coming // -SC_occupationVersion = "v8 (09-04-2016)"; +SC_occupationVersion = "v11 (12-04-2016)"; // // http://www.exilemod.com/profile/60-second_coming/ // @@ -22,8 +22,9 @@ SC_occupationVersion = "v8 (09-04-2016)"; [] spawn { - waitUntil { !(isNil "DMS_MinMax_Y_Coords") }; - + diag_log format ["[OCCUPATION]:: Occupation %2 Giving the server time to start before starting [OCCUPATION] (%1)",time,SC_occupationVersion]; + waitUntil { !(isNil "DMS_MinMax_Y_Coords") }; + sleep 1; diag_log format ["[OCCUPATION MOD]:: Occupation %2 Loading Config at %1",time,SC_occupationVersion]; // Get the config for Occupation diff --git a/scripts/occupationMilitary.sqf b/scripts/occupationMilitary.sqf index 3f94742..c831f45 100644 --- a/scripts/occupationMilitary.sqf +++ b/scripts/occupationMilitary.sqf @@ -1,6 +1,6 @@ -private["_wp","_wp2","_wp3"]; - if (!isServer) exitWith {}; + +private["_wp","_wp2","_wp3"]; _logDetail = format ["[OCCUPATION Military]:: Starting Monitor"]; [_logDetail] call SC_fnc_log; @@ -28,7 +28,7 @@ if(diag_fps < _minFPS) exitWith [_logDetail] call SC_fnc_log; }; -_aiActive = {alive _x && side _x == EAST} count allUnits; +_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits; //_aiActive = count(_spawnCenter nearEntities ["O_recon_F", _maxDistance+1000]); if(_aiActive > _maxAIcount) exitWith @@ -156,6 +156,12 @@ for [{_i = 0},{_i < (count _buildings)},{_i =_i + 1}] do _group = [_spawnPosition, _aiCount, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup; DMS_ai_use_launchers = true; + { + _unit = _x; + [_unit] joinSilent grpNull; + [_unit] joinSilent _group; + }foreach units _group; + [ _group,_pos,_difficulty,"COMBAT" ] call DMS_fnc_SetGroupBehavior; _buildings = _pos nearObjects ["house", _groupRadius]; diff --git a/scripts/occupationMonitor.sqf b/scripts/occupationMonitor.sqf index f49d1f2..189d532 100644 --- a/scripts/occupationMonitor.sqf +++ b/scripts/occupationMonitor.sqf @@ -24,5 +24,13 @@ _logDetail = format ["[OCCUPATION:Unstick]:: Initialised at %1",time]; sleep 5; }forEach SC_liveBoatsArray; +{ + _logDetail = format ["[OCCUPATION:Unstick]:: publicBus: %1 is active",_x]; + [_logDetail] call SC_fnc_log; + _x setFuel 1; + [_x] call SC_fnc_comeUnstuck; + sleep 5; +}forEach SC_publicBusArray; + _logDetail = format ["[OCCUPATION:Unstick]:: Finished at %1",time]; [_logDetail] call SC_fnc_log; \ No newline at end of file diff --git a/scripts/occupationPlaces.sqf b/scripts/occupationPlaces.sqf index f89f322..f267537 100644 --- a/scripts/occupationPlaces.sqf +++ b/scripts/occupationPlaces.sqf @@ -1,21 +1,7 @@ -//////////////////////////////////////////////////////////////////////// -// -// Server Occupation script by second_coming -// -// Version 2.0 -// -// http://www.exilemod.com/profile/60-second_coming/ -// -// This script uses the fantastic DMS by Defent and eraser1 -// -// http://www.exilemod.com/topic/61-dms-defents-mission-system/ -// -//////////////////////////////////////////////////////////////////////// +if (!isServer) exitWith {}; private["_wp","_wp2","_wp3"]; -if (!isServer) exitWith {}; - _logDetail = format ["[OCCUPATION]:: Starting Occupation Monitor @ %1",time]; [_logDetail] call SC_fnc_log; @@ -27,6 +13,19 @@ _maxAIcount = SC_maxAIcount; _minFPS = SC_minFPS; _useLaunchers = DMS_ai_use_launchers; _scaleAI = SC_scaleAI; +_side = "bandit"; + +if(SC_occupyPlacesSurvivors) then +{ + // Make survivors friendly to players and enemies to bandit AI + RESISTANCE setFriend[WEST,1]; + WEST setFriend[RESISTANCE,1]; + WEST setFriend[EAST,0]; + EAST setFriend[WEST,0]; + + if(!isNil "DMS_Enable_RankChange") then { DMS_Enable_RankChange = true; }; +}; + // more than _scaleAI players on the server and the max AI count drops per additional player _currentPlayerCount = count playableUnits; @@ -45,7 +44,7 @@ if(diag_fps < _minFPS) exitWith }; }; -_aiActive = {alive _x && side _x == EAST} count allUnits; +_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits; if(_aiActive > _maxAIcount) exitWith { if(SC_extendedLogging) then @@ -109,7 +108,7 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi }; // Don't spawn additional AI if there are players in range - if([_pos, 200] call ExileClient_util_world_isAlivePlayerInRange) exitwith + if([_pos, 250] call ExileClient_util_world_isAlivePlayerInRange) exitwith { _okToSpawn = false; if(SC_extendedLogging) then @@ -119,21 +118,51 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi }; }; + + // Don't spawn additional AI if there are already AI in range _aiNear = count(_pos nearEntities ["O_recon_F", 500]); - if(_aiNear > 0) exitwith + if(_aiNear > 0) then { - _okToSpawn = false; - if(SC_extendedLogging) then + _nearEastAI = { side _x == EAST AND _x distance _pos < 500 } count allUnits; + _nearWestAI = { side _x == WEST AND _x distance _pos < 500 } count allUnits; + + if(_nearEastAI == 0 AND _nearWestAI == 0) then { - _logDetail = format ["[OCCUPATION:Places]:: %1 already has %2 active AI patrolling",_locationName,_aiNear]; - [_logDetail] call SC_fnc_log; - }; + _sideToSpawn = random 100; + if(_sideToSpawn < 50) then + { + _side = "bandit"; + } + else + { + _side = "survivor"; + }; + }; + if(_nearEastAI > 0 AND _nearWestAI == 0) then + { + _side = "survivor"; + }; + if(_nearEastAI == 0 AND _nearWestAI > 0) then + { + _side = "bandit"; + }; + if(_nearEastAI > 0 AND _nearWestAI > 0) then + { + _okToSpawn = false; + if(SC_extendedLogging) then + { + _logDetail = format ["[OCCUPATION:Places]:: %1 already has %2 active AI patrolling",_locationName,_aiNear]; + [_logDetail] call SC_fnc_log; + }; + }; + }; if(_okToSpawn) then { - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + if(!SC_occupyPlacesSurvivors) then { _side = "bandit"; }; + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Get AI to patrol the town ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// _aiCount = 1; @@ -144,13 +173,48 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi if(_aiCount < 1) then { _aiCount = 1; }; _difficulty = "random"; - _side = "bandit"; + _spawnPos = [_pos,10,100,5,0,20,0] call BIS_fnc_findSafePos; _spawnPosition = [_spawnPos select 0, _spawnPos select 1,0]; DMS_ai_use_launchers = false; - _group = [_spawnPosition, _aiCount, "randomEasy", "assault", _side] call DMS_fnc_SpawnAIGroup; + _initialGroup = [_spawnPosition, _aiCount, "randomEasy", "assault", _side] call DMS_fnc_SpawnAIGroup; DMS_ai_use_launchers = _useLaunchers; + + _group = createGroup EAST; + if(_side == "survivor") then + { + deleteGroup _group; + _group = createGroup WEST; + }; + + _group setVariable ["DMS_LockLocality",nil]; + _group setVariable ["DMS_SpawnedGroup",true]; + _group setVariable ["DMS_Group_Side", _side]; + + { + _unit = _x; + [_unit] joinSilent grpNull; + [_unit] joinSilent _group; + if(_side == "survivor") then + { + removeUniform _unit; + _unit forceAddUniform "Exile_Uniform_BambiOverall"; + if(SC_debug) then + { + _tag = createVehicle ["Sign_Arrow_Green_F", position _unit, [], 0, "CAN_COLLIDE"]; + _tag attachTo [_unit,[0,0,0.6],"Head"]; + }; + } + else + { + if(SC_debug) then + { + _tag = createVehicle ["Sign_Arrow_F", position _unit, [], 0, "CAN_COLLIDE"]; + _tag attachTo [_unit,[0,0,0.6],"Head"]; + }; + }; + }foreach units _initialGroup; // Get the AI to shut the fuck up :) enableSentences false; @@ -206,16 +270,51 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi if(_locationType isEqualTo "NameCityCapital") then { DMS_ai_use_launchers = false; - _group2 = [_spawnPosition, 5, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup; + _initialGroup2 = [_spawnPosition, 5, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup; DMS_ai_use_launchers = _useLaunchers; - + + _group2 = createGroup EAST; + if(_side == "survivor") then + { + deleteGroup _group2; + _group2 = createGroup WEST; + }; + + _group2 setVariable ["DMS_LockLocality",nil]; + _group2 setVariable ["DMS_SpawnedGroup",true]; + _group2 setVariable ["DMS_Group_Side", _side]; + // Get the AI to shut the fuck up :) enableSentences false; enableRadio false; + + { + _unit = _x; + [_unit] joinSilent grpNull; + [_unit] joinSilent _group2; + if(side _unit == "survivor") then + { + removeUniform _unit; + _unit forceAddUniform "Exile_Uniform_BambiOverall"; + if(SC_debug) then + { + _tag = createVehicle ["Sign_Arrow_Green_F", position _unit, [], 0, "CAN_COLLIDE"]; + _tag attachTo [_unit,[0,0,0.6],"Head"]; + } + else + { + if(SC_debug) then + { + _tag = createVehicle ["Sign_Arrow_F", position _unit, [], 0, "CAN_COLLIDE"]; + _tag attachTo [_unit,[0,0,0.6],"Head"]; + }; + }; + }; + }foreach units _initialGroup2; + [_group2, _pos, _groupRadius] call bis_fnc_taskPatrol; _group2 setBehaviour "AWARE"; _group2 setCombatMode "RED"; - }; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -231,7 +330,14 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi _marker setMarkerText "Occupied Area"; }; - _logDetail = format ["[OCCUPATION:Places]:: Spawning %2 AI in at %3 to patrol %1",_locationName,_aiCount,_spawnPosition]; + if(_side == 'survivor') then + { + _logDetail = format ["[OCCUPATION:Places]:: Spawning %2 survivor AI in at %3 to patrol %1",_locationName,_aiCount,_spawnPosition]; + } + else + { + _logDetail = format ["[OCCUPATION:Places]:: Spawning %2 bandit AI in at %3 to patrol %1",_locationName,_aiCount,_spawnPosition]; + }; [_logDetail] call SC_fnc_log; _okToSpawn = false; }; diff --git a/scripts/occupationPublicBus.sqf b/scripts/occupationPublicBus.sqf new file mode 100644 index 0000000..8eeb83f --- /dev/null +++ b/scripts/occupationPublicBus.sqf @@ -0,0 +1,119 @@ +if (!isServer) exitWith {}; + +_logDetail = format ["[OCCUPATION:publicBus]:: Starting @ %1",time]; +[_logDetail] call SC_fnc_log; + +_position = [ 0, 50, 1, 500, 500, 200, 200, 200, true, false ] call DMS_fnc_findSafePos; + +// Get position of nearest roads +_nearRoads = _position nearRoads 2000; +_nearestRoad = _nearRoads select 0; +_nearestRoadPos = position (_nearRoads select 0); +_spawnLocation = [_nearestRoadPos select 0, _nearestRoadPos select 1, 0]; + +// Create the busDriver and ensure he doest react to gunfire or being shot at. + +_group = createGroup resistance; +_group setCombatMode "BLUE"; + +"Exile_Trader_CommunityCustoms" createUnit [_spawnLocation, _group, "busDriver = this; this disableAI 'AUTOTARGET'; this disableAI 'TARGET'; this disableAI 'SUPPRESSION'; "]; + +busDriver allowDamage false; +removeGoggles busDriver; +busDriver forceAddUniform "U_IG_Guerilla3_1"; +busDriver addVest "V_TacVest_blk_POLICE"; +busDriver addBackpack "B_FieldPack_oli"; +busDriver addHeadgear "H_Cap_blk"; +busDriver setCaptive true; + +// Spawn busDrivers Vehicle +_publicBus = createVehicle [SC_occupyPublicBusClass, _spawnLocation, [], 0, "CAN_COLLIDE"]; +SC_publicBusArray = SC_publicBusArray + [_publicBus]; +_publicBus setVariable ["SC_assignedDriver", busDriver,true]; +_publicBus setVariable ["SC_vehicleSpawnLocation", _spawnLocation,true]; +_publicBus addEventHandler ["getin", "_this call SC_fnc_getInBus;"]; + +_group addVehicle _publicBus; +clearBackpackCargoGlobal _publicBus; +clearItemCargoGlobal _publicBus; +clearMagazineCargoGlobal _publicBus; +clearWeaponCargoGlobal _publicBus; +_publicBus setVariable ["ExileIsPersistent", false]; +_publicBus setVariable["vehPos",_spawnLocation,true]; +_publicBus setFuel 1; + +diag_log format['[OCCUPATION:publicBus] Vehicle spawned @ %1',_spawnLocation]; + +_publicBus addEventHandler ["HandleDamage", { _amountOfDamage = 0; _amountOfDamage }]; + +busDriver assignasdriver _publicBus; +[busDriver] orderGetin true; + +{ + _markerName = _x; + _markerPos = getMarkerPos _markerName; + if (markerType _markerName == "ExileTraderZone" OR markerType _markerName == "o_unknown") then + { + _wp = _group addWaypoint [_markerPos, 100]; + _wp setWaypointType "MOVE"; + _wp setWaypointBehaviour "CARELESS"; + _wp setWaypointspeed "LIMITED"; + }; + +} forEach allMapMarkers; + +// Add a final CYCLE +_wp = _group addWaypoint [_spawnLocation, 100]; +_wp setWaypointType "CYCLE"; +_wp setWaypointBehaviour "CARELESS"; +_wp setWaypointspeed "LIMITED"; + + +_busPos = position _publicBus; +_mk = createMarker ["busLocation",_busPos]; +"busLocation" setMarkerType "mil_warning"; +"busLocation" setMarkerText "Public Bus"; + +diag_log format['[OCCUPATION:publicBus] Running']; +busDriver = _publicBus getVariable "SC_assignedDriver"; + +// Make busDriver stop when players near him. +while {true} do +{ + + _pos = position _publicBus; + _mk setMarkerPos _pos; + _nearPlayers = (count (_pos nearEntities [['Exile_Unit_Player'],25])); + + if (_nearPlayers >= 1) then + { + uiSleep 0.5; + _publicBus setFuel 0; + busDriver action ["salute", busDriver]; + busDriver disableAI "MOVE"; + uiSleep 3; + } + else + { + _currentDriver = driver _publicBus; + if(_currentDriver != busDriver) then + { + _publicBus setFuel 0; + [_currentDriver] orderGetin false; + _currentDriver action ["eject", _publicBus]; + }; + + if(isnull _currentDriver) then + { + sleep 0.1; + busDriver assignAsDriver _publicBus; + busDriver moveInDriver _publicBus; + [busDriver] orderGetin true; + _publicBus lockDriver true; + }; + _publicBus setFuel 1; + uiSleep 3; + busDriver enableAI "MOVE"; + if(!Alive busDriver) exitWith {}; + }; +}; diff --git a/scripts/occupationSea.sqf b/scripts/occupationSea.sqf index 49b18e6..c2e1471 100644 --- a/scripts/occupationSea.sqf +++ b/scripts/occupationSea.sqf @@ -1,8 +1,8 @@ +if (!isServer) exitWith {}; + _logDetail = format['[OCCUPATION:Sea] Started']; [_logDetail] call SC_fnc_log; -if (!isServer) exitWith {}; - // more than _scaleAI players on the server and the max AI count drops per additional player _currentPlayerCount = count playableUnits; _maxAIcount = SC_maxAIcount; @@ -19,7 +19,7 @@ if(diag_fps < SC_minFPS) exitWith [_logDetail] call SC_fnc_log; }; -_aiActive = {alive _x && side _x == EAST} count allUnits; +_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits; if(_aiActive > _maxAIcount) exitWith { _logDetail = format ["[OCCUPATION:Sea]:: %1 active AI, so not spawning AI this time",_aiActive]; @@ -108,6 +108,11 @@ for "_i" from 1 to _vehiclesToSpawn do }; } forEach _vehicleRoles; + { + _unit = _x; + [_unit] joinSilent grpNull; + [_unit] joinSilent _group; + }foreach units _group; if(SC_infiSTAR_log) then { diff --git a/scripts/occupationSky.sqf b/scripts/occupationSky.sqf index 1f51e1a..ee360e3 100644 --- a/scripts/occupationSky.sqf +++ b/scripts/occupationSky.sqf @@ -1,8 +1,8 @@ +if (!isServer) exitWith {}; + _logDetail = format['[OCCUPATION:Sky] Started']; [_logDetail] call SC_fnc_log; -if (!isServer) exitWith {}; - // more than _scaleAI players on the server and the max AI count drops per additional player _currentPlayerCount = count playableUnits; _maxAIcount = SC_maxAIcount; @@ -19,7 +19,7 @@ if(diag_fps < SC_minFPS) exitWith [_logDetail] call SC_fnc_log; }; -_aiActive = {alive _x && side _x == EAST} count allUnits; +_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits; if(_aiActive > _maxAIcount) exitWith { _logDetail = format ["[OCCUPATION:Sky]:: %1 active AI, so not spawning AI this time",_aiActive]; @@ -131,6 +131,11 @@ for "_i" from 1 to _vehiclesToSpawn do }; } forEach _vehicleRoles; + { + _unit = _x; + [_unit] joinSilent grpNull; + [_unit] joinSilent _group; + }foreach units _group; if(SC_infiSTAR_log) then { diff --git a/scripts/occupationStatic.sqf b/scripts/occupationStatic.sqf index dbbb19e..49bcc30 100644 --- a/scripts/occupationStatic.sqf +++ b/scripts/occupationStatic.sqf @@ -1,9 +1,10 @@ -private["_wp","_wp2","_wp3"]; - if (!isServer) exitWith {}; + _logDetail = format ["[OCCUPATION Static]:: Starting Monitor"]; [_logDetail] call SC_fnc_log; +private["_wp","_wp2","_wp3"]; + _middle = worldSize/2; _spawnCenter = [_middle,_middle,0]; // Centre point for the map _maxDistance = _middle; // Max radius for the map @@ -31,7 +32,7 @@ if(diag_fps < _minFPS) exitWith [_logDetail] call SC_fnc_log; }; -_aiActive = count(_spawnCenter nearEntities ["O_recon_F", _maxDistance+1000]); +_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits; if(_aiActive > _maxAIcount) exitWith { _logDetail = format ["[OCCUPATION Static]:: %1 active AI, so not spawning AI this time",_aiActive]; @@ -89,6 +90,13 @@ for [{_i = 0},{_i < (count _statics)},{_i =_i + 1}] do DMS_ai_use_launchers = false; _group = [_spawnPosition, _aiCount, _difficulty, "assault", _side] call DMS_fnc_SpawnAIGroup; + + { + _unit = _x; + [_unit] joinSilent grpNull; + [_unit] joinSilent _group; + }foreach units _group; + [ _group,_spawnPosition,_difficulty,"AWARE" ] call DMS_fnc_SetGroupBehavior; DMS_ai_use_launchers = true; @@ -124,7 +132,7 @@ for [{_i = 0},{_i < (count _statics)},{_i =_i + 1}] do } foreach _buildingPositions; _wpPosition = _highest; - //diag_log format ["Static Patrol %3 waypoint added - building: %1 position: %2",_y,_highest,_group]; + diag_log format ["Static Patrol %3 waypoint added - building: %1 position: %2",_y,_highest,_group]; _i = _buildingPositions find _wpPosition; _wp = _group addWaypoint [_wpPosition, 0] ; _wp setWaypointBehaviour "AWARE"; diff --git a/scripts/occupationVehicle.sqf b/scripts/occupationVehicle.sqf index a9a907c..49014bf 100644 --- a/scripts/occupationVehicle.sqf +++ b/scripts/occupationVehicle.sqf @@ -20,7 +20,7 @@ if(diag_fps < SC_minFPS) exitWith [_logDetail] call SC_fnc_log; }; -_aiActive = {alive _x && side _x == EAST} count allUnits; +_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits; if(_aiActive > _maxAIcount) exitWith { _logDetail = format ["[OCCUPATION:Vehicle]:: %1 active AI, so not spawning AI this time",_aiActive]; @@ -105,9 +105,19 @@ if(_vehiclesToSpawn >= 1) then _vehicle setVariable ["SC_vehicleSpawnLocation", _spawnLocation,true]; _vehicle setFuel 1; _vehicle engineOn true; - _vehicle lock 0; - _vehicle setVehicleLock "UNLOCKED"; - _vehicle setVariable ["ExileIsLocked", 0, true]; + if(SC_occupyVehiclesLocked) then + { + _vehicle lock 2; + _vehicle setVehicleLock "LOCKED"; + _vehicle setVariable ["ExileIsLocked", 1, true]; + } + else + { + _vehicle lock 0; + _vehicle setVehicleLock "UNLOCKED"; + _vehicle setVariable ["ExileIsLocked", 0, true]; + }; + _vehicle setSpeedMode "LIMITED"; _vehicle limitSpeed 60; _vehicle action ["LightOn", _vehicle]; @@ -135,7 +145,7 @@ if(_vehiclesToSpawn >= 1) then }; sleep 0.1; _unit assignAsDriver _vehicle; - _unit moveInDriver _vehicle; + _unit moveInDriver _vehicle; _unit setVariable ["DMS_AssignedVeh",_vehicle]; _unit setVariable ["SC_drivenVehicle", _vehicle,true]; _unit addMPEventHandler ["mpkilled", "_this call SC_fnc_driverKilled;"]; @@ -153,7 +163,7 @@ if(_vehiclesToSpawn >= 1) then }; if(_vehicleRole == "CARGO") then { - _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; + _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; _unit assignAsCargo _vehicle; _unit moveInCargo _vehicle; _unit setVariable ["DMS_AssignedVeh",_vehicle]; @@ -179,7 +189,7 @@ if(_vehiclesToSpawn >= 1) then [_group, _spawnLocation, 2000] call bis_fnc_taskPatrol; - _group setBehaviour "AWARE"; + _group setBehaviour "SAFE"; _group setCombatMode "RED"; sleep 0.2; diff --git a/scripts/reactions/comeUnstuck.sqf b/scripts/reactions/comeUnstuck.sqf index a2e6e5e..fcc402b 100644 --- a/scripts/reactions/comeUnstuck.sqf +++ b/scripts/reactions/comeUnstuck.sqf @@ -34,25 +34,17 @@ if(count(crew _vehicle) > 0)then _originalSpawnLocation = _vehicle getVariable "SC_vehicleSpawnLocation"; _group = group _vehicle; - //_vehClass = _vehicle getVariable "vehClass"; _vehClass = typeOf _vehicle; if(_vehicle isKindOf "LandVehicle") then { - //_newPos = [ _curPos, 1, 50, [ 0, 0, 1, 0, 0, 0, 0, 0, true] ] call DMS_fnc_FindSafePos_InRange; - //_newPos = [_curPos, 5, 100, 3, 0, 20, 0] call BIS_fnc_findSafePos; - _tempPos = _curPos findEmptyPosition [0,100,_vehClass]; - _newPos = [_tempPos select 0, _tempPos select 1, 0]; - //_newPos = _curPos; - //_vehicle setDamage 0.2; + _tempPos = _curPos findEmptyPosition [0,150,_vehClass]; + _newPos = [_tempPos select 0, _tempPos select 1, 0]; }; if(_vehicle isKindOf "Ship") then { - //_newPos = [ _curPos, 1,50, [ 0, 0, 1, 0, 0, 0, 0, 0, true, true ] ] call DMS_fnc_FindSafePos_InRange; _newPos = [_curPos, 5, 100, 3, 2, 20, 0] call BIS_fnc_findSafePos; - //_tempPos = _curPos findEmptyPosition [0,100,_vehClass]; - //_newPos = [_tempPos select 0, _tempPos select 1, 0]; _newPos = _curPos; _vehicle setDamage 0.2; }; diff --git a/scripts/reactions/driverKilled.sqf b/scripts/reactions/driverKilled.sqf index 0368a5c..9b8ebb8 100644 --- a/scripts/reactions/driverKilled.sqf +++ b/scripts/reactions/driverKilled.sqf @@ -76,4 +76,7 @@ else { _logDetail = format ["[OCCUPATION:Vehicle]:: No replacement Driver found for vehicle %1",_vehicle]; [_logDetail] call SC_fnc_log; + _vehicle lock 0; + _vehicle setVehicleLock "UNLOCKED"; + _vehicle setVariable ["ExileIsLocked", 0, true]; }; diff --git a/scripts/reactions/repairVehicle.sqf b/scripts/reactions/repairVehicle.sqf index 34f043b..206a657 100644 --- a/scripts/reactions/repairVehicle.sqf +++ b/scripts/reactions/repairVehicle.sqf @@ -90,7 +90,7 @@ if(_damagedWheels > 0 OR _engineDamage OR _fueltankDamage) then _driver action ["movetodriver", _vehicle]; _vehicle forceSpeed -1; [_group, _spawnLocation, 2000] call bis_fnc_taskPatrol; - _group setBehaviour "AWARE"; + _group setBehaviour "SAFE"; _group setCombatMode "RED"; }; diff --git a/scripts/startOccupation.sqf b/scripts/startOccupation.sqf index 8758133..7ef25bc 100644 --- a/scripts/startOccupation.sqf +++ b/scripts/startOccupation.sqf @@ -1,6 +1,6 @@ -_logDetail = format ["[OCCUPATION]:: Occupation %2 Giving the server time to start before starting [OCCUPATION] (%1)",time,SC_occupationVersion]; -[_logDetail] call SC_fnc_log; -uiSleep 60; +if (!isServer) exitWith {}; + + _logDetail = format ["[OCCUPATION]:: Occupation %2 Initialised at %1",time,SC_occupationVersion]; [_logDetail] call SC_fnc_log; @@ -9,10 +9,16 @@ if(SC_debug) then { SC_refreshTime = 60; }else{ SC_refreshTime = 300; }; // Add selected occupation scripts to Exile Threading System +if(SC_occupyPublicBus) then +{ + [] execVM "\x\addons\a3_exile_occupation\scripts\occupationPublicBus.sqf"; +}; + if(SC_occupyLootCrates) then { if(SC_occupyLootCratesMarkers) then { + uiSleep 15; // delay the start fnc_occupationDeleteMapMarker = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\deleteMapMarkers.sqf"; [10, fnc_occupationDeleteMapMarker, [], true] call ExileServer_system_thread_addTask; }; @@ -67,6 +73,7 @@ if(SC_occupyMilitary) then [SC_refreshTime, fnc_occupationMilitary, [], true] call ExileServer_system_thread_addTask; }; + uiSleep 15; // delay the start fnc_occupationMonitor = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationMonitor.sqf"; [SC_refreshTime, fnc_occupationMonitor, [], true] call ExileServer_system_thread_addTask;