2016-04-11 12:59:33 +00:00
|
|
|
if (!isServer) exitWith {};
|
|
|
|
|
2016-04-15 00:49:24 +00:00
|
|
|
_middle = worldSize/2;
|
|
|
|
_spawnCenter = [_middle,_middle,0]; // Centre point for the map
|
|
|
|
_maxDistance = _middle; // Max radius for the map
|
|
|
|
|
2016-04-11 12:59:33 +00:00
|
|
|
_logDetail = format ["[OCCUPATION:publicBus]:: Starting @ %1",time];
|
|
|
|
[_logDetail] call SC_fnc_log;
|
|
|
|
|
2016-04-15 00:49:24 +00:00
|
|
|
_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;
|
2016-04-11 12:59:33 +00:00
|
|
|
|
|
|
|
// Get position of nearest roads
|
2016-04-15 00:49:24 +00:00
|
|
|
_nearRoads = _positionOfBus nearRoads 2000;
|
2016-04-11 12:59:33 +00:00
|
|
|
_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
|
2016-04-11 20:17:34 +00:00
|
|
|
_publicBus = createVehicle [SC_occupyPublicBusClass, _spawnLocation, [], 0, "CAN_COLLIDE"];
|
2016-04-11 12:59:33 +00:00
|
|
|
SC_publicBusArray = SC_publicBusArray + [_publicBus];
|
|
|
|
_publicBus setVariable ["SC_assignedDriver", busDriver,true];
|
2016-04-18 19:34:50 +00:00
|
|
|
_publicBus setVariable ["SC_publicBus", true,true];
|
2016-04-11 15:39:00 +00:00
|
|
|
_publicBus setVariable ["SC_vehicleSpawnLocation", _spawnLocation,true];
|
2016-04-14 14:09:04 +00:00
|
|
|
_publicBus addEventHandler ["getin", "_this call SC_fnc_getOnBus;"];
|
|
|
|
_publicBus addEventHandler ["getout", "_this call SC_fnc_getOffBus;"];
|
2016-04-11 15:39:00 +00:00
|
|
|
|
2016-04-15 00:49:24 +00:00
|
|
|
|
2016-04-11 12:59:33 +00:00
|
|
|
_group addVehicle _publicBus;
|
|
|
|
clearBackpackCargoGlobal _publicBus;
|
|
|
|
clearItemCargoGlobal _publicBus;
|
|
|
|
clearMagazineCargoGlobal _publicBus;
|
|
|
|
clearWeaponCargoGlobal _publicBus;
|
|
|
|
_publicBus setVariable ["ExileIsPersistent", false];
|
|
|
|
_publicBus setVariable["vehPos",_spawnLocation,true];
|
|
|
|
_publicBus setFuel 1;
|
|
|
|
|
2016-04-14 08:47:40 +00:00
|
|
|
_logDetail = format['[OCCUPATION:publicBus] Vehicle spawned @ %1',_spawnLocation];
|
|
|
|
[_logDetail] call SC_fnc_log;
|
2016-04-11 12:59:33 +00:00
|
|
|
|
|
|
|
_publicBus addEventHandler ["HandleDamage", { _amountOfDamage = 0; _amountOfDamage }];
|
|
|
|
|
|
|
|
busDriver assignasdriver _publicBus;
|
2016-04-14 08:47:40 +00:00
|
|
|
busDriver moveInDriver _publicBus;
|
2016-04-11 12:59:33 +00:00
|
|
|
[busDriver] orderGetin true;
|
2016-04-14 08:47:40 +00:00
|
|
|
_publicBus lockDriver true;
|
2016-04-11 12:59:33 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
_markerName = _x;
|
|
|
|
_markerPos = getMarkerPos _markerName;
|
2016-04-11 20:17:34 +00:00
|
|
|
if (markerType _markerName == "ExileTraderZone" OR markerType _markerName == "o_unknown") then
|
2016-04-11 12:59:33 +00:00
|
|
|
{
|
|
|
|
_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];
|
2016-04-11 21:07:38 +00:00
|
|
|
"busLocation" setMarkerType "mil_warning";
|
2016-04-11 12:59:33 +00:00
|
|
|
"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;
|
2016-04-11 20:17:34 +00:00
|
|
|
_nearPlayers = (count (_pos nearEntities [['Exile_Unit_Player'],25]));
|
2016-04-11 12:59:33 +00:00
|
|
|
|
|
|
|
if (_nearPlayers >= 1) then
|
|
|
|
{
|
|
|
|
uiSleep 0.5;
|
|
|
|
_publicBus setFuel 0;
|
|
|
|
busDriver disableAI "MOVE";
|
2016-04-15 00:49:24 +00:00
|
|
|
_publicBus animateDoor ["Doors_1", 1];
|
|
|
|
_publicBus animateDoor ["Doors_2", 1];
|
|
|
|
_publicBus animateDoor ["Doors_3", 1];
|
2016-04-11 12:59:33 +00:00
|
|
|
uiSleep 3;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_publicBus setFuel 1;
|
2016-04-15 00:49:24 +00:00
|
|
|
_publicBus animateDoor ["Doors_1", 0];
|
|
|
|
_publicBus animateDoor ["Doors_2", 0];
|
|
|
|
_publicBus animateDoor ["Doors_3", 0];
|
2016-04-11 12:59:33 +00:00
|
|
|
uiSleep 3;
|
|
|
|
busDriver enableAI "MOVE";
|
|
|
|
if(!Alive busDriver) exitWith {};
|
|
|
|
};
|
2016-04-14 14:09:04 +00:00
|
|
|
uiSleep 5;
|
2016-04-11 12:59:33 +00:00
|
|
|
};
|
2016-04-14 08:47:40 +00:00
|
|
|
|
|
|
|
|