v18 fixes & tweaks

This commit is contained in:
second_coming 2016-04-14 15:09:04 +01:00
parent 8f0ef587a8
commit 6d1e98ab6c
7 changed files with 66 additions and 41 deletions

View File

@ -120,8 +120,6 @@ 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_liveVehicles = 0;
SC_liveVehiclesArray = [];
@ -129,7 +127,8 @@ SC_liveHelis = 0;
SC_liveHelisArray = [];
SC_liveBoats = 0;
SC_liveBoatsArray = [];
SC_publicBusArray = [];
SC_publicBusArray = [];
SC_StopTheBus = false;
publicVariable "SC_liveVehicles";
publicVariable "SC_liveVehiclesArray";
@ -139,3 +138,4 @@ publicVariable "SC_liveBoats";
publicVariable "SC_liveBoatsArray";
publicVariable "SC_numberofLootCrates";
publicVariable "SC_publicBusArray";
publicVariable "SC_StopTheBus";

View File

@ -2,7 +2,7 @@
//
// Server Occupation script by second_coming
//
SC_occupationVersion = "v16 (14-04-2016)";
SC_occupationVersion = "v18 (14-04-2016)";
//
// http://www.exilemod.com/profile/60-second_coming/
//
@ -44,6 +44,8 @@ SC_occupationVersion = "v16 (14-04-2016)";
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_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

@ -121,12 +121,21 @@ _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) then
{
_nearEastAI = { side _x == EAST AND _x distance _pos < 500 } count allUnits;
_nearWestAI = { side _x == WEST AND _x distance _pos < 500 } count allUnits;
_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 %2 active AI patrolling",_locationName,_aiNear];
[_logDetail] call SC_fnc_log;
};
}
else
{
if(_nearEastAI == 0 AND _nearWestAI == 0) then
{
_sideToSpawn = random 100;
@ -138,25 +147,18 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
{
_side = "bandit";
};
};
if(_nearEastAI > 0 AND _nearWestAI == 0) then
}
else
{
_side = "survivor";
};
if(_nearEastAI == 0 AND _nearWestAI > 0) then
{
_side = "bandit";
};
if(_nearEastAI > 0 AND _nearWestAI > 0) then
{
_okToSpawn = false;
if(SC_extendedLogging) then
if(_nearWestAI == 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

View File

@ -31,7 +31,8 @@ _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;
@ -102,17 +103,16 @@ while {true} do
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;
};
{
// Check for nearby missions
_missionPos = missionNamespace getVariable [format ["%1_pos",_x], []];
_missionDistance = _missionPos distance2D _pos;
if (_missionDistance<=500) then
{
// DMS Mission in range
_logDetail = format['[OCCUPATION:publicBus] Vehicle near DMS Mission @ %1 (%2 metres away)',_missionPos,(_missionPos distance2D _pos)];
[_logDetail] call SC_fnc_log;
};
} forEach allMapMarkers;

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
{
_unit removeAction _bustop;
};

View File

@ -0,0 +1,10 @@
// 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
{
_bustop = _unit addAction ["Stop the bus", { SC_StopTheBus = true } ];
};

View File

@ -10,8 +10,10 @@ if (side _aggressor == RESISTANCE) then
{
// Make victim and his group aggressive to their attacker
_group = group _unit;
_unit addRating -999999;
_group reveal [_aggressor, 2.5];
_group move (position _aggressor);
diag_log format["::testing:: unit %1 damaged by %2",_unit,_aggressor];
};