Merge remote-tracking branch 'refs/remotes/origin/development'

This commit is contained in:
second_coming 2016-04-15 12:54:54 +01:00
commit 5a4946f5ce
18 changed files with 356 additions and 194 deletions

View File

@ -12,7 +12,7 @@
// Shared Config for each occupation monitor
SC_debug = false; // set to true to turn on debug features (not for live servers)
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
@ -25,27 +25,51 @@ SC_scaleAI = 10; // any more than _scaleAI players on the server an
SC_useWaypoints = true; // When spawning AI create waypoints to make them enter buildings
// (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 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_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",
"Land_Cargo_Patrol_V3_F","Land_Cargo_Tower_V1_F","Land_Cargo_Tower_V1_No1_F","Land_Cargo_Tower_V1_No2_F",
"Land_Cargo_Tower_V1_No3_F","Land_Cargo_Tower_V1_No4_F","Land_Cargo_Tower_V1_No5_F","Land_Cargo_Tower_V1_No6_F",
"Land_Cargo_Tower_V1_No7_F","Land_Cargo_Tower_V2_F","Land_Cargo_Tower_V3_F","Land_MilOffices_V1_F",
"Land_Radar_F","Land_Radar_Small_F","Land_Dome_Big_F","Land_Dome_Small_F","Land_Army_hut3_long_int",
"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_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_SurvivorsChance = 33; // chance in % to spawn survivors instead of bandits (for places and land vehicles)
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)
SC_occupyVehicleSurvivors = true; // true if you want a chance to spawn survivor AI as well as bandits (SC_occupyVehicle must be true to use this option)
SC_occupyMilitary = true; // true if you want military buildings patrolled (specify which types of building below)
SC_buildings = [ "Land_TentHangar_V1_F","Land_Hangar_F",
"Land_Airport_Tower_F","Land_Cargo_House_V1_F",
"Land_Cargo_House_V3_F","Land_Cargo_HQ_V1_F",
"Land_Cargo_HQ_V2_F","Land_Cargo_HQ_V3_F",
"Land_u_Barracks_V2_F","Land_i_Barracks_V2_F",
"Land_i_Barracks_V1_F","Land_Cargo_Patrol_V1_F",
"Land_Cargo_Patrol_V2_F","Land_Cargo_Tower_V1_F",
"Land_Cargo_Tower_V1_No1_F","Land_Cargo_Tower_V1_No2_F",
"Land_Cargo_Tower_V1_No3_F","Land_Cargo_Tower_V1_No4_F",
"Land_Cargo_Tower_V1_No5_F","Land_Cargo_Tower_V1_No6_F",
"Land_Cargo_Tower_V1_No7_F","Land_Cargo_Tower_V2_F",
"Land_Cargo_Tower_V3_F","Land_MilOffices_V1_F",
"Land_Radar_F","Land_budova4_winter","land_hlaska",
"Land_Vysilac_FM","land_st_vez","Land_ns_Jbad_Mil_Barracks",
"Land_ns_Jbad_Mil_ControlTower","Land_ns_Jbad_Mil_House",
"land_pozorovatelna","Land_vys_budova_p1",
"Land_Vez","Land_Mil_Barracks_i",
"Land_Mil_Barracks_L","Land_Mil_Barracks",
"Land_Hlidac_budka","Land_Ss_hangar",
"Land_Mil_ControlTower","Land_a_stationhouse",
"Land_Farm_WTower","Land_Mil_Guardhouse",
"Land_A_statue01","Land_A_Castle_Gate",
"Land_A_Castle_Donjon","Land_A_Castle_Wall2_30",
"Land_A_Castle_Stairs_A",
"Land_i_Barracks_V1_dam_F","Land_Cargo_Patrol_V3_F",
"Land_Radar_Small_F","Land_Dome_Big_F",
"Land_Dome_Small_F","Land_Army_hut3_long_int",
"Land_Army_hut_int","Land_Army_hut2_int"
];
SC_occupyStatic = true; // true if you want to garrison AI in specific locations
SC_occupySky = true; // true if you want to have roaming AI helis
SC_occupySea = false; // true if you want to have roaming AI boats
@ -92,16 +116,17 @@ if (worldName == 'Namalsk') then
SC_occupyPublicBusClass = "Exile_Car_LandRover_Urban"; // the ikarus bus gets stuck on Namalsk
};
// Don't alter anything below this point
SC_SurvivorSide = CIVILIAN;
SC_BanditSide = EAST;
SC_liveVehicles = 0;
SC_liveVehiclesArray = [];
SC_liveHelis = 0;
SC_liveHelisArray = [];
SC_liveBoats = 0;
SC_liveBoatsArray = [];
SC_publicBusArray = [];
SC_publicBusArray = [];
SC_StopTheBus = false;
publicVariable "SC_liveVehicles";
publicVariable "SC_liveVehiclesArray";
@ -110,4 +135,7 @@ publicVariable "SC_liveHelisArray";
publicVariable "SC_liveBoats";
publicVariable "SC_liveBoatsArray";
publicVariable "SC_numberofLootCrates";
publicVariable "SC_publicBusArray";
publicVariable "SC_publicBusArray";
publicVariable "SC_StopTheBus";
publicVariable "SC_SurvivorSide";
publicVariable "SC_BanditSide";

View File

@ -2,7 +2,7 @@
//
// Server Occupation script by second_coming
//
SC_occupationVersion = "v11 (12-04-2016)";
SC_occupationVersion = "v20 (15-04-2016)";
//
// http://www.exilemod.com/profile/60-second_coming/
//
@ -33,7 +33,7 @@ SC_occupationVersion = "v11 (12-04-2016)";
// Select the log style depending on config settings
SC_fnc_log = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationLog.sqf";
// EventHandlers for AI reactions
// EventHandlers for AI reactions & player interactions
SC_fnc_repairVehicle = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\repairVehicle.sqf";
SC_fnc_vehicleDestroyed = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\vehicleDestroyed.sqf";
SC_fnc_reactUnit = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\reactUnit.sqf";
@ -43,6 +43,10 @@ SC_occupationVersion = "v11 (12-04-2016)";
SC_fnc_getIn = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\getIn.sqf";
SC_fnc_refuel = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\refuel.sqf";
SC_fnc_comeUnstuck = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\comeUnstuck.sqf";
SC_fnc_unitMPHit = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\unitMPHit.sqf";
SC_fnc_unitMPKilled = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\unitMPKilled.sqf";
SC_fnc_getOnBus = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\getOnBus.sqf";
SC_fnc_getOffBus = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\getOffBus.sqf";
_logDetail = "=============================================================================================================";
[_logDetail] call SC_fnc_log;

View File

@ -16,14 +16,9 @@ for "_i" from 1 to SC_numberofHeliCrashes do
while{!_validspot} do
{
sleep 0.2;
_position = [ 0, 50, 1, 500, 500, 200, 200, 200, true, false ] call DMS_fnc_findSafePos;
_position = [ 10, 50, 1, 750, 750, 200, 200, 200, true, false ] call DMS_fnc_findSafePos;
_validspot = true;
// Check for nearby spawn points and traders
_nearestMarker = [allMapMarkers, _position] call BIS_fnc_nearestPosition;
_posNearestMarker = getMarkerPos _nearestMarker;
if(_position distance _posNearestMarker < 750) then { _validspot = false; };
//Check if near another heli crash site
_nearOtherCrash = (nearestObjects [_position,["Land_UWreck_MV22_F"],750]) select 0;
if (!isNil "_nearOtherCrash") then { _validspot = false; };
@ -31,11 +26,7 @@ for "_i" from 1 to SC_numberofHeliCrashes do
//Check if near another loot crate site
_nearOtherCrate = (nearestObjects [_position,["CargoNet_01_box_F"],500]) select 0;
if (!isNil "_nearOtherCrate") then { _validspot = false; };
//Check if near player base
_nearBase = (nearestObjects [_position,["Exile_Construction_Flag_Static"],500]) select 0;
if (!isNil "_nearBase") then { _validspot = false; };
};
_logDetail = format['[OCCUPATION:HeliCrashes] Crash %1 : Location %2',_i,_position];

View File

@ -14,7 +14,7 @@ for "_i" from 1 to SC_numberofLootCrates do
while{!_validspot} do
{
sleep 0.2;
_position = [ 0, 50, 1, 500, 500, 200, 200, 200, true, false ] call DMS_fnc_findSafePos;
_position = [ 10, 50, 1, 750, 750, 200, 200, 200, true, false ] call DMS_fnc_findSafePos;
_validspot = true;
//Check if near another crate site
@ -45,19 +45,30 @@ for "_i" from 1 to SC_numberofLootCrates do
_AICount = 1 + (round (random (SC_LootCrateGuards-1)));
};
_spawnPosition = [_position select 0, _position select 1, 0];
_group = [_spawnPosition, _AICount, "random", "random", "bandit"] call DMS_fnc_SpawnAIGroup;
// Get the AI to shut the fuck up :)
enableSentences false;
enableRadio false;
if(_AICount > 0) then
{
_spawnPosition = [_position select 0, _position select 1, 0];
_group = [_spawnPosition, _AICount, "random", "random", "bandit"] call DMS_fnc_SpawnAIGroup;
// Get the AI to shut the fuck up :)
enableSentences false;
enableRadio false;
[_group, _spawnPosition, 100] call bis_fnc_taskPatrol;
_group setBehaviour "AWARE";
_group setCombatMode "RED";
[_group, _spawnPosition, 100] call bis_fnc_taskPatrol;
_group setBehaviour "AWARE";
_group setCombatMode "RED";
_logDetail = format ["[OCCUPATION:LootCrates]:: Creating crate %3 at drop zone %1 with %2 guards",_position,_AICount,_i];
[_logDetail] call SC_fnc_log;
}
else
{
_logDetail = format ["[OCCUPATION:LootCrates]:: Creating crate %2 at drop zone %1 with no guards",_position,_i];
[_logDetail] call SC_fnc_log;
};
_logDetail = format ["[OCCUPATION:LootCrates]:: Creating crate %3 at drop zone %1 with %2 guards",_position,_AICount,_i];
[_logDetail] call SC_fnc_log;
_box = "CargoNet_01_box_F" createvehicle _position;

View File

@ -4,6 +4,7 @@ private["_wp","_wp2","_wp3"];
_logDetail = format ["[OCCUPATION Military]:: Starting Monitor"];
[_logDetail] call SC_fnc_log;
_maxDistance = 500; // Max radius to scan
_maxAIcount = SC_maxAIcount;
_minFPS = SC_minFPS;
_useLaunchers = DMS_ai_use_launchers;
@ -18,9 +19,6 @@ if(_currentPlayerCount > _scaleAI) then
_maxAIcount = _maxAIcount - (_currentPlayerCount - _scaleAI) ;
};
// Select an area to scan as nearObjects on the entire map is slooooooooow
_areaToScan = [ 0, 900, 1, 500, 500, 0, 0, 0, true, false ] call DMS_fnc_findSafePos;
// Don't spawn additional AI if the server fps is below 8
if(diag_fps < _minFPS) exitWith
{
@ -28,31 +26,32 @@ if(diag_fps < _minFPS) exitWith
[_logDetail] call SC_fnc_log;
};
_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits;
_aiActive = {alive _x && (side _x == SC_BanditSide OR side _x == SC_SurvivorSide)} count allUnits;
//_aiActive = count(_spawnCenter nearEntities ["O_recon_F", _maxDistance+1000]);
if(_aiActive > _maxAIcount) exitWith
{
_logDetail = format ["[OCCUPATION Military]:: %1 active AI, so not spawning AI this time",_aiActive];
[_logDetail] call SC_fnc_log;
};
for [{_i = 0},{_i < (count _buildings)},{_i =_i + 1}] do
// Select an area to scan as nearObjects on the entire map is slooooooooow
_areaToScan = [ 0, 900, 1, 500, 500, 0, 0, 0, true, false ] call DMS_fnc_findSafePos;
{
_logDetail = format ["[OCCUPATION Military]:: scanning buildings around %2 started at %1",time,_areaToScan];
[_logDetail] call SC_fnc_log;
_currentBuilding = _buildings select _i;
_building = _areaToScan nearObjects [_currentBuilding, 750];
_currentBuilding = _x;
_building = _areaToScan nearObjects [_currentBuilding, _maxDistance];
_logDetail = format ["[OCCUPATION Military]:: scan for %2 building finished at %1",time,_currentBuilding];
[_logDetail] call SC_fnc_log;
for [{_n = 0},{_n < (count _building)-1},{_n =_n + 1}] do
{
_okToSpawn = true;
Sleep 0.1;
_foundBuilding = (_building select _n);
_foundBuilding = _x;
_location = getPos _foundBuilding;
_pos = [_location select 0, _location select 1, 0];
@ -64,9 +63,9 @@ for [{_i = 0},{_i < (count _buildings)},{_i =_i + 1}] do
while{_okToSpawn} do
{
// Percentage chance to spawn (roll 60 or more to spawn AI)
// Percentage chance to spawn (roll 70 or more to spawn AI)
_spawnChance = round (random 100);
if(_spawnChance < 60) exitWith
if(_spawnChance < 70) exitWith
{
_okToSpawn = false;
if(SC_extendedLogging) then
@ -114,7 +113,7 @@ for [{_i = 0},{_i < (count _buildings)},{_i =_i + 1}] do
};
// 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
@ -129,10 +128,10 @@ for [{_i = 0},{_i < (count _buildings)},{_i =_i + 1}] do
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Get AI to patrol the area
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_aiCount = 2 + (round (random 3));
_aiCount = 2 + (round (random 1));
_groupRadius = 100;
_difficulty = "random";
_side = "bandit";
_side = SC_BanditSide;
_spawnPosition = _pos;
// Get the AI to shut the fuck up :)
@ -142,7 +141,7 @@ for [{_i = 0},{_i < (count _buildings)},{_i =_i + 1}] do
if(!SC_useWaypoints) then
{
DMS_ai_use_launchers = false;
_group = [_spawnPosition, _aiCount, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup;
_group = [_spawnPosition, _aiCount, _difficulty, "random", "bandit"] call DMS_fnc_SpawnAIGroup;
DMS_ai_use_launchers = true;
[_group, _pos, _groupRadius] call bis_fnc_taskPatrol;
@ -153,13 +152,18 @@ for [{_i = 0},{_i < (count _buildings)},{_i =_i + 1}] do
{
DMS_ai_use_launchers = false;
_group = [_spawnPosition, _aiCount, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup;
_group = [_spawnPosition, _aiCount, _difficulty, "random", "bandit"] call DMS_fnc_SpawnAIGroup;
DMS_ai_use_launchers = true;
{
_unit = _x;
[_unit] joinSilent grpNull;
[_unit] joinSilent _group;
if(SC_debug) then
{
_tag = createVehicle ["Sign_Arrow_Blue_F", position _unit, [], 0, "CAN_COLLIDE"];
_tag attachTo [_unit,[0,0,0.6],"Head"];
};
}foreach units _group;
[ _group,_pos,_difficulty,"COMBAT" ] call DMS_fnc_SetGroupBehavior;
@ -218,7 +222,7 @@ for [{_i = 0},{_i < (count _buildings)},{_i =_i + 1}] do
_okToSpawn = false;
};
};
};
};
}foreach _building;
}foreach _buildings;
_logDetail = "[OCCUPATION Military]: Ended";
[_logDetail] call SC_fnc_log;

View File

@ -6,6 +6,15 @@ _logDetail = format ["[OCCUPATION:Unstick]:: Initialised at %1",time];
[_logDetail] call SC_fnc_log;
_x setFuel 1;
sleep 5;
_originalSpawnLocation = _x getVariable "SC_vehicleSpawnLocation";
_pos = position _x;
_nearestMarker = [allMapMarkers, _pos] call BIS_fnc_nearestPosition; // Nearest Marker to the Location
_posNearestMarker = getMarkerPos _nearestMarker;
if(_pos distance _posNearestMarker < 750) then
{
_GroupLeader = leader (group _x);
_GroupLeader doMove _originalSpawnLocation;
};
}forEach SC_liveHelisArray;
{

View File

@ -17,12 +17,6 @@ _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; };
};
@ -44,7 +38,7 @@ if(diag_fps < _minFPS) exitWith
};
};
_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits;
_aiActive = {alive _x && (side _x == SC_BanditSide OR side _x == SC_SurvivorSide)} count allUnits;
if(_aiActive > _maxAIcount) exitWith
{
if(SC_extendedLogging) then
@ -117,48 +111,47 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
[_logDetail] call SC_fnc_log;
};
};
// Don't spawn additional AI if there are already AI in range
_aiNear = count(_pos nearEntities ["O_recon_F", 500]);
if(_aiNear > 0) then
_nearBanditAI = { side _x == SC_BanditSide AND _x distance _pos < 500 } count allUnits;
_nearSurvivorAI = { side _x == SC_SurvivorSide AND _x distance _pos < 500 } count allUnits;
if(_nearBanditAI > 0 AND _nearSurvivorAI > 0) 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
_okToSpawn = false;
if(SC_extendedLogging) then
{
_logDetail = format ["[OCCUPATION:Places]:: %1 already has active AI patrolling",_locationName];
[_logDetail] call SC_fnc_log;
};
}
else
{
if(_nearBanditAI == 0 AND _nearSurvivorAI == 0) then
{
_sideToSpawn = random 100;
if(_sideToSpawn < 50) then
if(_sideToSpawn <= SC_SurvivorsChance) then
{
_side = "bandit";
_side = "survivor";
}
else
{
_side = "survivor";
_side = "bandit";
};
};
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
}
else
{
if(_nearSurvivorAI == 0) then
{
_logDetail = format ["[OCCUPATION:Places]:: %1 already has %2 active AI patrolling",_locationName,_aiNear];
[_logDetail] call SC_fnc_log;
};
};
_side = "survivor";
}
else
{
_side = "bandit";
};
};
};
if(_okToSpawn) then
{
if(!SC_occupyPlacesSurvivors) then { _side = "bandit"; };
@ -181,11 +174,11 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
_initialGroup = [_spawnPosition, _aiCount, "randomEasy", "assault", _side] call DMS_fnc_SpawnAIGroup;
DMS_ai_use_launchers = _useLaunchers;
_group = createGroup EAST;
_group = createGroup SC_BanditSide;
if(_side == "survivor") then
{
deleteGroup _group;
_group = createGroup WEST;
_group = createGroup SC_SurvivorSide;
};
_group setVariable ["DMS_LockLocality",nil];
@ -193,11 +186,12 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
_group setVariable ["DMS_Group_Side", _side];
{
_unit = _x;
_unit = _x;
[_unit] joinSilent grpNull;
[_unit] joinSilent _group;
if(_side == "survivor") then
{
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
removeUniform _unit;
_unit forceAddUniform "Exile_Uniform_BambiOverall";
if(SC_debug) then
@ -273,11 +267,11 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
_initialGroup2 = [_spawnPosition, 5, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup;
DMS_ai_use_launchers = _useLaunchers;
_group2 = createGroup EAST;
_group2 = createGroup SC_BanditSide;
if(_side == "survivor") then
{
{
deleteGroup _group2;
_group2 = createGroup WEST;
_group2 = createGroup SC_SurvivorSide;
};
_group2 setVariable ["DMS_LockLocality",nil];
@ -294,21 +288,22 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
[_unit] joinSilent _group2;
if(_side == "survivor") then
{
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
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
};
}
else
{
if(SC_debug) then
{
if(SC_debug) then
{
_tag = createVehicle ["Sign_Arrow_F", position _unit, [], 0, "CAN_COLLIDE"];
_tag attachTo [_unit,[0,0,0.6],"Head"];
};
};
_tag = createVehicle ["Sign_Arrow_F", position _unit, [], 0, "CAN_COLLIDE"];
_tag attachTo [_unit,[0,0,0.6],"Head"];
};
};
}foreach units _initialGroup2;
@ -330,7 +325,7 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
_marker setMarkerText "Occupied Area";
};
if(_side == 'survivor') then
if(_side == "survivor") then
{
_logDetail = format ["[OCCUPATION:Places]:: Spawning %2 survivor AI in at %3 to patrol %1",_locationName,_aiCount,_spawnPosition];
}

View File

@ -1,18 +1,24 @@
if (!isServer) exitWith {};
_middle = worldSize/2;
_spawnCenter = [_middle,_middle,0]; // Centre point for the map
_maxDistance = _middle; // Max radius for the map
_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;
_logDetail = format ["[OCCUPATION:publicBus]:: Spawning near map centre %1 @ %2",_spawnCenter,time];
[_logDetail] call SC_fnc_log;
_positionOfBus = [_spawnCenter,0,500,25,0,10,0] call BIS_fnc_findSafePos;
// Get position of nearest roads
_nearRoads = _position nearRoads 2000;
_nearRoads = _positionOfBus 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";
@ -31,7 +37,9 @@ _publicBus = createVehicle [SC_occupyPublicBusClass, _spawnLocation, [], 0, "CAN
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;"];
_publicBus addEventHandler ["getin", "_this call SC_fnc_getOnBus;"];
_publicBus addEventHandler ["getout", "_this call SC_fnc_getOffBus;"];
_group addVehicle _publicBus;
clearBackpackCargoGlobal _publicBus;
@ -42,12 +50,15 @@ _publicBus setVariable ["ExileIsPersistent", false];
_publicBus setVariable["vehPos",_spawnLocation,true];
_publicBus setFuel 1;
diag_log format['[OCCUPATION:publicBus] Vehicle spawned @ %1',_spawnLocation];
_logDetail = format['[OCCUPATION:publicBus] Vehicle spawned @ %1',_spawnLocation];
[_logDetail] call SC_fnc_log;
_publicBus addEventHandler ["HandleDamage", { _amountOfDamage = 0; _amountOfDamage }];
busDriver assignasdriver _publicBus;
busDriver moveInDriver _publicBus;
[busDriver] orderGetin true;
_publicBus lockDriver true;
{
_markerName = _x;
@ -89,31 +100,32 @@ while {true} do
{
uiSleep 0.5;
_publicBus setFuel 0;
busDriver action ["salute", busDriver];
busDriver disableAI "MOVE";
_publicBus animateDoor ["Doors_1", 1];
_publicBus animateDoor ["Doors_2", 1];
_publicBus animateDoor ["Doors_3", 1];
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;
_publicBus animateDoor ["Doors_1", 0];
_publicBus animateDoor ["Doors_2", 0];
_publicBus animateDoor ["Doors_3", 0];
uiSleep 3;
busDriver enableAI "MOVE";
if(!Alive busDriver) exitWith {};
};
if(SC_StopTheBus) then
{
uiSleep 0.5;
_publicBus setFuel 0;
busDriver disableAI "MOVE";
uiSleep 5;
SC_StopTheBus = false;
};
uiSleep 5;
};

View File

@ -19,7 +19,7 @@ if(diag_fps < SC_minFPS) exitWith
[_logDetail] call SC_fnc_log;
};
_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits;
_aiActive = {alive _x && (side _x == SC_BanditSide OR side _x == SC_SurvivorSide)} count allUnits;
if(_aiActive > _maxAIcount) exitWith
{
_logDetail = format ["[OCCUPATION:Sea]:: %1 active AI, so not spawning AI this time",_aiActive];
@ -44,7 +44,7 @@ for "_i" from 1 to _vehiclesToSpawn do
{
private["_group"];
_spawnLocation = [ 250, 0, 1, 1000, 1000, 1000, 1000, 1000, true, true ] call DMS_fnc_findSafePos;
_group = createGroup east;
_group = createGroup SC_BanditSide;
_VehicleClassToUse = SC_BoatClassToUse call BIS_fnc_selectRandom;
_vehicle = createVehicle [_VehicleClassToUse, _spawnLocation, [], 0, "NONE"];
_vehicle setPosASL _spawnLocation;

View File

@ -19,7 +19,7 @@ if(diag_fps < SC_minFPS) exitWith
[_logDetail] call SC_fnc_log;
};
_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits;
_aiActive = {alive _x && (side _x == SC_BanditSide OR side _x == SC_SurvivorSide)} count allUnits;
if(_aiActive > _maxAIcount) exitWith
{
_logDetail = format ["[OCCUPATION:Sky]:: %1 active AI, so not spawning AI this time",_aiActive];
@ -68,7 +68,7 @@ for "_i" from 1 to _vehiclesToSpawn do
_height = 350 + (round (random 200));
_spawnLocation = [_safePos select 0, _safePos select 1, _height];
_group = createGroup east;
_group = createGroup SC_BanditSide;
_VehicleClassToUse = SC_HeliClassToUse call BIS_fnc_selectRandom;
_vehicle = createVehicle [_VehicleClassToUse, _spawnLocation, [], 0, "NONE"];
_group addVehicle _vehicle;

View File

@ -32,16 +32,16 @@ if(diag_fps < _minFPS) exitWith
[_logDetail] call SC_fnc_log;
};
_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits;
_aiActive = {alive _x && (side _x == SC_BanditSide OR side _x == SC_SurvivorSide)} count allUnits;
if(_aiActive > _maxAIcount) exitWith
{
_logDetail = format ["[OCCUPATION Static]:: %1 active AI, so not spawning AI this time",_aiActive];
[_logDetail] call SC_fnc_log;
};
for [{_i = 0},{_i < (count _statics)},{_i =_i + 1}] do
{
_currentStatic = _statics select _i;
_currentStatic = _x;
_spawnPosition = _currentStatic select 0;
_aiCount = _currentStatic select 1;
_radius = _currentStatic select 2;
@ -57,19 +57,19 @@ for [{_i = 0},{_i < (count _statics)},{_i =_i + 1}] do
{
// Don't spawn additional AI if there are already AI in range
_aiNear = count(_spawnPosition nearEntities ["O_recon_F", 250]);
if(_aiNear > 0) exitwith
_nearBanditAI = { side _x == SC_BanditSide AND _x distance _spawnPosition < 250 } count allUnits;
if(_nearBanditAI > 0) exitwith
{
_okToSpawn = false;
if(_debug) then
{
_logDetail = format ["[OCCUPATION Static]:: %1 already has %2 active AI patrolling",_spawnPosition,_aiNear];
_logDetail = format ["[OCCUPATION Static]:: %1 already has %2 active AI patrolling",_spawnPosition,_nearBanditAI];
[_logDetail] call SC_fnc_log;
};
};
// Don't spawn additional AI if there are players in range
if([_spawnPosition, 400] call ExileClient_util_world_isAlivePlayerInRange) exitwith
if([_spawnPosition, 250] call ExileClient_util_world_isAlivePlayerInRange) exitwith
{
_okToSpawn = false;
if(_debug) then
@ -89,23 +89,32 @@ for [{_i = 0},{_i < (count _statics)},{_i =_i + 1}] do
_side = "bandit";
DMS_ai_use_launchers = false;
_group = [_spawnPosition, _aiCount, _difficulty, "assault", _side] call DMS_fnc_SpawnAIGroup;
_initialGroup = [_spawnPosition, _aiCount, _difficulty, "assault", _side] call DMS_fnc_SpawnAIGroup;
DMS_ai_use_launchers = _useLaunchers;
_initialGroup setCombatMode "BLUE";
_initialGroup setBehaviour "SAFE";
_group = createGroup SC_BanditSide;
_group setVariable ["DMS_LockLocality",nil];
_group setVariable ["DMS_SpawnedGroup",true];
_group setVariable ["DMS_Group_Side", _side];
{
_unit = _x;
_unit = _x;
[_unit] joinSilent grpNull;
[_unit] joinSilent _group;
}foreach units _group;
[ _group,_spawnPosition,_difficulty,"AWARE" ] call DMS_fnc_SetGroupBehavior;
DMS_ai_use_launchers = true;
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;
enableRadio false;
if(!_staticSearch) then
{
[_group, _spawnPosition, _groupRadius] call bis_fnc_taskPatrol;
@ -170,6 +179,7 @@ for [{_i = 0},{_i < (count _statics)},{_i =_i + 1}] do
};
};
};
}forEach _statics;
_logDetail = "[OCCUPATION Static]: Ended";
[_logDetail] call SC_fnc_log;

View File

@ -3,6 +3,13 @@ if (!isServer) exitWith {};
_logDetail = format['[OCCUPATION:Vehicle] Started'];
[_logDetail] call SC_fnc_log;
// set the default side for bandit AI
_side = "bandit";
if(SC_occupyVehicleSurvivors) then
{
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;
@ -20,7 +27,7 @@ if(diag_fps < SC_minFPS) exitWith
[_logDetail] call SC_fnc_log;
};
_aiActive = {alive _x && (side _x == EAST OR side _x == WEST)} count allUnits;
_aiActive = {alive _x && (side _x == SC_BanditSide OR side _x == SC_SurvivorSide)} count allUnits;
if(_aiActive > _maxAIcount) exitWith
{
_logDetail = format ["[OCCUPATION:Vehicle]:: %1 active AI, so not spawning AI this time",_aiActive];
@ -59,6 +66,16 @@ _maxDistance = _middle;
if(_vehiclesToSpawn >= 1) then
{
if(SC_occupyVehicleSurvivors) then
{
// decide which side to spawn
_sideToSpawn = random 100;
if(_sideToSpawn <= SC_SurvivorsChance) then
{
_side = "survivor";
};
};
_useLaunchers = DMS_ai_use_launchers;
_locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCityCapital"], _maxDistance]);
_i = 0;
@ -85,14 +102,23 @@ if(_vehiclesToSpawn >= 1) then
_position = position _Location;
_pos = [_position,10,250,5,0,20,0] call BIS_fnc_findSafePos;
// Get position of nearest roads
_nearRoads = _pos nearRoads 500;
_nearestRoad = _nearRoads select 0;
_nearestRoad = position (_nearRoads select 0);
_spawnLocation = [_nearestRoad select 0, _pos select 1, 0];
_group = createGroup east;
_group = createGroup SC_BanditSide;
if(_side == "survivor") then
{
deleteGroup _group;
_group = createGroup SC_SurvivorSide;
};
_group setVariable ["DMS_LockLocality",nil];
_group setVariable ["DMS_SpawnedGroup",true];
_group setVariable ["DMS_Group_Side", _side];
_VehicleClassToUse = SC_VehicleClassToUse call BIS_fnc_selectRandom;
_vehicle = createVehicle [_VehicleClassToUse, _spawnLocation, [], 0, "NONE"];
_group addVehicle _vehicle;
@ -105,6 +131,7 @@ if(_vehiclesToSpawn >= 1) then
_vehicle setVariable ["SC_vehicleSpawnLocation", _spawnLocation,true];
_vehicle setFuel 1;
_vehicle engineOn true;
if(SC_occupyVehiclesLocked) then
{
_vehicle lock 2;
@ -122,7 +149,6 @@ if(_vehiclesToSpawn >= 1) then
_vehicle limitSpeed 60;
_vehicle action ["LightOn", _vehicle];
// Calculate the crew requried
_vehicleRoles = (typeOf _vehicle) call bis_fnc_vehicleRoles;
{
@ -131,7 +157,13 @@ if(_vehiclesToSpawn >= 1) then
_vehicleSeat = _x select 1;
if(_vehicleRole == "Driver") then
{
_unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier;
_unit = [_group,_spawnLocation,"assault","random",_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
_unit disableAI "FSM";
if(_side == "survivor") then
{
removeUniform _unit;
_unit forceAddUniform "Exile_Uniform_BambiOverall";
};
_unit disableAI "TARGET";
_unit disableAI "AUTOTARGET";
_unit disableAI "AUTOCOMBAT";
@ -156,14 +188,26 @@ if(_vehiclesToSpawn >= 1) then
};
if(_vehicleRole == "Turret") then
{
_unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier;
_unit = [_group,_spawnLocation,"assault","random",_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
if(_side == "survivor") then
{
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
removeUniform _unit;
_unit forceAddUniform "Exile_Uniform_BambiOverall";
};
_unit moveInTurret [_vehicle, _vehicleSeat];
_unit setVariable ["DMS_AssignedVeh",_vehicle];
_unitPlaced = true;
};
if(_vehicleRole == "CARGO") then
{
_unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier;
_unit = [_group,_spawnLocation,"assault","random",_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
if(_side == "survivor") then
{
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
removeUniform _unit;
_unit forceAddUniform "Exile_Uniform_BambiOverall";
};
_unit assignAsCargo _vehicle;
_unit moveInCargo _vehicle;
_unit setVariable ["DMS_AssignedVeh",_vehicle];
@ -171,23 +215,23 @@ if(_vehiclesToSpawn >= 1) then
};
if(SC_extendedLogging && _unitPlaced) then
{
_logDetail = format['[OCCUPATION:Vehicle] %1 added to vehicle %2',_vehicleRole,_vehicle];
_logDetail = format['[OCCUPATION:Vehicle] %1 %2 added to vehicle %3',_side,_vehicleRole,_vehicle];
[_logDetail] call SC_fnc_log;
};
} forEach _vehicleRoles;
} forEach _vehicleRoles;
// Get the AI to shut the fuck up :)
enableSentences false;
enableRadio false;
if(SC_extendedLogging) then
{
_logDetail = format['[OCCUPATION:Vehicle] %1 spawned @ %2',_VehicleClassToUse,_spawnLocation];
[_logDetail] call SC_fnc_log;
};
_logDetail = format['[OCCUPATION:Vehicle] %3 vehicle %1 spawned @ %2',_VehicleClassToUse,_spawnLocation,_side];
[_logDetail] call SC_fnc_log;
sleep 15;
{
_x enableAI "FSM";
}forEach units _group;
[_group, _spawnLocation, 2000] call bis_fnc_taskPatrol;
_group setBehaviour "SAFE";
_group setCombatMode "RED";
@ -198,10 +242,10 @@ if(_vehiclesToSpawn >= 1) then
clearItemCargoGlobal _vehicle;
_vehicle addMagazineCargoGlobal ["HandGrenade", (random 2)];
_vehicle addItemCargoGlobal ["ItemGPS", (random 1)];
_vehicle addItemCargoGlobal ["Exile_Item_InstaDoc", (random 1)];
_vehicle addItemCargoGlobal ["Exile_Item_PlasticBottleFreshWater", 2 + (random 2)];
_vehicle addItemCargoGlobal ["Exile_Item_EMRE", 2 + (random 2)];
_vehicle addItemCargoGlobal ["ItemGPS", (random 1)];
_vehicle addItemCargoGlobal ["Exile_Item_InstaDoc", (random 1)];
_vehicle addItemCargoGlobal ["Exile_Item_PlasticBottleFreshWater", 2 + (random 2)];
_vehicle addItemCargoGlobal ["Exile_Item_EMRE", 2 + (random 2)];
// Add weapons with ammo to the vehicle
_possibleWeapons =
@ -226,8 +270,5 @@ if(_vehiclesToSpawn >= 1) then
};
};
if(SC_extendedLogging) then
{
_logDetail = format['[OCCUPATION:Vehicle] End check %1 currently active (max %2) @ %3',SC_liveVehicles,SC_maxNumberofVehicles,time];
[_logDetail] call SC_fnc_log;
};
_logDetail = format['[OCCUPATION:Vehicle] End check %1 currently active (max %2) @ %3',SC_liveVehicles,SC_maxNumberofVehicles,time];
[_logDetail] call SC_fnc_log;

View File

@ -53,11 +53,11 @@ if(_heliDamage > 0.2 && _damagedEssentials > 0 && !_crewEjected && _ejectChance
_logDetail = format ["[OCCUPATION:Sky]:: Air unit %2 ejecting passengers at %3 (time: %1)",time,_veh,_heliPosition];
[_logDetail] call SC_fnc_log;
};
_cargo = assignedCargo _veh;
{
_unit = _x;
_unit joinSilent _group2;
_unit action ["EJECT", _veh];
} forEach (assignedCargo _veh);
_x joinSilent _group2;
_x action ["EJECT", _veh];
} forEach _cargo;
_target = _this select 1;
_group2 reveal [_target,1.5];

View File

@ -0,0 +1,9 @@
// Triggered if a player gets off the public bus
// removes the addaction to stop the bus
_bus = _this select 0;
_unit = _this select 2;
if(isPlayer _unit) then
{
_bus removeAction SC_bustop;
};

View File

@ -0,0 +1,11 @@
// Triggered if a player gets on the public bus
// adds an addaction to stop the bus
_bus = _this select 0;
_unit = _this select 2;
if(isPlayer _unit) then
{
hint "You got on the bus";
SC_bustop = _bus addAction ["Stop the bus", { SC_StopTheBus = true } ];
};

View File

@ -1,7 +1,2 @@
_logDetail = format ["[OCCUPATION]:: Unit %2 killed at %1",time,_this];
[_logDetail] call SC_fnc_log;
// Get the variables from the event handler
_unit = _this select 0;
_weaponFired = _this select 1;

View File

@ -0,0 +1,30 @@
// Get the variables from the event handler
_unit = _this select 0;
_aggressor = _this select 1;
_damage = _this select 2;
// remove the eventhandler to stop it triggering multiple times simultaneously
_unit removeAllMPEventHandlers "mphit";
if (side _aggressor == RESISTANCE) then
{
// Make victim and his group aggressive to players
_initialGroup = group _unit;
_group = createGroup WEST;
{
_unit = _x;
//[_unit] joinSilent grpNull;
[_unit] joinSilent _group;
}foreach units _initialGroup;
_group reveal [_aggressor, 2.5];
_group move (position _aggressor);
diag_log format["::testing:: unit %1 damaged by %2",_unit,_aggressor];
};
if(alive _unit) then
{
// reapply the eventhandler
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
};

View File

@ -0,0 +1,12 @@
// Get the variables from the event handler
_unit = _this select 0;
_killer = _this select 1;
// remove all eventhandlers from the dead unit
_unit removeAllMPEventHandlers "mphit";
_unit removeAllMPEventHandlers "mpkilled";
if(SC_debug) then
{
{ detach _x; deleteVehicle _x; } forEach attachedObjects _unit;
};