V61 Fixes

This commit is contained in:
second_coming 2016-08-24 14:48:33 +01:00
parent 98ea77fd87
commit 6008a6104e
14 changed files with 131 additions and 59 deletions

View File

@ -1,3 +1,9 @@
=================================================================================
V61 (24-08-2016)
=================================================================================
Fixes for the eventhandler on ground vehicles that were causing server freezing
other additional tweaks (can't remember exactly what :o )
=================================================================================
V60 (15-08-2016)
=================================================================================

View File

@ -4,7 +4,7 @@ class CfgPatches
units[] = {};
weapons[] = {};
requiredVersion = 0.1;
a3_exile_occupation_version = "V60 (15-08-2016)";
a3_exile_occupation_version = "V61 (24-08-2016)";
requiredAddons[] = {"a3_dms"};
author[]= {"second_coming"};
};

View File

@ -46,7 +46,7 @@ SC_occupyStatic = false; // true if you want to add AI in specifi
SC_occupyTransport = true; // true if you want pubic transport (travels between traders)
SC_occupyLootCrates = true; // true if you want to have random loot crates with guards
SC_occupyRandomSpawn = true; // (WORK IN PROGRESS) true if you want random spawning AI that hunt for nearby players
SC_occupyMilitary = true; // true if you want military buildings patrolled
SC_occupyMilitary = false; // true if you want military buildings patrolled
SC_occupyVehicle = true; // true if you want to have roaming AI land 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
@ -243,11 +243,11 @@ SC_maximumCrewAmount = 3; // Maximum amount of AI allowed in a vehi
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
SC_maxNumberofVehicles = 3; // How many roaming vehicles to spawn
SC_occupyVehicleIgnoreCount = false; // true if you want spawn vehicles regardless of overall AI count
SC_occupyVehicleIgnoreCount = true; // true if you want spawn vehicles regardless of overall AI count
SC_occupyVehiclesLocked = false; // true if AI vehicles to stay locked until all the linked AI are dead
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_occupyVehicleUseFixedPos = false; // True if you want to specify the patrol positions and radius of the area to patrol / false for random
SC_occupyVehicleUseFixedPos = true; // True if you want to specify the patrol positions and radius of the area to patrol / false for random
// if you set SC_maxNumberofVehicles higher than the number of static positions, the remainder will be random
// they will also ignore any blacklisted areas
@ -397,16 +397,6 @@ SC_BanditBackpack = ["B_HuntingBackpack","B_Kitbag_cbr","B_Kitbag_mca
// Map Specific Overrides
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (worldName == 'Namalsk' AND SC_useMapOverrides) then
{
SC_maxAIcount = 80;
SC_occupySky = false;
SC_maxNumberofVehicles = 2;
SC_numberofLootCrates = 3;
SC_numberofHeliCrashes = 2;
SC_maxNumberofBoats = 1;
SC_occupyTransportClass = "Exile_Car_LandRover_Urban"; // the ikarus bus gets stuck on Namalsk
};
if (worldName == 'Napf' AND SC_useMapOverrides) then
{
@ -423,6 +413,7 @@ if (worldName == 'Chernarus' AND SC_useMapOverrides) then
if (worldName == 'Tanoa' AND SC_useMapOverrides) then
{
SC_useApexClasses = true;
SC_maxAIcount = 80;
};
@ -460,7 +451,7 @@ if (SC_debug) then
SC_processReporter = true;
SC_mapMarkers = true;
SC_occupyPlaces = true;
SC_occupyVehicle = true;
SC_occupyVehicle = false;
SC_occupyMilitary = true;
SC_occupyRandomSpawn = true;
SC_occupyStatic = false;

View File

@ -11,6 +11,7 @@ if(isPlayer _unit) then
if(!alive _x) then { _x action ["EJECT", _vehicle]; };
}forEach units _group;
_vehicle setVariable ["SC_vehicleSpawnLocation", nil,true];
[_vehicle] call SC_fnc_vehicleDestroyed;
if(SC_extendedLogging) then

View File

@ -7,25 +7,28 @@ _repairStatus = _vehicle getVariable "SC_repairStatus";
if(_repairStatus) exitWith {};
// Mark the vehicle as currently being repaired
_vehicle setVariable ["SC_repairStatus",true];
_vehicle setVariable ["SC_repairStatus",true,true];
_vehicleDamage = damage _vehicle;
_damagedWheels = 0;
_damageLimit = 1;
_damageLimit = 0.2;
_engineDamage = false;
_fueltankDamage = false;
_wheelDamage = false;
_assignedDriver = _vehicle getVariable "SC_assignedDriver";
_group = group _vehicle;
// Remove dead units from the group
{
if(!alive _x) then { [_x] join grpNull; };
}forEach units _group;
if(count(units _group) == 0) exitWith { [_vehicle] call SC_fnc_vehicleDestroyed; };
if(isNil "_assignedDriver") then
{
_group = group _vehicle;
// Remove dead units from the group
{
if(!alive _x) then { [_x] join grpNull; };
}forEach units _group;
_groupMembers = units _group;
_assignedDriver = _groupMembers call BIS_fnc_selectRandom;
@ -59,12 +62,12 @@ _wheels = ["HitLFWheel","HitLF2Wheel","HitRFWheel","HitRF2Wheel","HitLBWheel","H
_logDetail = format ["[OCCUPATION:repairVehicle]:: Vehicle %1 checking wheel %2 (damage: %4) @ %3",_vehicle, _x, time,_partDamage];
[_logDetail] call SC_fnc_log;
};
if(_partDamage > 0.3) then { _wheelDamage = true; };
if(_partDamage == 1) then { _wheelDamage = true; };
};
} forEach _wheels;
// Check Engine
if ((_vehicle getHitPointDamage "HitEngine") >= _damageLimit) then { _engineDamage = true; };
if ((_vehicle getHitPointDamage "HitEngine") == 1) then { _engineDamage = true; };
// Check Fuel Tank
if ((_vehicle getHitPointDamage "HitFuel") > 0) then { _fueltankDamage = true; };
@ -131,12 +134,12 @@ if(_wheelDamage OR _engineDamage OR _fueltankDamage) then
_driver enableAI "FSM";
};
// Mark the vehicle as not currently being repaired
_vehicle setVariable ["SC_repairStatus",false];
_vehicle setVariable ["SC_repairStatus",false,true];
}
else
{
_logDetail = format ["[OCCUPATION:repairVehicle]:: Not repairing %2, driver is %3 at %1",time,_vehicle,_assignedDriver];
[_logDetail] call SC_fnc_log;
_logDetail = format ["[OCCUPATION:repairVehicle]:: Vehicle: %1 damage: %2 engine: %3 fuelTank: %4",_vehicle,_vehicleDamage,_engineDamage,_fueltankDamage];
// Mark the vehicle as not currently being repaired
_vehicle setVariable ["SC_repairStatus",false,true];
_logDetail = format ["[OCCUPATION:repairVehicle]:: Not enough damage to disable %2, driver is %3 at %1",time,_vehicle,_assignedDriver];
[_logDetail] call SC_fnc_log;
};

View File

@ -5,20 +5,33 @@ if((damage _vehicle) < 1) then
_vehicle removeAllMPEventHandlers "mphit";
};
if(_vehicle isKindOf "LandVehicle") then
SC_liveVehiclesArray = [];
SC_liveHelisArray = [];
SC_liveBoatsArray = [];
{
SC_liveVehiclesArray = SC_liveVehiclesArray - [_vehicle];
_vehicle = _x;
_vehLocation = _x getVariable "SC_vehicleSpawnLocation";
_transport = _x getVariable "SC_transport";
if(!isNil "_vehLocation") then
{
if(_vehicle isKindOf "LandVehicle") then
{
SC_liveVehiclesArray pushBack _vehicle;
SC_liveVehicles = count(SC_liveVehiclesArray);
};
};
if(_vehicle isKindOf "Air") then
{
SC_liveHelisArray = SC_liveHelisArray - [_vehicle];
if(_vehicle isKindOf "Air" && isNil "_transport") then
{
SC_liveHelisArray pushBack _vehicle;
SC_liveHelis = count(SC_liveHelisArray);
};
};
if(_vehicle isKindOf "Ship") then
{
SC_liveBoatsArray = SC_liveBoatsArray - [_vehicle];
if(_vehicle isKindOf "Ship") then
{
SC_liveBoatsArray pushBack _vehicle;
SC_liveBoatss = count(SC_liveBoatsArray);
};
};
};
}forEach vehicles;

View File

@ -87,7 +87,7 @@ if(count(crew _vehicle) > 0)then
_unit enableAI "MOVE";
reload _unit;
}foreach units _group;
deleteGroup _group;
_GroupLeader = leader (group _vehicle);
_GroupLeader doMove _originalSpawnLocation;
@ -103,10 +103,11 @@ if(count(crew _vehicle) > 0)then
_vehicle setVariable["vehPos",_newPos];
};
if(count units _group > 0) then
if(count units _group == 0) then
{
_vehicle lock 0;
_vehicle setVehicleLock "UNLOCKED";
_vehicle setVariable ["ExileIsLocked", 0, true];
[_vehicle] call SC_fnc_vehicleDestroyed;
};

View File

@ -90,7 +90,7 @@ for "_i" from 1 to SC_numberofLootCrates do
[_unit] joinSilent _group;
_unit setCaptive false;
}foreach units _initialGroup;
deleteGroup _initialGroup;
[_group, _spawnPosition, 100] call bis_fnc_taskPatrol;
_group setBehaviour "STEALTH";

View File

@ -107,9 +107,15 @@ if(_aiActive > _maxAIcount) exitWith
if(!SC_useWaypoints) then
{
DMS_ai_use_launchers = false;
_group = [_spawnPosition, _aiCount, _difficulty, "random", "bandit"] call DMS_fnc_SpawnAIGroup;
_groupInitial = [_spawnPosition, _aiCount, _difficulty, "random", "bandit"] call DMS_fnc_SpawnAIGroup;
DMS_ai_use_launchers = _useLaunchers;
_group = createGroup SC_BanditSide;
_group setVariable ["DMS_AllowFreezing",true];
_group setVariable ["DMS_LockLocality",false];
_group setVariable ["DMS_SpawnedGroup",true];
_group setVariable ["DMS_Group_Side", "bandit"];
{
_unit = _x;
[_unit] joinSilent grpNull;
@ -132,9 +138,15 @@ if(_aiActive > _maxAIcount) exitWith
{
DMS_ai_use_launchers = false;
_group = [_spawnPosition, _aiCount, _difficulty, "random", "bandit"] call DMS_fnc_SpawnAIGroup;
_groupInitial = [_spawnPosition, _aiCount, _difficulty, "random", "bandit"] call DMS_fnc_SpawnAIGroup;
DMS_ai_use_launchers = _useLaunchers;
_group = createGroup SC_BanditSide;
_group setVariable ["DMS_AllowFreezing",true];
_group setVariable ["DMS_LockLocality",false];
_group setVariable ["DMS_SpawnedGroup",true];
_group setVariable ["DMS_Group_Side", "bandit"];
{
_unit = _x;
[_unit] joinSilent grpNull;
@ -146,7 +158,8 @@ if(_aiActive > _maxAIcount) exitWith
_tag = createVehicle ["Sign_Arrow_Blue_F", position _unit, [], 0, "CAN_COLLIDE"];
_tag attachTo [_unit,[0,0,0.6],"Head"];
};
}foreach units _group;
}foreach units _groupInitial;
deleteGroup _groupInitial;
[ _group,_pos,_difficulty,"STEALTH" ] call DMS_fnc_SetGroupBehavior;

View File

@ -1,6 +1,37 @@
_logDetail = format ["[OCCUPATION:Unstick]:: Initialised at %1",time];
[_logDetail] call SC_fnc_log;
SC_liveVehiclesArray = [];
SC_liveHelisArray = [];
SC_liveBoatsArray = [];
{
_vehicle = _x;
_vehLocation = _x getVariable "SC_vehicleSpawnLocation";
_transport = _x getVariable "SC_transport";
if(!isNil "_vehLocation") then
{
if(_vehicle isKindOf "LandVehicle") then
{
SC_liveVehiclesArray pushBack _vehicle;
SC_liveVehicles = count(SC_liveVehiclesArray);
};
if(_vehicle isKindOf "Air" && isNil "_transport") then
{
SC_liveHelisArray pushBack _vehicle;
SC_liveHelis = count(SC_liveHelisArray);
};
if(_vehicle isKindOf "Ship") then
{
SC_liveBoatsArray pushBack _vehicle;
SC_liveBoatss = count(SC_liveBoatsArray);
};
};
}forEach vehicles;
SC_liveHelis = count(SC_liveHelisArray);
{
if(isNull _x) exitWith { SC_liveHelisArray = SC_liveHelisArray - [_x]; };
@ -10,6 +41,7 @@ SC_liveHelis = count(SC_liveHelisArray);
sleep 2;
_tempLocation = _x getVariable "SC_vehicleSpawnLocation";
_originalSpawnLocation = _tempLocation select 0;
diag_log format ["[occupationMonitor] _tempLocation: %1 _originalSpawnLocation: %2",_tempLocation,_originalSpawnLocation];
_radius = _tempLocation select 1;
_pos = position _x;

View File

@ -110,7 +110,9 @@ for "_i" from 1 to _vehiclesToSpawn do
_vehicle setPosASL _spawnLocation;
_vehicle setVariable["vehPos",_spawnLocation,true];
_vehicle setVariable["vehClass",_VehicleClassToUse,true];
_vehicle setVariable ["SC_vehicleSpawnLocation", [_spawnLocation,_radius,worldName],true];
_SC_vehicleSpawnLocation = [_spawnLocation,_radius,worldName];
_vehicle setVariable ["SC_vehicleSpawnLocation", _SC_vehicleSpawnLocation,true];
// Remove the overpowered weapons from boats
_vehicle removeWeaponTurret ["HMG_01",[0]];

View File

@ -27,6 +27,8 @@ if(_aiActive > _maxAIcount) exitWith
[_logDetail] call SC_fnc_log;
};
SC_liveHelis = count(SC_liveHelisArray);
if(SC_liveHelis >= SC_maxNumberofHelis) exitWith
{
if(SC_extendedLogging) then
@ -138,7 +140,9 @@ for "_i" from 1 to _vehiclesToSpawn do
_group addVehicle _vehicle;
_vehicle setVariable["vehPos",_spawnLocation,true];
_vehicle setVariable["vehClass",_VehicleClassToUse,true];
_vehicle setVariable ["SC_vehicleSpawnLocation", [_spawnLocation,_radius,worldName],true];
_SC_vehicleSpawnLocation = [_spawnLocation,_radius,worldName];
diag_log format ["[occupationSky] _SC_vehicleSpawnLocation: %1",_SC_vehicleSpawnLocation];
_vehicle setVariable ["SC_vehicleSpawnLocation", _SC_vehicleSpawnLocation,true];
SC_liveHelis = SC_liveHelis + 1;
SC_liveHelisArray = SC_liveHelisArray + [_vehicle];

View File

@ -28,6 +28,8 @@ if((_aiActive > _maxAIcount) && !SC_occupyVehicleIgnoreCount) exitWith
[_logDetail] call SC_fnc_log;
};
SC_liveVehicles = count(SC_liveVehiclesArray);
if(SC_liveVehicles >= SC_maxNumberofVehicles) exitWith
{
_logDetail = format['[OCCUPATION:Vehicle] End check %1 currently active (max %2) @ %3',SC_liveVehicles,SC_maxNumberofVehicles,time];
@ -143,13 +145,13 @@ if(_vehiclesToSpawn > 0) then
{
_group addVehicle _vehicle;
SC_liveVehicles = SC_liveVehicles + 1;
SC_liveVehiclesArray = SC_liveVehiclesArray + [_vehicle];
_vehicle setVariable ["SC_repairStatus",false,true];
_vehicle setVariable ["vehPos",_spawnLocation,true];
_vehicle setVariable ["SC_repairStatus",false];
_vehicle setVariable ["vehClass",_VehicleClassToUse,true];
_vehicle setVariable ["SC_vehicleSpawnLocation", [_spawnLocation,_radius,worldName],true];
_SC_vehicleSpawnLocation = [_spawnLocation,_radius,worldName];
_vehicle setVariable ["SC_vehicleSpawnLocation", _SC_vehicleSpawnLocation,true];
_vehicle setFuel 1;
_vehicle engineOn true;
@ -257,6 +259,10 @@ if(_vehiclesToSpawn > 0) then
_unit = _x;
_unit enableAI "FSM";
_unit enableAI "MOVE";
_unit enableAI "TARGET";
_unit enableAI "AUTOTARGET";
_unit enableAI "AUTOCOMBAT";
_unit allowCrewInImmobile false;
reload _unit;
_unitName = [_side] call SC_fnc_selectName;
if(!isNil "_unitName") then { _unit setName _unitName; };
@ -267,7 +273,7 @@ if(_vehiclesToSpawn > 0) then
sleep 10;
[_group, _spawnLocation, 2000] call bis_fnc_taskPatrol;
_group setBehaviour "SAFE";
_group setBehaviour "AWARE";
_group setCombatMode "RED";
sleep 0.2;
@ -309,6 +315,6 @@ if(_vehiclesToSpawn > 0) then
};
};
};
SC_liveVehicles = count(SC_liveVehiclesArray);
_logDetail = format['[OCCUPATION:Vehicle] End check %1 currently active (max %2) @ %3',SC_liveVehicles,SC_maxNumberofVehicles,time];
[_logDetail] call SC_fnc_log;