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

This commit is contained in:
second_coming 2016-04-26 10:22:50 +01:00
commit 5cf0efe677
20 changed files with 552 additions and 272 deletions

View File

@ -21,24 +21,44 @@ SC_mapMarkers = false; // Place map markers at the occupied areas (o
SC_minFPS = 5; // any lower than minFPS on the server and additional AI won't spawn
SC_scaleAI = 10; // any more than _scaleAI players on the server and _maxAIcount is reduced for each extra player
SC_fastNights = true; // true if you want night time to go faster than daytime
SC_fastNightsStarts = 18; // Start fast nights at this hour (24 hour clock) eg. 18 for 6pm
SC_fastNightsMultiplierNight= 16; // the time multiplier to use at night (12 = 12x speed)
SC_fastNightsEnds = 6; // End fast nights at this hour (24 hour clock) eg. 6 for 6am
SC_fastNightsMultiplierDay = 4; // the time multiplier to use during daylight hours (4 = 4x speed)
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)
SC_occupyPlaces = true; // true if you want villages,towns,cities patrolled by bandits
SC_minDistanceToSpawnZones = 500; // Distance in metres (British spelling, sue me :p ) Only used by occupy Places
SC_minDistanceToTraders = 500; // Distance in metres (British spelling, sue me :p ) Only used by occupy Places
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_occupyTraders = false; // (WORK IN PROGRESS, NOT WORKING YET) true if you want to create trader camps at positions specified in SC_occupyTraderDetails
SC_occupyTraderDetails = [
["Test Trader1",[23718,16223,0],true],
["Test Trader2",[10666,10262,0],true]
]; //["Name",[x,y,z],true] trader name, location, safezone true/false
SC_SurvivorsChance = 33; // chance in % to spawn survivors instead of bandits (for places and land vehicles)
SC_SurvivorsChance = 20; // 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_occupyVehicleSurvivors = false; // true if you want a chance to spawn survivor AI as well as bandits (SC_occupyVehicle must be true to use this option)
SC_SurvivorsFriendly = true; // true if you want survivors to be friendly to players (until they are attacked by players)
// false if you want survivors to be aggressive to players
// Array of uniforms for survivor AI to use
SC_SurvivorUniforms = ["Exile_Uniform_BambiOverall"];
SC_SurvivorVests = [];
SC_SurvivorHeadgear = [];
// Array of uniforms for bandit AI to use
SC_BanditUniforms = [ "U_IG_Guerilla1_1","U_IG_Guerilla2_1","U_IG_Guerilla2_2","U_IG_Guerilla2_3","U_IG_Guerilla3_1",
"U_BG_Guerilla2_1","U_IG_Guerilla3_2","U_BG_Guerrilla_6_1","U_BG_Guerilla1_1","U_BG_Guerilla2_2",
"U_BG_Guerilla2_3","U_BG_Guerilla3_1"];
SC_BanditVests = [ "V_BandollierB_blk","V_BandollierB_cbr","V_BandollierB_khk","V_BandollierB_oli"];
SC_BanditHeadgear = [ "H_Shemag_khk","H_Shemag_olive","H_Shemag_olive_hs","H_Shemag_tan","H_ShemagOpen_khk","H_ShemagOpen_tan"];
SC_occupyMilitary = false; // true if you want military buildings patrolled
@ -74,13 +94,16 @@ SC_buildings = [ "Land_TentHangar_V1_F","Land_Hangar_F",
];
SC_occupyStatic = false; // true if you want to garrison AI in specific locations
SC_occupyStatic = false; // true if you want to add AI in specific locations
SC_staticBandits = [ [[23350,18709,0],12,400,true] ]; //[[pos],ai count,radius,search buildings]
SC_staticSurvivors = [ [[23286,18524,0],6,400,true] ]; //[[pos],ai count,radius,search buildings]
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_occupyPublicBusStartPos = []; // if empty defaults to map centre
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)
@ -134,9 +157,6 @@ SC_HeliCrashWeapons = ["srifle_DMR_02_camo_F","srifle_DMR_03_woodland_F"
SC_HeliCrashWeaponsAmount = [1,3]; // [fixed amount to add, random amount to add]
SC_HeliCrashMagazinesAmount = [2,2]; // [fixed amount to add, random amount to add]
SC_statics = [ [[1178,2524,0],8,250,true] ]; //[[pos],ai count,radius,search buildings]
SC_maximumCrewAmount = 2; // Maximum amount of AI allowed in a vehicle
// (essential crew like drivers and gunners will always spawn regardless of this setting)
@ -196,7 +216,7 @@ CIVILIAN setFriend[EAST,0];
CIVILIAN setFriend[WEST,0];
EAST setFriend[CIVILIAN,0];
WEST setFriend[CIVILIAN,0];
SC_SurvivorSide = CIVILIAN;
SC_BanditSide = EAST;
SC_liveVehicles = 0;
@ -205,6 +225,7 @@ SC_liveHelis = 0;
SC_liveHelisArray = [];
SC_liveBoats = 0;
SC_liveBoatsArray = [];
SC_liveStaticGroups = [];
SC_publicBusArray = [];
publicVariable "SC_liveVehicles";
@ -213,7 +234,11 @@ publicVariable "SC_liveHelis";
publicVariable "SC_liveHelisArray";
publicVariable "SC_liveBoats";
publicVariable "SC_liveBoatsArray";
publicVariable "SC_liveStaticGroups";
publicVariable "SC_numberofLootCrates";
publicVariable "SC_publicBusArray";
publicVariable "SC_SurvivorSide";
publicVariable "SC_BanditSide";
publicVariable "SC_BanditSide";
SC_CompiledOkay = true;

View File

@ -2,7 +2,7 @@
//
// Server Occupation script by second_coming
//
SC_occupationVersion = "v24 (18-04-2016)";
SC_occupationVersion = "v26 (22-04-2016)";
//
// http://www.exilemod.com/profile/60-second_coming/
//
@ -24,11 +24,14 @@ SC_occupationVersion = "v24 (18-04-2016)";
{
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;
sleep 10;
diag_log format ["[OCCUPATION MOD]:: Occupation %2 Loading Config at %1",time,SC_occupationVersion];
// Get the config for Occupation
call compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\config.sqf";
if(!SC_CompiledOkay) exitWith { diag_log format ["[OCCUPATION]:: Occupation failed to read config.sqf, check for typos (time: %1)",time]; };
// Select the log style depending on config settings
SC_fnc_log = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationLog.sqf";
@ -41,12 +44,16 @@ SC_occupationVersion = "v24 (18-04-2016)";
SC_fnc_airHit = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\airHit.sqf";
SC_fnc_boatHit = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\boatHit.sqf";
SC_fnc_getIn = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\getIn.sqf";
SC_fnc_getOut = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\getOut.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";
SC_fnc_changeGear = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\functions\fnc_changeGear.sqf";
SC_fnc_spawnstatics = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\functions\fnc_spawnStatics.sqf";
_logDetail = "=============================================================================================================";
[_logDetail] call SC_fnc_log;

View File

@ -0,0 +1,41 @@
private["_newUniform","_newVest","_newHeadgear","_arrowClass"];
_side = _this select 0;
_unit = _this select 1;
removeUniform _unit;
removeVest _unit;
removeHeadgear _unit;
switch (_side) do
{
case "survivor":
{
_newUniform = SC_SurvivorUniforms call BIS_fnc_selectRandom;
_newVest = SC_SurvivorVests call BIS_fnc_selectRandom;
_newHeadgear = SC_SurvivorHeadgear call BIS_fnc_selectRandom;
_arrowClass = "Sign_Arrow_Green_F";
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
};
case "bandit":
{
_newUniform = SC_BanditUniforms call BIS_fnc_selectRandom;
_newVest = SC_BanditVests call BIS_fnc_selectRandom;
_newHeadgear = SC_BanditHeadgear call BIS_fnc_selectRandom;
_arrowClass = "Sign_Arrow_F";
};
};
sleep 0.1;
_unit forceAddUniform _newUniform;
if(!isNil "_newVest") then { _unit addVest _newVest; };
if(!isNil "_newHeadgear") then { _unit addHeadgear _newHeadgear; };
_backpackChance = round (random 100);
if(_backpackChance < 40) then { removeBackpackGlobal _unit; };
if(SC_debug) then
{
_tag = createVehicle [_arrowClass, position _unit, [], 0, "CAN_COLLIDE"];
_tag attachTo [_unit,[0,0,0.6],"Head"];
};
_unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"];

View File

@ -0,0 +1,25 @@
private["_newUniform","_newVest","_newHeadgear","_arrowClass"];
_traderPosition = _this select 0;
_traderDirection = _this select 1;
_traderType = _this select 2;
"Exile_Trader_CommunityCustoms" createUnit [_traderPosition, _group, "trader = this;"];
trader setVariable ["ExileTraderType", "Exile_Trader_CommunityCustoms",true];
trader allowDamage false;
trader disableAI 'AUTOTARGET';
trader disableAI 'TARGET';
trader disableAI 'SUPPRESSION';
removeGoggles trader;
trader forceAddUniform "U_IG_Guerilla3_1";
trader addWeapon "srifle_DMR_06_olive_F";
trader addVest "V_TacVest_blk_POLICE";
trader addBackpack "B_FieldPack_oli";
trader addHeadgear "H_Cap_blk";
trader addGoggles "TRYK_TAC_SET_OD";
trader setCaptive true;
_traderDir = trader getDir _traderPos;
trader setDir _traderDir;
[trader,"WATCH1-2"] call BIS_fnc_ambientAnim;

View File

@ -0,0 +1,147 @@
_statics = _this select 0;
_side = _this select 1;
_static = [];
_currentSide = SC_BanditSide;
_debug = SC_debug;
_useLaunchers = DMS_ai_use_launchers;
_scaleAI = SC_scaleAI;
if(_side == "survivor") then { _currentSide = SC_SurvivorSide };
{
_currentStatic = _x;
_spawnPosition = _currentStatic select 0;
_aiCount = _currentStatic select 1;
_radius = _currentStatic select 2;
_staticSearch = _currentStatic select 3;
_logDetail = format ["[OCCUPATION Static]:: Checking static spawn @ %1 for existing %2 AI",_spawnPosition,_side];
[_logDetail] call SC_fnc_log;
_okToSpawn = true;
Sleep 0.1;
while{_okToSpawn} do
{
// Don't spawn additional AI if there are already AI in for that side in range
_nearAI = { side _x == _currentSide AND _x distance _spawnPosition < 250 } count allUnits;
if(_nearAI > 0) exitwith
{
_okToSpawn = false;
if(_debug) then
{
_logDetail = format ["[OCCUPATION Static]:: %1 already has %2 active AI patrolling",_spawnPosition,_nearAI];
[_logDetail] call SC_fnc_log;
};
};
// Don't spawn additional AI if there are players in range
if([_spawnPosition, 250] call ExileClient_util_world_isAlivePlayerInRange) exitwith
{
_okToSpawn = false;
if(_debug) then
{
_logDetail = format ["[OCCUPATION Static]:: %1 has players too close",_spawnPosition];
[_logDetail] call SC_fnc_log;
};
};
if(_okToSpawn) then
{
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Get AI to patrol the area
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_groupRadius = _radius;
_difficulty = "random";
DMS_ai_use_launchers = false;
_initialGroup = [_spawnPosition, _aiCount, _difficulty, "assault", _side] call DMS_fnc_SpawnAIGroup;
DMS_ai_use_launchers = _useLaunchers;
_initialGroup setCombatMode "BLUE";
_initialGroup setBehaviour "SAFE";
_group = createGroup _currentSide;
_group setVariable ["DMS_LockLocality",nil];
_group setVariable ["DMS_SpawnedGroup",true];
_group setVariable ["DMS_Group_Side", _side];
SC_liveStaticGroups = SC_liveStaticGroups + [_group,_spawnPosition];
{
_unit = _x;
[_unit] joinSilent grpNull;
[_unit] joinSilent _group;
[_side,_unit] call SC_fnc_changeGear;
}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;
_group setBehaviour "AWARE";
_group setCombatMode "RED";
}
else
{
_buildings = _spawnPosition nearObjects ["building", _groupRadius];
{
_isEnterable = [_x] call BIS_fnc_isBuildingEnterable;
if(_isEnterable) then
{
_buildingPositions = [_x, 10] call BIS_fnc_buildingPositions;
_y = _x;
// Find Highest Point
_highest = [0,0,0];
{
if(_x select 2 > _highest select 2) then
{
_highest = _x;
};
} foreach _buildingPositions;
_wpPosition = _highest;
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";
_wp setWaypointCombatMode "RED";
_wp setWaypointCompletionRadius 1;
_wp waypointAttachObject _y;
_wp setwaypointHousePosition _i;
_wp setWaypointType "SAD";
};
} foreach _buildings;
if(count _buildings > 0 && !isNil "_wp") then
{
_wp setWaypointType "CYCLE";
};
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_logDetail = format ["[OCCUPATION Static]:: Spawning %1 AI in at %2 to patrol",_aiCount,_spawnPosition];
[_logDetail] call SC_fnc_log;
if(SC_mapMarkers && !isNil "_foundBuilding") then
{
_marker = createMarker [format ["%1", _foundBuilding],_spawnPosition];
_marker setMarkerShape "Icon";
_marker setMarkerSize [3,3];
_marker setMarkerType "mil_dot";
_marker setMarkerBrush "Solid";
_marker setMarkerAlpha 0.5;
_marker setMarkerColor "ColorRed";
_marker setMarkerText "Occupied Area (static)";
};
_okToSpawn = false;
};
};
}forEach _statics;

View File

@ -0,0 +1,18 @@
private["_timeMultiplier"];
if (daytime > SC_fastNightsStarts || daytime < SC_fastNightsEnds) then
{
_timeMultiplier = SC_fastNightsMultiplierNight;
}
else
{
_timeMultiplier = SC_fastNightsMultiplierDay;
};
if(timeMultiplier != _timeMultiplier) then { setTimeMultiplier _timeMultiplier; };
_hour = floor daytime;
_minute = floor ((daytime - _hour) * 60);
_time24 = text format ["%1:%2",_hour,_minute];
_logDetail = format ["[OCCUPATION:FastNights]:: Current in game time is %1 multipler is %2",_time24,_timeMultiplier];
[_logDetail] call SC_fnc_log;

View File

@ -89,18 +89,37 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
};
// Don't spawn AI near traders and spawn zones
_nearestMarker = [allMapMarkers, _pos] call BIS_fnc_nearestPosition; // Nearest Marker to the Location
_posNearestMarker = getMarkerPos _nearestMarker;
if(_pos distance _posNearestMarker < 500) exitwith
{
_okToSpawn = false;
if(SC_extendedLogging) then
{
_logDetail = format ["[OCCUPATION:Places]:: %1 is too close to a %2",_locationName,_nearestMarker];
[_logDetail] call SC_fnc_log;
};
};
{
switch (getMarkerType _x) do
{
case "ExileSpawnZone":
{
if(_pos distance (getMarkerPos _x) < SC_minDistanceToSpawnZones) exitWith
{
_okToSpawn = false;
if(SC_extendedLogging) then
{
_logDetail = format ["[OCCUPATION:Places]:: %1 is too close to a Spawn Zone",_locationName];
[_logDetail] call SC_fnc_log;
};
};
};
case "ExileTraderZone":
{
if(_pos distance (getMarkerPos _x) < SC_minDistanceToTraders) exitWith
{
_okToSpawn = false;
if(SC_extendedLogging) then
{
_logDetail = format ["[OCCUPATION:Places]:: %1 is too close to a Trader Zone",_locationName];
[_logDetail] call SC_fnc_log;
};
};
};
};
}
forEach allMapMarkers;
// Don't spawn additional AI if there are players in range
if([_pos, 250] call ExileClient_util_world_isAlivePlayerInRange) exitwith
{
@ -181,28 +200,8 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
{
_unit = _x;
[_unit] joinSilent grpNull;
[_unit] joinSilent _group;
if(_side == "survivor") then
{
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
_unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"];
removeUniform _unit;
_survivorUniform = SC_SurvivorUniforms call BIS_fnc_selectRandom;
_unit forceAddUniform _survivorUniform;
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"];
};
};
[_unit] joinSilent _group;
[_side,_unit] call SC_fnc_changeGear;
}foreach units _initialGroup;
// Get the AI to shut the fuck up :)
@ -281,27 +280,7 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
_unit = _x;
[_unit] joinSilent grpNull;
[_unit] joinSilent _group2;
if(_side == "survivor") then
{
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
_unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"];
removeUniform _unit;
_survivorUniform = SC_SurvivorUniforms call BIS_fnc_selectRandom;
_unit forceAddUniform _survivorUniform;
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"];
};
};
[_side,_unit] call SC_fnc_changeGear;
}foreach units _initialGroup2;
[_group2, _pos, _groupRadius] call bis_fnc_taskPatrol;

View File

@ -1,16 +1,22 @@
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;
_logDetail = format ["[OCCUPATION:publicBus]:: Spawning near map centre %1 @ %2",_spawnCenter,time];
if( count SC_occupyPublicBusStartPos == 0) then
{
//if(worldName == 'Namalsk') then { _spawnCenter = [6400,6400,0]; } else
//{
_middle = worldSize/2;
_spawnCenter = [_middle,_middle,0];
//};
SC_occupyPublicBusStartPos = _spawnCenter;
};
_logDetail = format ["[OCCUPATION:publicBus]:: Spawning near map centre %1 @ %2",SC_occupyPublicBusStartPos,time];
[_logDetail] call SC_fnc_log;
_positionOfBus = [_spawnCenter,0,500,25,0,10,0] call BIS_fnc_findSafePos;
_positionOfBus = [SC_occupyPublicBusStartPos,0,500,25,0,10,0] call BIS_fnc_findSafePos;
// Get position of nearest roads
_nearRoads = _positionOfBus nearRoads 2000;

View File

@ -11,13 +11,8 @@ _maxDistance = _middle; // Max radius for the map
_maxAIcount = SC_maxAIcount;
_minFPS = SC_minFPS;
_debug = SC_debug;
_useLaunchers = DMS_ai_use_launchers;
_scaleAI = SC_scaleAI;
_statics = SC_statics; // details for the static spawns
_static = [];
_currentPlayerCount = count playableUnits;
if(_currentPlayerCount > _scaleAI) then
{
@ -39,147 +34,9 @@ if(_aiActive > _maxAIcount) exitWith
[_logDetail] call SC_fnc_log;
};
{
_currentStatic = _x;
_spawnPosition = _currentStatic select 0;
_aiCount = _currentStatic select 1;
_radius = _currentStatic select 2;
_staticSearch = _currentStatic select 3;
_logDetail = format ["[OCCUPATION Static]:: Checking static spawn @ %1",_spawnPosition,_aiCount];
[_logDetail] call SC_fnc_log;
_okToSpawn = true;
Sleep 0.1;
while{_okToSpawn} do
{
// Don't spawn additional AI if there are already AI in range
_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,_nearBanditAI];
[_logDetail] call SC_fnc_log;
};
};
// Don't spawn additional AI if there are players in range
if([_spawnPosition, 250] call ExileClient_util_world_isAlivePlayerInRange) exitwith
{
_okToSpawn = false;
if(_debug) then
{
_logDetail = format ["[OCCUPATION Static]:: %1 has players too close",_spawnPosition];
[_logDetail] call SC_fnc_log;
};
};
if(_okToSpawn) then
{
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Get AI to patrol the area
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_groupRadius = _radius;
_difficulty = "random";
_side = "bandit";
DMS_ai_use_launchers = false;
_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] joinSilent grpNull;
[_unit] joinSilent _group;
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;
_group setBehaviour "AWARE";
_group setCombatMode "RED";
}
else
{
_buildings = _spawnPosition nearObjects ["building", _groupRadius];
{
_isEnterable = [_x] call BIS_fnc_isBuildingEnterable;
if(_isEnterable) then
{
_buildingPositions = [_x, 10] call BIS_fnc_buildingPositions;
_y = _x;
// Find Highest Point
_highest = [0,0,0];
{
if(_x select 2 > _highest select 2) then
{
_highest = _x;
};
} foreach _buildingPositions;
_wpPosition = _highest;
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";
_wp setWaypointCombatMode "RED";
_wp setWaypointCompletionRadius 1;
_wp waypointAttachObject _y;
_wp setwaypointHousePosition _i;
_wp setWaypointType "SAD";
};
} foreach _buildings;
if(count _buildings > 0 && !isNil "_wp") then
{
_wp setWaypointType "CYCLE";
};
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_logDetail = format ["[OCCUPATION Static]:: Spawning %1 AI in at %2 to patrol",_aiCount,_spawnPosition];
[_logDetail] call SC_fnc_log;
if(SC_mapMarkers && !isNil "_foundBuilding") then
{
_marker = createMarker [format ["%1", _foundBuilding],_spawnPosition];
_marker setMarkerShape "Icon";
_marker setMarkerSize [3,3];
_marker setMarkerType "mil_dot";
_marker setMarkerBrush "Solid";
_marker setMarkerAlpha 0.5;
_marker setMarkerColor "ColorRed";
_marker setMarkerText "Occupied Area (static)";
};
_okToSpawn = false;
};
};
}forEach _statics;
// Create the static AI
if(!isNil "SC_staticBandits") then { [SC_staticBandits,"bandit"] call SC_fnc_spawnStatics; };
if(!isNil "SC_staticSurvivors") then { [SC_staticSurvivors,"survivor"] call SC_fnc_spawnStatics; };
_logDetail = "[OCCUPATION Static]: Ended";
[_logDetail] call SC_fnc_log;

View File

@ -0,0 +1,106 @@
_logDetail = format['[OCCUPATION:Traders] starting @ %1',time];
[_logDetail] call SC_fnc_log;
{
_traderName = _x select 0;
_traderPos = _x select 1;
_createSafezone = _x select 2;
_traderBaseFile = call compile preprocessFileLineNumbers "x\addons\a3_exile_occupation\trader\trader.sqf";
_traderObjects = _traderBaseFile apply
{
private ["_obj","_pos"];
_obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"];
_pos = _x select 1;
_pos set [2,(_pos select 2)+5000];
if (_x select 4) then
{
_obj setDir (_x select 2);
_obj setPosATL _pos;
}
else
{
_obj setPosATL _pos;
_obj setVectorDirAndUp (_x select 3);
};
_obj;
};
[_traderObjects,_traderPos] call DMS_fnc_setRelPositions;
{
_obj = _x;
_pos = getPos _obj;
_obj setPos _pos;
_obj enableSimulation false;
}forEach _traderObjects;
_traderName setmarkeralpha 0;
_marker = createMarker [ format [" %1 ", _traderName], _traderPos];
_marker setMarkerText format ["%1", _traderName];
_marker setMarkerSize [3,3];
_marker setMarkerShape "ICON";
_marker setMarkerType "loc_Tree";
_marker setMarkerColor "ColorBlack";
_marker setMarkerBrush "Vertical";
if(_createSafezone) then
{
ExileTraderZoneMarkerPositions pushBack _traderPos;
ExileTraderZoneMarkerPositionsAndSize pushBack [_traderPos, 175];
publicVariable "ExileTraderZoneMarkerPositions";
publicVariable "ExileTraderZoneMarkerPositionsAndSize";
};
_logDetail = format['[OCCUPATION:Traders] Created trader base %1 @ %2',_traderName,_traderPos];
[_logDetail] call SC_fnc_log;
_group = createGroup resistance;
_group setCombatMode "BLUE";
_traderPosition = _traderPos findEmptyPosition [0,25];
"Exile_Trader_CommunityCustoms" createUnit [_traderPosition, _group, "trader = this;"];
trader setVariable ["ExileTraderType", "Exile_Trader_CommunityCustoms",true];
trader allowDamage false;
trader disableAI 'AUTOTARGET';
trader disableAI 'TARGET';
trader disableAI 'SUPPRESSION';
trader disableAI "MOVE";
removeGoggles trader;
trader forceAddUniform "U_IG_Guerilla3_1";
trader addWeapon "srifle_DMR_06_olive_F";
trader addVest "V_TacVest_blk_POLICE";
trader addBackpack "B_FieldPack_oli";
trader addHeadgear "H_Cap_blk";
trader addGoggles "TRYK_TAC_SET_OD";
trader setCaptive true;
_traderDir = trader getDir _traderPos;
trader setDir _traderDir;
[trader,"HubStandingUA_idle2"] call BIS_fnc_ambientAnim;
_traderPosition = _traderPos findEmptyPosition [0,25];
"Exile_Trader_CommunityCustoms" createUnit [_traderPosition, _group, "trader = this;"];
trader setVariable ["ExileTraderType", "Exile_Trader_CommunityCustoms",true];
trader allowDamage false;
trader disableAI 'AUTOTARGET';
trader disableAI 'TARGET';
trader disableAI 'SUPPRESSION';
trader disableAI "MOVE";
removeGoggles trader;
trader forceAddUniform "U_IG_Guerilla3_1";
trader addWeapon "srifle_DMR_06_olive_F";
trader addVest "V_TacVest_blk_POLICE";
trader addBackpack "B_FieldPack_oli";
trader addHeadgear "H_Cap_blk";
trader addGoggles "TRYK_TAC_SET_OD";
trader setCaptive true;
_traderDir = trader getDir _traderPos;
trader setDir _traderDir;
[trader,"HubStanding_idle1"] call BIS_fnc_ambientAnim;
} foreach SC_occupyTraderDetails;

View File

@ -165,25 +165,12 @@ if(_vehiclesToSpawn >= 1) then
_unit removeAllMPEventHandlers "mphit";
_unit removeAllMPEventHandlers "mpkilled";
_unit disableAI "FSM";
if(_side == "survivor") then
{
removeUniform _unit;
sleep 0.1;
_survivorUniform = SC_SurvivorUniforms call BIS_fnc_selectRandom;
_unit forceAddUniform _survivorUniform;
};
[_side,_unit] call SC_fnc_changeGear;
_unit disableAI "TARGET";
_unit disableAI "AUTOTARGET";
_unit disableAI "AUTOCOMBAT";
_unit disableAI "COVER";
_unit disableAI "SUPPRESSION";
sleep 0.1;
if(SC_debug) then
{
_tag = createVehicle ["Sign_Arrow_Green_F", position _unit, [], 0, "CAN_COLLIDE"];
_tag attachTo [_unit,[0,0,0.6],"Head"];
};
sleep 0.1;
_unit disableAI "SUPPRESSION";
_unit assignAsDriver _vehicle;
_unit moveInDriver _vehicle;
_unit setVariable ["DMS_AssignedVeh",_vehicle];
@ -191,6 +178,7 @@ if(_vehiclesToSpawn >= 1) then
_unit addMPEventHandler ["mpkilled", "_this call SC_fnc_driverKilled;"];
_vehicle setVariable ["SC_assignedDriver", _unit,true];
_vehicle addEventHandler ["getin", "_this call SC_fnc_getIn;"];
_vehicle addEventHandler ["getout", "_this call SC_fnc_getOut;"];
_vehicle addMPEventHandler ["mpkilled", "_this call SC_fnc_vehicleDestroyed;"];
_vehicle addMPEventHandler ["mphit", "_this call SC_fnc_repairVehicle;"];
};
@ -198,15 +186,7 @@ if(_vehiclesToSpawn >= 1) then
{
_unit = [_group,_spawnLocation,"assault","random",_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
_amountOfCrew = _amountOfCrew + 1;
if(_side == "survivor") then
{
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
_unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"];
removeUniform _unit;
sleep 0.1;
_survivorUniform = SC_SurvivorUniforms call BIS_fnc_selectRandom;
_unit forceAddUniform _survivorUniform;
};
[_side,_unit] call SC_fnc_changeGear;
_unit moveInTurret [_vehicle, _vehicleSeat];
_unit setVariable ["DMS_AssignedVeh",_vehicle];
_unitPlaced = true;
@ -215,15 +195,7 @@ if(_vehiclesToSpawn >= 1) then
{
_unit = [_group,_spawnLocation,"assault","random",_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
_amountOfCrew = _amountOfCrew + 1;
if(_side == "survivor") then
{
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
_unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"];
removeUniform _unit;
sleep 0.1;
_survivorUniform = SC_SurvivorUniforms call BIS_fnc_selectRandom;
_unit forceAddUniform _survivorUniform;
};
[_side,_unit] call SC_fnc_changeGear;
_unit assignAsCargo _vehicle;
_unit moveInCargo _vehicle;
_unit setVariable ["DMS_AssignedVeh",_vehicle];

View File

@ -52,7 +52,7 @@ if(count units _group > 0) then
if(SC_debug) then
{
_tag = createVehicle ["Sign_Arrow_Green_F", position _driver, [], 0, "CAN_COLLIDE"];
_tag = createVehicle ["Sign_Arrow_Yellow_F", position _driver, [], 0, "CAN_COLLIDE"];
_tag attachTo [_driver,[0,0,0.6],"Head"];
};

View File

@ -13,6 +13,13 @@ if(isPlayer _unit) then
_logDetail = format ["[OCCUPATION:claimVehicle]:: Unit %3 has claimed vehicle %2 at %1",time,_vehicle,_unit];
[_logDetail] call SC_fnc_log;
};
}
else
{
if(SC_debug) then
{
{ deleteVehicle _x; } forEach attachedObjects _unit;
};
};

View File

@ -0,0 +1,27 @@
// Triggered if an AI unit leaves an AI vehicle
_unit = _this select 0;
_vehicle = _this select 2;
_driver = _vehicle getVariable "SC_assignedDriver";
_arrowClass = "Sign_Arrow_F";
if(!alive _unit) exitWith {};
if(side _unit == SC_SurvivorSide) then
{
_arrowClass = "Sign_Arrow_Green_F";
}
else
{
_arrowClass = "Sign_Arrow_F";
};
if(_unit == _driver) then
{
_arrowClass = "Sign_Arrow_Yellow_F";
};
if(SC_debug && alive _unit) then
{
_tag = createVehicle [_arrowClass, position _unit, [], 0, "CAN_COLLIDE"];
_tag attachTo [_unit,[0,0,0.6],"Head"];
};

View File

@ -57,13 +57,6 @@ if(_damagedWheels > 0 OR _engineDamage OR _fueltankDamage) then
_driver disableAI "SUPPRESSION";
sleep 1;
_driver action ["getOut", _vehicle];
if(SC_debug) then
{
_tag = createVehicle ["Sign_Arrow_Green_F", position _driver, [], 0, "CAN_COLLIDE"];
_tag attachTo [_driver,[0,0,0.6],"Head"];
};
sleep 0.2;
_driver doMove (position _vehicle);
_driverDir = _driver getDir _vehicle;
_driver setUnitPos "MIDDLE";

View File

@ -14,17 +14,10 @@ if (side _aggressor == RESISTANCE) then
{
_unit = _x;
//[_unit] joinSilent grpNull;
[_unit] joinSilent _group;
[_unit] joinSilent _group;
_unit removeAllMPEventHandlers "mphit";
}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

@ -7,5 +7,5 @@ _unit removeAllMPEventHandlers "mphit";
if(SC_debug) then
{
{ detach _x; deleteVehicle _x; } forEach attachedObjects _unit;
{ deleteVehicle _x; } forEach attachedObjects _unit;
};

View File

@ -4,6 +4,8 @@
_vehicle = _this select 0;
_vehicle removeAllMPEventHandlers "mphit";
_vehicle removeAllMPEventHandlers "mpkilled";
_vehicle removeAllEventHandlers "getin";
_vehicle removeAllEventHandlers "getout";
if(_vehicle isKindOf "LandVehicle") then
{

View File

@ -4,14 +4,22 @@ if (!isServer) exitWith {};
_logDetail = format ["[OCCUPATION]:: Occupation %2 Initialised at %1",time,SC_occupationVersion];
[_logDetail] call SC_fnc_log;
[] call ExileClient_system_map_initialize;
if(SC_debug) then { SC_refreshTime = 60; }else{ SC_refreshTime = 300; };
// Add selected occupation scripts to Exile Threading System
if(SC_occupyPublicBus) then
if (SC_fastNights) then
{
[] execVM "\x\addons\a3_exile_occupation\scripts\occupationPublicBus.sqf";
fnc_checkMultiplier = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationFastNights.sqf";
[60, fnc_checkMultiplier, [], true] call ExileServer_system_thread_addTask;
};
if(SC_occupyTraders) then
{
uiSleep 15; // delay the start
call compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationTraders.sqf";
};
if(SC_occupyLootCrates) then
@ -73,6 +81,10 @@ if(SC_occupyMilitary) then
[SC_refreshTime, fnc_occupationMilitary, [], true] call ExileServer_system_thread_addTask;
};
if(SC_occupyPublicBus) then
{
[] execVM "\x\addons\a3_exile_occupation\scripts\occupationPublicBus.sqf";
};
uiSleep 15; // delay the start
fnc_occupationMonitor = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationMonitor.sqf";

63
trader/trader.sqf Normal file
View File

@ -0,0 +1,63 @@
private ["_obj"];
_obj = [
["Flag_Green_F",[6784.61,2234.17,0],0,[[0,1,0],[0,0,1]],true],
["Land_LampHalogen_F",[6781.62,2236.18,4.76837e-007],0,[[0,1,0],[0,0,1]],true],
["Land_BagBunker_Tower_F",[6785.5,2236.32,0],0,[[0,1,0],[0,0,1]],true],
["Land_HBarrierWall_corridor_F",[6792.26,2215.3,0],90.8969,[[0.999877,-0.0156535,0],[0,-0,1]],true],
["Land_HBarrierWall_corner_F",[6787.26,2218.83,0],180,[[-8.74228e-008,-1,0],[-0,0,1]],true],
["Land_HBarrierWall4_F",[6802.85,2219.04,0],181.56,[[-0.0272239,-0.999629,0],[-0,0,1]],true],
["Land_HBarrierWall4_F",[6808.37,2219.03,0],181.56,[[-0.0272239,-0.999629,0],[-0,0,1]],true],
["Land_HBarrierWall4_F",[6786.7,2223.28,0],271.56,[[-0.999629,0.027224,0],[0,0,1]],true],
["Land_HBarrierWall4_F",[6797.38,2219.01,0],181.56,[[-0.0272239,-0.999629,0],[-0,0,1]],true],
["Land_HBarrierWall4_F",[6786.6,2228.88,0],271.56,[[-0.999629,0.027224,0],[0,0,1]],true],
["Land_HBarrierWall4_F",[6813.69,2219.18,0],181.56,[[-0.0272239,-0.999629,0],[-0,0,1]],true],
["Land_BagBunker_Small_F",[6797.94,2212.17,0],0,[[0,1,0],[0,0,1]],true],
["WaterPump_01_forest_F",[6812.35,2222.43,0.0008564],0.00101824,[[1.75769e-005,1,0],[0,0,1]],true],
["Land_Pipes_large_F",[6802.52,2223.54,0],180,[0,0,1],true],
["Land_Pipes_large_F",[6802.98,2225.14,0],180,[0,0,1],true],
["Land_Pipes_large_F",[6802.32,2221.82,0],180,[0,0,1],true],
["Land_WaterTank_F",[6809.06,2221.62,-4.76837e-006],359.999,[0,0,1],true],
["Land_Pallets_F",[6784.61,2234.17,0],0,[[0,1,0],[0,0,1]],true],
["Land_Sign_WarningMilitaryArea_F",[6787.54,2212.37,0],8.19623e-005,[[1.5979e-006,1,0],[0,0,1]],true],
["Land_BagFence_Round_F",[6786.37,2238.76,2.78],220,[[-0.642788,-0.766044,0],[-0,0,1]],true],
["Land_BagFence_Round_F",[6784.2,2238.49,2.78],125,[[0.819152,-0.573576,0],[0,-0,1]],true],
["Land_Pallet_F",[6784.56,2235.6,0.0981288],3.03364,[[0.0529221,0.998599,0],[0,0,1]],true],
["Land_Pallet_F",[6784.55,2236.99,0.0814247],356.286,[[-0.0647757,0.9979,0],[0,0,1]],true],
["Land_Pallet_F",[6784.54,2238.55,-4.76837e-007],360,[[1.74846e-007,1,0],[0,0,1]],true],
["Land_PaperBox_closed_F",[6794.19,2226.73,0],320,[[-0.642787,0.766045,0],[0,0,1]],true],
["Land_PaperBox_closed_F",[6791.38,2226.37,0],255,[[-0.965926,-0.258819,0],[-0,0,1]],true],
["Land_PaperBox_closed_F",[6793.82,2224.24,0],280,[[-0.984808,0.173649,0],[0,0,1]],true],
["Land_PaperBox_closed_F",[6791.46,2224.07,0],90,[[1,-4.37114e-008,0],[0,-0,1]],true],
["Land_LampHalogen_F",[6802.4,2215.7,4.76837e-007],270,[[-1,4.88762e-007,0],[0,0,1]],true],
["Land_HBarrierTower_F",[6787.46,2256.03,0],140,[[0.642787,-0.766045,0],[0,-0,1]],true],
["Land_HBarrierWall6_F",[6786.93,2244.97,0],270,[[-1,4.88762e-007,0],[0,0,1]],true],
["Land_HBarrierWall6_F",[6794.56,2256.56,0],3.15003,[[0.0549506,0.998489,0],[0,0,1]],true],
["Land_HBarrierWall_corridor_F",[6811.83,2260.33,0],90.8969,[[0.999877,-0.0156535,0],[0,-0,1]],true],
["Land_HBarrierWall4_F",[6806.85,2256.56,0],1.56032,[[0.0272296,0.999629,0],[0,0,1]],true],
["Land_HBarrierWall4_F",[6786.79,2250.58,0],271.56,[[-0.999629,0.027224,0],[0,0,1]],true],
["Land_HBarrierWall4_F",[6801.41,2256.53,0],1.56,[[0.0272237,0.999629,0],[0,0,1]],true],
["Land_BagBunker_Small_F",[6805.37,2261.99,0],180,[[-8.74228e-008,-1,0],[-0,0,1]],true],
["Land_FieldToilet_F",[6806.4,2242.7,4.24385e-005],270,[[-1,4.88762e-007,0],[0,0,1]],true],
["Land_Pallet_MilBoxes_F",[6811.32,2247.61,0],0,[[0,1,0],[0,0,1]],true],
["Land_PaperBox_open_full_F",[6806.73,2251.91,0],0,[[0,1,0],[0,0,1]],true],
["Land_PaperBox_open_full_F",[6809.12,2247.42,0],0,[[0,1,0],[0,0,1]],true],
["Land_PaperBox_open_empty_F",[6809.19,2251.86,0],0,[[0,1,0],[0,0,1]],true],
["Land_PaperBox_closed_F",[6809.15,2249.86,0],0,[[0,1,0],[0,0,1]],true],
["Land_PaperBox_closed_F",[6806.56,2247.15,0],255,[[-0.965926,-0.258819,0],[-0,0,1]],true],
["Land_PaperBox_closed_F",[6806.51,2249.71,0],0,[[0,1,0],[0,0,1]],true],
["Land_Pallets_stack_F",[6808.97,2245.2,-4.76837e-007],360,[[1.74846e-007,1,0],[0,0,1]],true],
["Land_Pallet_vertical_F",[6808.94,2246.27,0.000220776],0.000954998,[[1.65116e-005,1,0],[0,0,1]],true],
["Land_LampHalogen_F",[6800.11,2260.46,4.76837e-007],90,[[1,-4.37114e-008,0],[0,-0,1]],true],
["Land_BagBunker_Large_F",[6821.33,2237.75,0],270,[[-1,4.88762e-007,0],[0,0,1]],true],
["Land_HBarrierTower_F",[6817.26,2219.4,0],315,[[-0.707107,0.707107,0],[0,0,1]],true],
["Land_HBarrierWall4_F",[6817,2224.9,0],91.5603,[[0.999629,-0.0272291,0],[0,-0,1]],true],
["Land_HBarrierWall4_F",[6816.92,2230.47,0],91.5603,[[0.999629,-0.0272291,0],[0,-0,1]],true],
["Land_LampHalogen_F",[6819.85,2232.55,4.76837e-007],180,[[-8.74228e-008,-1,0],[-0,0,1]],true],
["Land_HBarrierWall_corner_F",[6816.66,2256.74,0],0,[[0,1,0],[0,0,1]],true],
["Land_HBarrierWall4_F",[6817.16,2252.26,0],91.5603,[[0.999629,-0.0272291,0],[0,-0,1]],true],
["Land_Sign_WarningMilitaryArea_F",[6816.03,2262.96,0],180,[[-8.74228e-008,-1,0],[-0,0,1]],true],
["Land_HBarrierWall6_F",[6817.3,2246.33,0],90,[[1,-4.37114e-008,0],[0,-0,1]],true]
];
_obj