V43 Tweaks

This commit is contained in:
second_coming 2016-05-26 23:11:11 +01:00
parent b99741e917
commit 81b78aeae6
16 changed files with 207 additions and 38 deletions

View File

@ -1,4 +1,15 @@
=================================================================================
V43 (26-05-2016)
=================================================================================
Added the option to specify multiple class names to potentially be used for the
public transport option. Tweaked Icon for Occupation Airlines
Added an option (SC_numberofHeliCrashesFire) in the config that allows you to turn
off the fire at heli crashes
AI units should attempt to take ammo from dead players/dead AI and loot spawns if
they run out of ammo and there is suitable ammo available
=================================================================================
V42 (22-05-2016)
=================================================================================
Forced reload after spawning AI to make sure they are ready to fire when they spot
@ -74,4 +85,4 @@ Added the option to set the maximum crew (crew count will be a random number bet
the max and min). The applies for all AI vehicles.
Added a separate SC_VehicleClassToUseRare list of vehicles which spawn 10% of the
time in place of the standard SC_VehicleClassToUse list.
time in place of the standard SC_VehicleClassToUse list.

View File

@ -4,7 +4,7 @@ class CfgPatches
units[] = {};
weapons[] = {};
requiredVersion = 0.1;
a3_exile_occupation_version = "v42 (22-05-2016)";
a3_exile_occupation_version = "v43 (26-05-2016)";
requiredAddons[] = {"a3_dms"};
author[]= {"second_coming"};
};

View File

@ -31,15 +31,27 @@ SC_fastNightsMultiplierDay = 4; // the time multiplier to us
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)
// Distance limits for selecting safe places to spawn AI
SC_minDistanceToSpawnZones = 500; // Minimum distance in metres to the nearest spawn zone
SC_minDistanceToTraders = 500; // Minimum distance in metres to the nearest trader zone
SC_minDistanceToTerritory = 500; // Minimum distance in metres to the nearest player territory
SC_minDistanceToPlayer = 250; // Minimum distance in metres to the nearest player
SC_occupyRandomSpawn = false; // (WORK IN PROGRESS, NOT WORKING YET) true if you want random spawning AI that hunt for nearby players
SC_randomSpawnMinPlayers = 1; // Minimum number of players to be online before random spawning AI can spawn
SC_randomSpawnMaxAI = 5; // Maximum amount of random AI groups allowed at any time
SC_randomSpawnIgnoreCount = true; // true if you want spawn random AI groups regardless of overall AI count (they still count towards the total though)
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_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_occupyTraders = false; // (WORK IN PROGRESS, NOT WORKING YET) true if you want to create trader camps at positions specified in SC_occupyTraderDetails
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],"trader1.sqf",true],
["Test Trader2",[10666,10262,0],"trader1.sqf",true]
@ -127,7 +139,7 @@ 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_occupyTransport = true; // true if you want pubic transport (travels between traders)
SC_occupyTransportClass = "Exile_Chopper_Mohawk_FIA";
SC_occupyTransportClass = ["Exile_Car_LandRover_Urban","Exile_Chopper_Mohawk_FIA"]; // to always use the same vehicle, specify one option only
SC_occupyTransportStartPos = []; // if empty defaults to map centre
@ -173,6 +185,7 @@ SC_blackListedAreas = [
SC_occupyHeliCrashes = true; // true if you want to have Dayz style helicrashes
SC_numberofHeliCrashesFire = true; // true if you want the crash on fire, false if you just want smoke
SC_numberofHeliCrashes = 5; // if SC_occupyHeliCrashes = true spawn this many loot crates (overrided below for Namalsk)
// Array of possible common items to go in heli crash crates ["classname",fixed amount,random amount] NOT INCLUDING WEAPONS

View File

@ -55,6 +55,7 @@ SC_occupationVersion = getText (configFile >> "CfgPatches" >> "a3_exile_occupati
SC_fnc_staticUnitMPKilled = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\eventHandlers\staticUnitMPKilled.sqf";
SC_fnc_unitMPHit = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\eventHandlers\unitMPHit.sqf";
SC_fnc_unitMPKilled = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\eventHandlers\unitMPKilled.sqf";
SC_fnc_unitFired = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\eventHandlers\unitFired.sqf";
SC_fnc_addMarker = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\functions\fnc_addMarker.sqf";
SC_fnc_findsafePos = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\functions\fnc_findsafePos.sqf";

View File

@ -0,0 +1,45 @@
// Get the variables from the event handler
_unit = _this select 0;
_weapon = _this select 1;
_ammoType = _this select 4;
_count = _unit ammo _weapon;
if(_count < 1) then
{
_logDetail = format ["[OCCUPATION:unitFired]:: unit: %1 out of ammo for weapon %2",_unit,_weapon];
[_logDetail] call SC_fnc_log;
_weaponHolder = nearestObjects [_unit, ["WeaponHolder"], 75];
_weapons = weapons _unit;
_magazinesCompatible = [];
{
_weaponCurrent = _x;
_magazinesCompatible = _magazinesCompatible + getArray (configFile >> "CfgWeapons" >> _weaponCurrent >> "magazines");
}forEach _weapons;
_magazinesToAdd = [];
for "_i" from 0 to (count _weaponHolder)-1 do
{
_item = _weaponHolder select _i;
_content = getMagazineCargo _item;
{
_ammo = _x select 0;
if(_ammo in _magazinesCompatible) then
{
_magazinesToAdd = _magazinesToAdd + [_ammo];
};
}forEach _content;
_unit doMove (position _item);
{
_unit action ["TakeMagazine", _item, _x];
_logDetail = format ["[OCCUPATION:unitFired]:: unit: %1 took ammo %2",_unit,_x];
[_logDetail] call SC_fnc_log;
}forEach _magazinesToAdd;
};
};

View File

@ -4,6 +4,7 @@ _killer = _this select 1;
// remove all eventhandlers from the dead unit
_unit removeAllMPEventHandlers "mphit";
_unit removeAllEventHandlers "fired";
[_unit] join grpNull;
if(SC_debug) then

View File

@ -25,4 +25,6 @@ if((vehicle _unit != _unit) && SC_debug) then
_tag attachTo [_unit,[0,0,0.6],"Head"];
};
_unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"];
_unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"];
_unit addEventHandler ["Fired", "_this call SC_fnc_unitFired;"];
SC_fnc_unitFired

View File

@ -21,8 +21,8 @@ _validspot = true;
};
}forEach SC_blackListedAreas;
//Check if near player base
_nearBase = (nearestObjects [_position,["Exile_Construction_Flag_Static"],500]) select 0;
//Check if near player territory
_nearBase = (nearestObjects [_position,["Exile_Construction_Flag_Static"],SC_minDistanceToTerritory]) select 0;
if (!isNil "_nearBase") then { _validspot = false; };
// Don't spawn AI near traders and spawn zones
@ -48,7 +48,7 @@ if (!isNil "_nearBase") then { _validspot = false; };
forEach allMapMarkers;
// Don't spawn additional AI if there are players in range
if([_position, 250] call ExileClient_util_world_isAlivePlayerInRange) exitwith { _validspot = false; };
if([_position, SC_minDistanceToPlayer] call ExileClient_util_world_isAlivePlayerInRange) exitwith { _validspot = false; };
_validspot

View File

@ -34,7 +34,15 @@ for "_i" from 1 to SC_numberofHeliCrashes do
_helicopter = "Land_UWreck_MV22_F";
_vehHeli = _helicopter createVehicle [0,0,0];
_heliFire = "test_EmptyObjectForFireBig" createVehicle (position _vehHeli);
_effect = "test_EmptyObjectForSmoke";
if(SC_numberofHeliCrashesFire) then
{
_effect = "test_EmptyObjectForFireBig";
};
_heliFire = _effect createVehicle (position _vehHeli);
_heliFire attachto [_vehHeli, [0,0,-1]];
_vehHeli setPos _position;

View File

@ -2,7 +2,7 @@ if (!isServer) exitWith {};
private["_wp","_wp2","_wp3"];
_logDetail = format ["[OCCUPATION]:: Starting Occupation Monitor @ %1",time];
_logDetail = format ["[OCCUPATION:Places]:: Starting Occupation Monitor @ %1",time];
[_logDetail] call SC_fnc_log;
_middle = worldSize/2;
@ -139,7 +139,8 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
deleteGroup _group;
_group = createGroup SC_SurvivorSide;
};
_group setVariable ["DMS_AllowFreezing",false];
DMS_ai_use_launchers = false;
for "_i" from 1 to _aiCount do
{
@ -166,7 +167,9 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
[_side,_unit] call SC_fnc_addMarker;
reload _unit;
}foreach units _group;
_group setVariable ["DMS_AllowFreezing",true];
// Get the AI to shut the fuck up :)
enableSentences false;
enableRadio false;
@ -227,6 +230,7 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
_group2 = createGroup SC_SurvivorSide;
};
_group2 setVariable ["DMS_AllowFreezing",false];
DMS_ai_use_launchers = false;
for "_i" from 1 to 5 do
@ -258,6 +262,8 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi
reload _unit;
}foreach units _group2;
_group2 setVariable ["DMS_AllowFreezing",true];
[_group2, _pos, _groupRadius] call bis_fnc_taskPatrol;
_group2 setBehaviour "AWARE";
_group2 setCombatMode "RED";

View File

@ -0,0 +1,61 @@
if (!isServer) exitWith {};
private["_wp","_wp2","_wp3"];
_logDetail = format ["[OCCUPATION:RandomSpawn]:: Starting Occupation Monitor @ %1",time];
[_logDetail] call SC_fnc_log;
_middle = worldSize/2;
_spawnCenter = [_middle,_middle,0]; // Centre point for the map
_maxDistance = _middle; // Max radius for the map
_maxAIcount = SC_maxAIcount;
_minFPS = SC_minFPS;
_useLaunchers = DMS_ai_use_launchers;
_scaleAI = SC_scaleAI;
_side = "bandit";
// more than _scaleAI players on the server and the max AI count drops per additional player
_currentPlayerCount = count playableUnits;
if(_currentPlayerCount < SC_randomSPawnMinPlayers) exitWith
{
if(SC_extendedLogging) then
{
_logDetail = format ["[OCCUPATION:RandomSpawn]:: Held off spawning random AI, not enough players online"];
[_logDetail] call SC_fnc_log;
};
};
if(_currentPlayerCount > _scaleAI) then
{
_maxAIcount = _maxAIcount - (_currentPlayerCount - _scaleAI) ;
};
// Don't spawn additional AI if the server fps is below _minFPS
if(diag_fps < _minFPS) exitWith
{
if(SC_extendedLogging) then
{
_logDetail = format ["[OCCUPATION:RandomSpawn]:: Held off spawning more AI as the server FPS is only %1",diag_fps];
[_logDetail] call SC_fnc_log;
};
};
_aiActive = { !isPlayer _x } count allunits;
if(_aiActive > _maxAIcount) exitWith
{
if(SC_extendedLogging) then
{
_logDetail = format ["[OCCUPATION:RandomSpawn]:: %1 active AI, so not spawning AI this time",_aiActive];
[_logDetail] call SC_fnc_log;
};
};
SC_suitablePlayers = [];
// Find a player to spawn AI near
{
_suitablePlayer = true;
}forEach playableUnits;

View File

@ -47,7 +47,7 @@ for "_i" from 1 to _vehiclesToSpawn do
_spawnLocation = [_potentialspawnLocation select 0, _potentialspawnLocation select 1,0];
_group = createGroup SC_BanditSide;
_group setVariable ["DMS_AllowFreezing",false,true];
_VehicleClass = SC_BoatClassToUse call BIS_fnc_selectRandom;
_VehicleClassToUse = _VehicleClass select 0;
@ -114,7 +114,6 @@ for "_i" from 1 to _vehiclesToSpawn do
_unit assignAsDriver _vehicle;
_unit moveInDriver _vehicle;
_unit setVariable ["DMS_AssignedVeh",_vehicle];
_unit setVariable ["DMS_AllowFreezing",false,true];
_unitPlaced = true;
};
if(_vehicleRole == "Turret") then

View File

@ -70,6 +70,7 @@ for "_i" from 1 to _vehiclesToSpawn do
_spawnLocation = [_safePos select 0, _safePos select 1, _height];
_group = createGroup SC_BanditSide;
_group setVariable ["DMS_AllowFreezing",false,true];
_VehicleClass = SC_HeliClassToUse call BIS_fnc_selectRandom;
_VehicleClassToUse = _VehicleClass select 0;
@ -132,7 +133,6 @@ for "_i" from 1 to _vehiclesToSpawn do
_unit moveInDriver _vehicle;
//_vehicle lockDriver true;
_unit setVariable ["DMS_AssignedVeh",_vehicle];
_unit setVariable ["DMS_AllowFreezing",false,true];
removeBackpackGlobal _unit;
_unit addBackpackGlobal "B_Parachute";
_unitPlaced = true;

View File

@ -5,41 +5,43 @@ _logDetail = format ["[OCCUPATION:transport]:: Starting @ %1",time];
private["_spawnLocation","_transport","_transportSpeed","_transportType","_wp","_transportBehaviour","_transportWaitingTime","_transportGunner"];
if( count SC_occupytransportStartPos == 0) then
if( count SC_occupyTransportStartPos == 0) then
{
_middle = worldSize/2;
_spawnCenter = [_middle,_middle,0];
SC_occupytransportStartPos = _spawnCenter;
SC_occupyTransportStartPos = _spawnCenter;
};
_transportVehicle = [SC_occupyTransportClass] call BIS_fnc_selectRandom;
SC_occupyTransportClassToUse = _transportVehicle select 0;
if!(SC_occupytransportClass isKindOf "LandVehicle" OR SC_occupytransportClass isKindOf "Air") exitWith
if!(SC_occupyTransportClassToUse isKindOf "LandVehicle" OR SC_occupyTransportClassToUse isKindOf "Air") exitWith
{
_logDetail = format ["[OCCUPATION:transport]:: Only land vehicles or helicopters can be used as public transport"];
[_logDetail] call SC_fnc_log;
};
if(SC_occupytransportClass isKindOf "LandVehicle") then
if(SC_occupyTransportClassToUse isKindOf "LandVehicle") then
{
_transportType = "land";
_logDetail = format ["[OCCUPATION:transport]:: Spawning near map centre %1 @ %2",SC_occupytransportStartPos,time];
_logDetail = format ["[OCCUPATION:transport]:: Spawning near map centre %1 @ %2",SC_occupyTransportStartPos,time];
[_logDetail] call SC_fnc_log;
_positionOftransport = [SC_occupytransportStartPos,0,500,25,0,10,0] call BIS_fnc_findSafePos;
_positionOftransport = [SC_occupyTransportStartPos,0,500,25,0,10,0] call BIS_fnc_findSafePos;
// Get position of nearest roads
_nearRoads = _positionOftransport nearRoads 2000;
_nearestRoad = _nearRoads select 0;
_nearestRoadPos = position (_nearRoads select 0);
_spawnLocation = [_nearestRoadPos select 0, _nearestRoadPos select 1, 0];
_transportSpeed = "NORMAL";
_transportSpeed = "LIMITED";
_transportBehaviour = "CARELESS";
_transportWaitingTime = 10;
}
else
{
_transportType = "heli";
_spawnLocation = [SC_occupytransportStartPos select 0, SC_occupytransportStartPos select 1, 200];
_spawnLocation = [SC_occupyTransportStartPos select 0, SC_occupyTransportStartPos select 1, 200];
_transportSpeed = "NORMAL";
_transportBehaviour = "CARELESS";
_transportWaitingTime = 60;
@ -55,7 +57,7 @@ _group setCombatMode "BLUE";
if(_transportType == "heli") then
{
_transport = createVehicle [SC_occupytransportClass, _spawnLocation, [], 0, "NONE"];
_transport = createVehicle [SC_occupyTransportClassToUse, _spawnLocation, [], 0, "NONE"];
_transport setVehiclePosition [_spawnLocation, [], 0, "FLY"];
_transport setVariable ["vehicleID", _spawnLocation, true];
_transport setFuel 1;
@ -65,25 +67,34 @@ if(_transportType == "heli") then
}
else
{
_transport = createVehicle [SC_occupytransportClass, _spawnLocation, [], 0, "CAN_COLLIDE"];
_transport = createVehicle [SC_occupyTransportClassToUse, _spawnLocation, [], 0, "CAN_COLLIDE"];
};
sleep 0.2;
if(isNull _transport) exitWith
{
_logDetail = format ["[OCCUPATION:transport]:: %1 failed to spawn, check it is a valid vehicle class name",SC_occupytransportClass];
_logDetail = format ["[OCCUPATION:transport]:: %1 failed to spawn, check it is a valid vehicle class name",SC_occupyTransportClassToUse];
[_logDetail] call SC_fnc_log;
};
_transport addEventHandler ["handleDamage", { false }];
_transport allowdamage false;
_transport setObjectTextureGlobal[0,"#(argb,8,8,3)color(0.518,0.519,0.7,0.2)"];
_transport setObjectTextureGlobal [1,"#(argb,8,8,3)color(0.518,0.519,0.7,0.2)"];
_transport setObjectTextureGlobal [2,"#(argb,8,8,3)color(0.518,0.519,0.7,0.2)"];
if( _transportType == "land") then
{
//_transport setObjectTextureGlobal [0,"#(argb,8,8,3)color(0.518,0.519,0.7,0.2)"];
}
else
{
_transport setObjectTextureGlobal [0,"#(argb,8,8,3)color(0.518,0.519,0.7,0.2)"];
_transport setObjectTextureGlobal [1,"#(argb,8,8,3)color(0.518,0.519,0.7,0.2)"];
_transport setObjectTextureGlobal [2,"#(argb,8,8,3)color(0.518,0.519,0.7,0.2)"];
};
_group addVehicle _transport;
_group addVehicle _transport;
_group setVariable ["DMS_AllowFreezing",false,true];
_transport enableCopilot false;
_transportDriver = _group createUnit [DMS_AI_Classname, _spawnLocation, [], 0,"FORM"];
@ -109,7 +120,6 @@ _transport setVariable ["SC_assignedDriver", _transportDriver,true];
_transport setVariable ["SC_transport", true,true];
_transport setVariable ["SC_vehicleSpawnLocation", _spawnLocation,true];
_transportDriver setVariable ["DMS_AssignedVeh",_transport];
_transportDriver setVariable ["DMS_AllowFreezing",false,true];
_transport addEventHandler ["getin", "_this call SC_fnc_getOnBus;"];
_transport addEventHandler ["getout", "_this call SC_fnc_getOffBus;"];
@ -121,7 +131,7 @@ _transport setVariable ["ExileIsPersistent", false];
_transport setVariable["vehPos",_spawnLocation,true];
_transport setFuel 1;
_logDetail = format['[OCCUPATION:transport] Vehicle %1 spawned @ %2',SC_occupytransportClass,_spawnLocation];
_logDetail = format['[OCCUPATION:transport] Vehicle %1 spawned @ %2',SC_occupyTransportClassToUse,_spawnLocation];
[_logDetail] call SC_fnc_log;
_markerCount = 0;
@ -154,6 +164,11 @@ if(_markerCount == 0) exitWith
_logDetail = format ["[OCCUPATION:transport]:: Found %1 markers to use as pickup points @ %2",_markerCount,time];
[_logDetail] call SC_fnc_log;
_textures = getObjectTextures _transport;
_logDetail = format ["[OCCUPATION:transport]:: textures for vehicle are: %1",_textures];
[_logDetail] call SC_fnc_log;
// Add a final CYCLE
_wp = _group addWaypoint [_spawnLocation, 20];
_wp setWaypointType "CYCLE";
@ -172,8 +187,9 @@ if(_transportType == "land") then
}
else
{
"transportLocation" setMarkerType "hd_join";
"transportLocation" setMarkerText "Occupation Airlines";
"transportLocation" setMarkerType "c_air";
"transportLocation" setMarkerText "Occupation Airlines";
"transportLocation" setMarkerColor "ColorBLUFOR";
};

View File

@ -87,7 +87,7 @@ if(_vehiclesToSpawn >= 1) then
deleteGroup _group;
_group = createGroup SC_SurvivorSide;
};
_group setVariable ["DMS_AllowFreezing",false,true];
_group setVariable ["DMS_LockLocality",nil];
_group setVariable ["DMS_SpawnedGroup",true];
_group setVariable ["DMS_Group_Side", _side];
@ -201,7 +201,6 @@ if(_vehiclesToSpawn >= 1) then
_unit assignAsDriver _vehicle;
_unit moveInDriver _vehicle;
_unit setVariable ["DMS_AssignedVeh",_vehicle];
_unit setVariable ["DMS_AllowFreezing",false,true];
_unit setVariable ["SC_drivenVehicle", _vehicle,true];
_unit addMPEventHandler ["mpkilled", "_this call SC_fnc_driverKilled;"];
_vehicle setVariable ["SC_assignedDriver", _unit,true];

View File

@ -18,6 +18,13 @@ if (SC_fastNights) then
[60, fnc_checkMultiplier, [], true] call ExileServer_system_thread_addTask;
};
if(SC_occupyRandomSpawn) then
{
uiSleep 15; // delay the start
call compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationRandomSpawn.sqf";
};
if(SC_occupyTraders) then
{
uiSleep 15; // delay the start