diff --git a/config.sqf b/config.sqf index e4a82b2..e65386b 100644 --- a/config.sqf +++ b/config.sqf @@ -13,8 +13,8 @@ // Shared Config for each occupation monitor -SC_debug = true; // set to true to turn on debug features (not for live servers) -SC_extendedLogging = true; // set to true for additional logging +SC_debug = false; // set to true to turn on debug features (not for live servers) +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 @@ -27,10 +27,11 @@ 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) +SC_occupyMilitary = true; // true if you want military buildings patrolled (specify which types of building below) SC_buildings = [ "Land_Cargo_Patrol_V1_F","Land_i_Barracks_V1_F","Land_i_Barracks_V1_dam_F", "Land_i_Barracks_V2_F", "Land_Cargo_House_V1_F","Land_Cargo_HQ_V1_F","Land_Cargo_HQ_V2_F","Land_Cargo_HQ_V3_F","Land_Cargo_Patrol_V2_F", @@ -41,7 +42,7 @@ 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 = true; // 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 diff --git a/initServer.sqf b/initServer.sqf index ce30c9a..0f3d805 100644 --- a/initServer.sqf +++ b/initServer.sqf @@ -2,7 +2,7 @@ // // Server Occupation script by second_coming // -SC_occupationVersion = "v9 (11-04-2016)"; +SC_occupationVersion = "v10 (12-04-2016)"; // // http://www.exilemod.com/profile/60-second_coming/ // @@ -22,9 +22,9 @@ SC_occupationVersion = "v9 (11-04-2016)"; [] spawn { - waitUntil { !(isNil "DMS_MinMax_Y_Coords") }; - sleep 30; - + 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 b4e17d4..7e2e33d 100644 --- a/scripts/occupationMilitary.sqf +++ b/scripts/occupationMilitary.sqf @@ -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 diff --git a/scripts/occupationPlaces.sqf b/scripts/occupationPlaces.sqf index fe73adf..5214c35 100644 --- a/scripts/occupationPlaces.sqf +++ b/scripts/occupationPlaces.sqf @@ -27,6 +27,17 @@ _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]; +}; + // more than _scaleAI players on the server and the max AI count drops per additional player _currentPlayerCount = count playableUnits; @@ -45,7 +56,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 +120,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 +130,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,19 +185,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; - }foreach units _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; @@ -212,16 +282,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"; - }; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -237,7 +342,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/occupationSea.sqf b/scripts/occupationSea.sqf index a79eec0..f80426c 100644 --- a/scripts/occupationSea.sqf +++ b/scripts/occupationSea.sqf @@ -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]; diff --git a/scripts/occupationSky.sqf b/scripts/occupationSky.sqf index b967f82..2f7bdd9 100644 --- a/scripts/occupationSky.sqf +++ b/scripts/occupationSky.sqf @@ -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]; diff --git a/scripts/occupationStatic.sqf b/scripts/occupationStatic.sqf index 55bdbec..35f7459 100644 --- a/scripts/occupationStatic.sqf +++ b/scripts/occupationStatic.sqf @@ -31,7 +31,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]; diff --git a/scripts/occupationVehicle.sqf b/scripts/occupationVehicle.sqf index 72e76eb..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]; diff --git a/scripts/startOccupation.sqf b/scripts/startOccupation.sqf index 8861aa3..2fe8935 100644 --- a/scripts/startOccupation.sqf +++ b/scripts/startOccupation.sqf @@ -1,6 +1,3 @@ -_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; _logDetail = format ["[OCCUPATION]:: Occupation %2 Initialised at %1",time,SC_occupationVersion]; [_logDetail] call SC_fnc_log;