public bus service added

bug fix: attempt to sort the issue where AI groups kill each other on
spawning
This commit is contained in:
second_coming 2016-04-11 13:59:33 +01:00
parent 90e2fa3e16
commit d7fbd39a4b
10 changed files with 172 additions and 7 deletions

View File

@ -13,9 +13,9 @@
// Shared Config for each occupation monitor
SC_debug = false; // set to true to turn on debug features (not for live servers)
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_infiSTAR_log = false; // true Use infiSTAR logging, false logs to server rpt
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
@ -47,7 +47,7 @@ SC_occupyVehicle = true; // true if you want to have roaming AI vehicles
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_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)
@ -97,6 +97,7 @@ SC_liveHelis = 0;
SC_liveHelisArray = [];
SC_liveBoats = 0;
SC_liveBoatsArray = [];
SC_publicBusArray = [];
publicVariable "SC_liveVehicles";
publicVariable "SC_liveVehiclesArray";
@ -104,4 +105,5 @@ publicVariable "SC_liveHelis";
publicVariable "SC_liveHelisArray";
publicVariable "SC_liveBoats";
publicVariable "SC_liveBoatsArray";
publicVariable "SC_numberofLootCrates";
publicVariable "SC_numberofLootCrates";
publicVariable "SC_publicBusArray";

View File

@ -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];

View File

@ -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;

View File

@ -151,6 +151,12 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
DMS_ai_use_launchers = false;
_group = [_spawnPosition, _aiCount, "randomEasy", "assault", _side] call DMS_fnc_SpawnAIGroup;
DMS_ai_use_launchers = _useLaunchers;
{
_unit = _x;
[_unit] joinSilent grpNull;
[_unit] joinSilent _group;
}foreach units _group;
// Get the AI to shut the fuck up :)
enableSentences false;

View File

@ -0,0 +1,113 @@
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 ["Exile_Car_Ikarus_Party", _spawnLocation, [], 0, "CAN_COLLIDE"];
SC_publicBusArray = SC_publicBusArray + [_publicBus];
_publicBus setVariable ["SC_assignedDriver", busDriver,true];
_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") 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'],75]));
if (_nearPlayers >= 1) then
{
uiSleep 0.5;
_publicBus setFuel 0;
busDriver action ["salute", busDriver];
busDriver disableAI "MOVE";
uiSleep 3;
}
else
{
_currentDriver = driver _publicBus;
if(isPlayer _currentDriver) then
{
[_currentDriver] orderGetin false;
};
if(isnull _currentDriver) then
{
sleep 0.1;
busDriver assignAsDriver _publicBus;
busDriver moveInDriver _publicBus;
[busDriver] orderGetin true;
};
_publicBus setFuel 1;
uiSleep 3;
busDriver enableAI "MOVE";
if(!Alive busDriver) exitWith {};
};
};

View File

@ -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
{

View File

@ -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
{

View File

@ -89,6 +89,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 +131,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";

View File

@ -122,6 +122,8 @@ if(_vehiclesToSpawn >= 1) then
if(_vehicleRole == "Driver") then
{
_unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier;
[_unit] joinSilent grpNull;
[_unit] joinSilent _group;
_unit disableAI "TARGET";
_unit disableAI "AUTOTARGET";
_unit disableAI "AUTOCOMBAT";
@ -135,7 +137,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;"];
@ -147,13 +149,17 @@ if(_vehiclesToSpawn >= 1) then
if(_vehicleRole == "Turret") then
{
_unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier;
[_unit] joinSilent grpNull;
[_unit] joinSilent _group;
_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","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier;
[_unit] joinSilent grpNull;
[_unit] joinSilent _group;
_unit assignAsCargo _vehicle;
_unit moveInCargo _vehicle;
_unit setVariable ["DMS_AssignedVeh",_vehicle];

View File

@ -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;