From 40221e8737ff26fd0b424b543c40e08e275f7678 Mon Sep 17 00:00:00 2001 From: second_coming Date: Tue, 31 May 2016 16:22:42 +0100 Subject: [PATCH] V44 Fixes and Tweaks --- changeLog.txt | 11 +++ config.cpp | 2 +- config.sqf | 102 +++++++++++++------------ initServer.sqf | 1 + scripts/deleteMapMarkers.sqf | 35 +++++---- scripts/eventHandlers/driverKilled.sqf | 8 +- scripts/eventHandlers/getOffBus.sqf | 3 + scripts/eventHandlers/getOnBus.sqf | 5 +- scripts/eventHandlers/unitFired.sqf | 15 ++-- scripts/extras/processReporter.sqf | 21 +++++ scripts/functions/fnc_addMarker.sqf | 2 +- scripts/functions/fnc_spawnStatics.sqf | 2 +- scripts/occupationLog.sqf | 9 ++- scripts/occupationLootCrates.sqf | 24 +++++- scripts/occupationMilitary.sqf | 4 +- scripts/occupationPlaces.sqf | 12 +-- scripts/occupationSea.sqf | 14 ++-- scripts/occupationSky.sqf | 4 + scripts/occupationTransport.sqf | 13 +++- scripts/occupationVehicle.sqf | 19 ++--- scripts/startOccupation.sqf | 23 ++++-- 21 files changed, 208 insertions(+), 121 deletions(-) create mode 100644 scripts/extras/processReporter.sqf diff --git a/changeLog.txt b/changeLog.txt index afabaf4..2527e8b 100644 --- a/changeLog.txt +++ b/changeLog.txt @@ -1,3 +1,14 @@ +================================================================================= +V44 (31-05-2016) +================================================================================= +Fixed error when real names were disabled + +Added a process reporter module which logs server processes every 60 seconds to +the rpt or dedicated log file if using infiSTAR logging (useful for diagnosing +poor server performance) + +Fixed map marker removal (including line drawing) + ================================================================================= V43 (26-05-2016) ================================================================================= diff --git a/config.cpp b/config.cpp index 77dd29e..aef2758 100644 --- a/config.cpp +++ b/config.cpp @@ -4,7 +4,7 @@ class CfgPatches units[] = {}; weapons[] = {}; requiredVersion = 0.1; - a3_exile_occupation_version = "v43 (26-05-2016)"; + a3_exile_occupation_version = "v44 (31-05-2016)"; requiredAddons[] = {"a3_dms"}; author[]= {"second_coming"}; }; diff --git a/config.sqf b/config.sqf index 4c94d09..5be1c81 100644 --- a/config.sqf +++ b/config.sqf @@ -1,11 +1,12 @@ //////////////////////////////////////////////////////////////////////// // -// Server Occupation script by second_coming -// +// Exile Occupation by second_coming // http://www.exilemod.com/profile/60-second_coming/ // -// This script uses the fantastic DMS by Defent and eraser1 +// For support, visit: +// http://www.exilemod.com/topic/12517-release-exile-occupation-roaming-ai-more/ // +// This script uses the fantastic DMS by Defent and eraser1: // http://www.exilemod.com/topic/61-dms-defents-mission-system/ // //////////////////////////////////////////////////////////////////////// @@ -15,7 +16,8 @@ SC_debug = false; // set to true to turn on debug features (not for live servers) SC_extendedLogging = false; // set to true for additional logging -SC_infiSTAR_log = true; // true Use infiSTAR logging, false logs to server rpt +SC_processReporter = true; // log the a list of active server processes every 60 seconds (useful for debugging server problems) +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 SC_minFPS = 5; // any lower than minFPS on the server and additional AI won't spawn @@ -45,16 +47,14 @@ SC_randomSpawnIgnoreCount = true; // true if you want spawn random AI groups SC_occupyPlaces = true; // true if you want villages,towns,cities patrolled by bandits - - 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_occupyTraderDetails = [ - ["Test Trader1",[23718,16223,0],"trader1.sqf",true], - ["Test Trader2",[10666,10262,0],"trader1.sqf",true] + ["Bubendorf Traders",[3896,14467,0],"trader1.sqf",true], + ["Schrattendamm Traders",[10584,4975,0],"trader1.sqf",true] ]; //["Name",[x,y,z],"filename",true] trader name, location, safezone true/false SC_SurvivorsChance = 20; // chance in % to spawn survivors instead of bandits (for places and land vehicles) @@ -89,43 +89,7 @@ SC_BanditPistol = ["hgun_ACPC2_F","hgun_P07_F","hgun_Pistol_heavy_01 SC_BanditPistolAttachments = []; SC_BanditAssignedItems = ["ItemMap","ItemCompass","ItemRadio","ItemWatch"]; // all these items will be added SC_BanditLauncher = []; -SC_BanditBackpack = ["B_HuntingBackpack","B_Kitbag_cbr","B_Kitbag_mcamo","B_Kitbag_sgg","B_OutdoorPack_blk","B_OutdoorPack_blu","B_OutdoorPack_tan","B_TacticalPack_blk","B_TacticalPack_mcamo","B_TacticalPack_ocamo","B_TacticalPack_oli","B_TacticalPack_rgr"]; - - - -SC_occupyMilitary = false; // true if you want military buildings patrolled - -// Array of buildings to add military patrols to -SC_buildings = [ "Land_TentHangar_V1_F","Land_Hangar_F", - "Land_Airport_Tower_F","Land_Cargo_House_V1_F", - "Land_Cargo_House_V3_F","Land_Cargo_HQ_V1_F", - "Land_Cargo_HQ_V2_F","Land_Cargo_HQ_V3_F", - "Land_u_Barracks_V2_F","Land_i_Barracks_V2_F", - "Land_i_Barracks_V1_F","Land_Cargo_Patrol_V1_F", - "Land_Cargo_Patrol_V2_F","Land_Cargo_Tower_V1_F", - "Land_Cargo_Tower_V1_No1_F","Land_Cargo_Tower_V1_No2_F", - "Land_Cargo_Tower_V1_No3_F","Land_Cargo_Tower_V1_No4_F", - "Land_Cargo_Tower_V1_No5_F","Land_Cargo_Tower_V1_No6_F", - "Land_Cargo_Tower_V1_No7_F","Land_Cargo_Tower_V2_F", - "Land_Cargo_Tower_V3_F","Land_MilOffices_V1_F", - "Land_Radar_F","Land_budova4_winter","land_hlaska", - "Land_Vysilac_FM","land_st_vez","Land_ns_Jbad_Mil_Barracks", - "Land_ns_Jbad_Mil_ControlTower","Land_ns_Jbad_Mil_House", - "land_pozorovatelna","Land_vys_budova_p1", - "Land_Vez","Land_Mil_Barracks_i", - "Land_Mil_Barracks_L","Land_Mil_Barracks", - "Land_Hlidac_budka","Land_Ss_hangar", - "Land_Mil_ControlTower","Land_a_stationhouse", - "Land_Farm_WTower","Land_Mil_Guardhouse", - "Land_A_statue01","Land_A_Castle_Gate", - "Land_A_Castle_Donjon","Land_A_Castle_Wall2_30", - "Land_A_Castle_Stairs_A", - "Land_i_Barracks_V1_dam_F","Land_Cargo_Patrol_V3_F", - "Land_Radar_Small_F","Land_Dome_Big_F", - "Land_Dome_Small_F","Land_Army_hut3_long_int", - "Land_Army_hut_int","Land_Army_hut2_int" - ]; - +SC_BanditBackpack = ["B_HuntingBackpack","B_Kitbag_cbr","B_Kitbag_mcamo","B_Kitbag_sgg","B_OutdoorPack_blk","B_OutdoorPack_blu","B_OutdoorPack_tan","B_TacticalPack_blk","B_TacticalPack_mcamo","B_TacticalPack_ocamo","B_TacticalPack_oli","B_TacticalPack_rgr"]; SC_occupyStatic = false; // true if you want to add AI in specific locations SC_staticBandits = [ //[[pos],ai count,radius,search buildings] @@ -139,13 +103,17 @@ 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_Car_LandRover_Urban","Exile_Chopper_Mohawk_FIA"]; // to always use the same vehicle, specify one option only +SC_occupyTransportClass = ["Exile_Car_LandRover_Urban","Exile_Chopper_Mohawk_FIA","Exile_Chopper_Mohawk_FIA"]; // to always use the same vehicle, specify one option only SC_occupyTransportStartPos = []; // if empty defaults to map centre +SC_occupyTransportAnnounce = true; // true if you want the pilot/driver to talk to passengers in vehicle chat, false if not +SC_occupyTransportGetIn = ["Hello and welcome to Occupation Transport. We hope you enjoy the ride!"]; +SC_occupyTransportGetOut = ["Thanks for using Occupation Transport. We hope to see you again!"]; +SC_occupyTransportMessages = ["You guys should totally visit our website","No mooning out of the window please!","Scream if you want to go faster!","frrt"]; 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) -SC_LootCrateGuards = 4; // number of AI to spawn at each crate +SC_numberofLootCrates = 2; // if SC_occupyLootCrates = true spawn this many loot crates (overrided below for Namalsk) +SC_LootCrateGuards = 7; // number of AI to spawn at each crate SC_LootCrateGuardsRandomize = true; // Use a random number of guards up to a maximum = SC_numberofGuards (so between 1 and SC_numberofGuards) SC_occupyLootCratesMarkers = true; // true if you want to have markers on the loot crate spawns @@ -180,7 +148,8 @@ SC_LootCrateItems = [ SC_blackListedAreas = [ [[3810,8887,0],500,"Chernarus"], // Vybor Occupation DMS Static Mission [[12571,14337,0],500,"Altis"], // Neochori Occupation DMS Static Mission - [[3926,7523,0],500,"Namalsk"] // Norinsk Occupation DMS Static Mission + [[3926,7523,0],500,"Namalsk"], // Norinsk Occupation DMS Static Mission + [[3926,7523,0],500,"Napf"] // Lenzburg Occupation DMS Static Mission ]; @@ -259,6 +228,40 @@ SC_SurvivorLastNames = ["Smith","Jones","Davids","Johnson","Jobs","Andrews"," SC_BanditFirstNames = ["Alex","Nikita","George","Daniel","Adam","Alexander","Sasha","Sergey","Dmitry","Anton","Jakub","Vlad","Maxim","Oleg","Denis","Wojtek"]; SC_BanditLastNames = ["Dimitrov","Petrov","Horvat","Novak","Dvorak","Vesely","Horak","Hansen","Larsen","Tamm","Ivanov","Pavlov","Virtanen"]; + +SC_occupyMilitary = false; // true if you want military buildings patrolled + +// Array of buildings to add military patrols to +SC_buildings = [ "Land_TentHangar_V1_F","Land_Hangar_F", + "Land_Airport_Tower_F","Land_Cargo_House_V1_F", + "Land_Cargo_House_V3_F","Land_Cargo_HQ_V1_F", + "Land_Cargo_HQ_V2_F","Land_Cargo_HQ_V3_F", + "Land_u_Barracks_V2_F","Land_i_Barracks_V2_F", + "Land_i_Barracks_V1_F","Land_Cargo_Patrol_V1_F", + "Land_Cargo_Patrol_V2_F","Land_Cargo_Tower_V1_F", + "Land_Cargo_Tower_V1_No1_F","Land_Cargo_Tower_V1_No2_F", + "Land_Cargo_Tower_V1_No3_F","Land_Cargo_Tower_V1_No4_F", + "Land_Cargo_Tower_V1_No5_F","Land_Cargo_Tower_V1_No6_F", + "Land_Cargo_Tower_V1_No7_F","Land_Cargo_Tower_V2_F", + "Land_Cargo_Tower_V3_F","Land_MilOffices_V1_F", + "Land_Radar_F","Land_budova4_winter","land_hlaska", + "Land_Vysilac_FM","land_st_vez","Land_ns_Jbad_Mil_Barracks", + "Land_ns_Jbad_Mil_ControlTower","Land_ns_Jbad_Mil_House", + "land_pozorovatelna","Land_vys_budova_p1", + "Land_Vez","Land_Mil_Barracks_i", + "Land_Mil_Barracks_L","Land_Mil_Barracks", + "Land_Hlidac_budka","Land_Ss_hangar", + "Land_Mil_ControlTower","Land_a_stationhouse", + "Land_Farm_WTower","Land_Mil_Guardhouse", + "Land_A_statue01","Land_A_Castle_Gate", + "Land_A_Castle_Donjon","Land_A_Castle_Wall2_30", + "Land_A_Castle_Stairs_A", + "Land_i_Barracks_V1_dam_F","Land_Cargo_Patrol_V3_F", + "Land_Radar_Small_F","Land_Dome_Big_F", + "Land_Dome_Small_F","Land_Army_hut3_long_int", + "Land_Army_hut_int","Land_Army_hut2_int" + ]; + // namalsk specific settings (if you want to override settings for specific maps if you run multiple servers) if (worldName == 'Namalsk') then { @@ -274,6 +277,7 @@ if (worldName == 'Namalsk') then if (SC_debug) then { SC_extendedLogging = true; + SC_processReporter = true; SC_mapMarkers = true; SC_occupyPlaces = true; SC_occupyVehicle = true; diff --git a/initServer.sqf b/initServer.sqf index f68c32a..3d8d9a9 100644 --- a/initServer.sqf +++ b/initServer.sqf @@ -65,6 +65,7 @@ SC_occupationVersion = getText (configFile >> "CfgPatches" >> "a3_exile_occupati SC_fnc_spawnstatics = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\functions\fnc_spawnStatics.sqf"; SC_fnc_unstick = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\functions\fnc_unstick.sqf"; + _logDetail = "============================================================================================================="; [_logDetail] call SC_fnc_log; _logDetail = format ["[OCCUPATION MOD]:: Occupation %2 Initialised at %1",time,SC_occupationVersion]; diff --git a/scripts/deleteMapMarkers.sqf b/scripts/deleteMapMarkers.sqf index 0796a59..77377f1 100644 --- a/scripts/deleteMapMarkers.sqf +++ b/scripts/deleteMapMarkers.sqf @@ -1,23 +1,28 @@ -// Delete the map marker on a loot crate when a player gets in range -for "_i" from 1 to SC_numberofLootCrates do +if (SC_occupyLootCratesMarkers) then { - _markerName = format ["loot_marker_%1", _i]; - _pos = getMarkerPos _markerName; - - if(!isNil "_pos") then + // Delete the map marker on a loot crate when a player gets in range + + for "_i" from 1 to SC_numberofLootCrates do { + _markerName = format ["loot_marker_%1", _i]; + _pos = getMarkerPos _markerName; - if([_pos, 15] call ExileClient_util_world_isAlivePlayerInRange) then - { - deleteMarker _markerName; - _logDetail = format ["[OCCUPATION:LootCrates]:: marker %1 removed at %2",_markerName,time]; - [_logDetail] call SC_fnc_log; + if(!isNil "_pos") then + { + + if([_pos, 15] call ExileClient_util_world_isAlivePlayerInRange) then + { + deleteMarker _markerName; + _logDetail = format ["[OCCUPATION:LootCrates]:: marker %1 removed at %2",_markerName,time]; + [_logDetail] call SC_fnc_log; + }; + }; - - }; + }; }; + if(SC_removeUserMapMarkers) then { { @@ -25,5 +30,5 @@ if(SC_removeUserMapMarkers) then { deleteMarker _x; } - } forEach allMapMarkers; -}; + } forEach allMapMarkers; +}; \ No newline at end of file diff --git a/scripts/eventHandlers/driverKilled.sqf b/scripts/eventHandlers/driverKilled.sqf index a18b33f..9e2dca9 100644 --- a/scripts/eventHandlers/driverKilled.sqf +++ b/scripts/eventHandlers/driverKilled.sqf @@ -38,10 +38,10 @@ if(count units _group > 0) then if(_deadDriver == _driver) exitWith { [_vehicle] call SC_fnc_vehicleDestroyed; }; - _driver disableAI "TARGET"; - _driver disableAI "AUTOTARGET"; - _driver disableAI "AUTOCOMBAT"; - _driver disableAI "COVER"; + //_driver disableAI "TARGET"; + //_driver disableAI "AUTOTARGET"; + //_driver disableAI "AUTOCOMBAT"; + //_driver disableAI "COVER"; _driver assignAsDriver _vehicle; _driver setVariable ["DMS_AssignedVeh",_vehicle]; diff --git a/scripts/eventHandlers/getOffBus.sqf b/scripts/eventHandlers/getOffBus.sqf index 3fd782c..69ece21 100644 --- a/scripts/eventHandlers/getOffBus.sqf +++ b/scripts/eventHandlers/getOffBus.sqf @@ -3,6 +3,9 @@ _transport = _this select 0; _unit = _this select 2; +_driver = driver _transport; +_driver vehiclechat SC_occupyTransportGetOut; + if(_transport isKindOf "LandVehicle") then { _transport setFuel 0; diff --git a/scripts/eventHandlers/getOnBus.sqf b/scripts/eventHandlers/getOnBus.sqf index e4cc8e3..fd513c3 100644 --- a/scripts/eventHandlers/getOnBus.sqf +++ b/scripts/eventHandlers/getOnBus.sqf @@ -1,4 +1,7 @@ // Triggered if a player gets on the public transport _transport = _this select 0; -_unit = _this select 2; \ No newline at end of file +_unit = _this select 2; + +_driver = driver _transport; +_driver vehiclechat SC_occupyTransportGetIn; \ No newline at end of file diff --git a/scripts/eventHandlers/unitFired.sqf b/scripts/eventHandlers/unitFired.sqf index 044b880..cd06ac6 100644 --- a/scripts/eventHandlers/unitFired.sqf +++ b/scripts/eventHandlers/unitFired.sqf @@ -8,9 +8,7 @@ _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; - + diag_log format ["[OCCUPATION:unitFired]:: unit: %1 out of ammo for weapon %2",_unit,_weapon]; _weaponHolder = nearestObjects [_unit, ["WeaponHolder"], 75]; _weapons = weapons _unit; @@ -38,8 +36,15 @@ if(_count < 1) then _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; + diag_log format ["[OCCUPATION:unitFired]:: unit: %1 took ammo %2",_unit,_x]; }forEach _magazinesToAdd; + + { + diag_log format ["[processReporter] %1 @ %2",_x,time]; + } forEach diag_activeSQFScripts; + + { + diag_log format ["[processReporter] %1 @ %2",_x,time]; + } forEach diag_activeSQSScripts; }; }; diff --git a/scripts/extras/processReporter.sqf b/scripts/extras/processReporter.sqf new file mode 100644 index 0000000..0c0a632 --- /dev/null +++ b/scripts/extras/processReporter.sqf @@ -0,0 +1,21 @@ + +_logDetail = "======================================================================================================="; +[_logDetail,'A3_EXILE_PROCESSREPORTER'] call SC_fnc_log; + _logDetail = format['[processReporter] Started @ %4 : [FPS: %1|PLAYERS: %2|THREADS: %3]',diag_fps,count allplayers,count diag_activeSQFScripts,time]; +[_logDetail,'A3_EXILE_PROCESSREPORTER'] call SC_fnc_log; +_logDetail = "======================================================================================================="; +[_logDetail,'A3_EXILE_PROCESSREPORTER'] call SC_fnc_log; + +{ + _logDetail = format ["[processReporter] %1 @ %2",_x,time]; + [_logDetail,'A3_EXILE_PROCESSREPORTER'] call SC_fnc_log; +} forEach diag_activeSQFScripts; + +{ + _logDetail = format ["[processReporter] %1 @ %2",_x,time]; + [_logDetail,'A3_EXILE_PROCESSREPORTER'] call SC_fnc_log; +} forEach diag_activeSQSScripts; + + +_logDetail = format ["[processReporter] Ended @ %1",time]; +[_logDetail,'A3_EXILE_PROCESSREPORTER'] call SC_fnc_log; \ No newline at end of file diff --git a/scripts/functions/fnc_addMarker.sqf b/scripts/functions/fnc_addMarker.sqf index a55bf98..a0a2440 100644 --- a/scripts/functions/fnc_addMarker.sqf +++ b/scripts/functions/fnc_addMarker.sqf @@ -26,4 +26,4 @@ if((vehicle _unit != _unit) && SC_debug) then }; _unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"]; -//_unit addEventHandler ["Fired", "_this call SC_fnc_unitFired;"]; +//_unit addEventHandler ["Fired", "_this call SC_fnc_unitFired;"]; \ No newline at end of file diff --git a/scripts/functions/fnc_spawnStatics.sqf b/scripts/functions/fnc_spawnStatics.sqf index bd3cafd..bd63aeb 100644 --- a/scripts/functions/fnc_spawnStatics.sqf +++ b/scripts/functions/fnc_spawnStatics.sqf @@ -67,7 +67,7 @@ if(_side == "survivor") then { _currentSide = SC_SurvivorSide }; _loadOut = [_side] call SC_fnc_selectGear; _unit = [_initialGroup,_spawnPosition,"custom","random",_side,"soldier",_loadOut] call DMS_fnc_SpawnAISoldier; _unitName = [_side] call SC_fnc_selectName; - _unit setName _unitName; + if(!isNil "_unitName") then { _unit setName _unitName; }; _unit setVariable ["SC_staticUID",_staticUID]; _unit setVariable ["SC_staticSpawnPos",_spawnPosition]; _unit addMPEventHandler ["mpkilled", "_this call SC_fnc_staticUnitMPKilled;"]; diff --git a/scripts/occupationLog.sqf b/scripts/occupationLog.sqf index 5a85f3f..5a2c9a7 100644 --- a/scripts/occupationLog.sqf +++ b/scripts/occupationLog.sqf @@ -1,10 +1,13 @@ // Logging function to use either infiSTAR logging function or server RPT -_logDetail = format["%1 %2",SC_occupationVersion,_this select 0]; +_logDetail = format["%1 %2",SC_occupationVersion,_this select 0]; +_fileName = _this select 1; -if(SC_infiSTAR_log && !isNil "INFISTARVERSION") then +if(isNil "_fileName") then { _fileName = "A3_EXILE_OCCUPATION"; }; + +if(SC_infiSTAR_log && !(isNil "INFISTARVERSION")) then { - ['A3_EXILE_OCCUPATION',_logDetail] call FNC_A3_CUSTOMLOG; + [_fileName,_logDetail] call FNC_A3_CUSTOMLOG; } else { diff --git a/scripts/occupationLootCrates.sqf b/scripts/occupationLootCrates.sqf index ba339b2..91fc365 100644 --- a/scripts/occupationLootCrates.sqf +++ b/scripts/occupationLootCrates.sqf @@ -49,14 +49,16 @@ for "_i" from 1 to SC_numberofLootCrates do { _spawnPosition = [_position select 0, _position select 1, 0]; - _group = createGroup SC_BanditSide; - + _initialGroup = createGroup SC_BanditSide; + _initialGroup setCombatMode "BLUE"; + _initialGroup setBehaviour "SAFE"; + for "_i" from 1 to _AICount do { _loadOut = ["bandit"] call SC_fnc_selectGear; - _unit = [_group,_spawnPosition,"custom","random","bandit","soldier",_loadOut] call DMS_fnc_SpawnAISoldier; + _unit = [_initialGroup,_spawnPosition,"custom","random","bandit","soldier",_loadOut] call DMS_fnc_SpawnAISoldier; _unitName = ["bandit"] call SC_fnc_selectName; - _unit setName _unitName; + if(!isNil "_unitName") then { _unit setName _unitName; }; reload _unit; }; @@ -64,6 +66,20 @@ for "_i" from 1 to SC_numberofLootCrates do enableSentences false; enableRadio false; + + _group = createGroup SC_BanditSide; + _group setVariable ["DMS_LockLocality",nil]; + _group setVariable ["DMS_SpawnedGroup",true]; + _group setVariable ["DMS_Group_Side", SC_BanditSide]; + + { + _unit = _x; + [_unit] joinSilent grpNull; + [_unit] joinSilent _group; + _unit setCaptive false; + }foreach units _initialGroup; + + [_group, _spawnPosition, 100] call bis_fnc_taskPatrol; _group setBehaviour "AWARE"; _group setCombatMode "RED"; diff --git a/scripts/occupationMilitary.sqf b/scripts/occupationMilitary.sqf index 560c37c..60fa21f 100644 --- a/scripts/occupationMilitary.sqf +++ b/scripts/occupationMilitary.sqf @@ -149,7 +149,7 @@ _areaToScan = [ false, false ] call SC_fnc_findsafePos; [_unit] joinSilent grpNull; [_unit] joinSilent _group; _unitName = ["bandit"] call SC_fnc_selectName; - _unit setName _unitName; + if(!isNil "_unitName") then { _unit setName _unitName; }; reload _unit; if(SC_debug) then { @@ -174,7 +174,7 @@ _areaToScan = [ false, false ] call SC_fnc_findsafePos; [_unit] joinSilent grpNull; [_unit] joinSilent _group; _unitName = ["bandit"] call SC_fnc_selectName; - _unit setName _unitName; + if(!isNil "_unitName") then { _unit setName _unitName; }; if(SC_debug) then { _tag = createVehicle ["Sign_Arrow_Blue_F", position _unit, [], 0, "CAN_COLLIDE"]; diff --git a/scripts/occupationPlaces.sqf b/scripts/occupationPlaces.sqf index 7ca6792..5aa3537 100644 --- a/scripts/occupationPlaces.sqf +++ b/scripts/occupationPlaces.sqf @@ -145,13 +145,11 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi for "_i" from 1 to _aiCount do { _loadOut = [_side] call SC_fnc_selectGear; - _unit = [_group,_spawnPosition,"custom","random",_side,"soldier",_loadOut] call DMS_fnc_SpawnAISoldier; - _unitName = [_side] call SC_fnc_selectName; + _unit = [_group,_spawnPosition,"custom","random",_side,"soldier",_loadOut] call DMS_fnc_SpawnAISoldier; _unit setVariable ["SC_unitLocationName", _locationName,true]; _unit setVariable ["SC_unitLocationPosition", _pos,true]; _unit setVariable ["SC_unitSide", _side,true]; _unit addMPEventHandler ["mpkilled", "_this call SC_fnc_locationUnitMPKilled;"]; - _unit setName _unitName; }; DMS_ai_use_launchers = _useLaunchers; @@ -163,7 +161,9 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi { _unit = _x; [_unit] joinSilent grpNull; - [_unit] joinSilent _group; + [_unit] joinSilent _group; + _unitName = [_side] call SC_fnc_selectName; + if(!isNil "_unitName") then { _unit setName _unitName; }; [_side,_unit] call SC_fnc_addMarker; reload _unit; }foreach units _group; @@ -237,8 +237,6 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi { _loadOut = ["bandit"] call SC_fnc_selectGear; _unit = [_group2,_spawnPosition,"custom","random",_side,"soldier",_loadOut] call DMS_fnc_SpawnAISoldier; - _unitName = [_side] call SC_fnc_selectName; - _unit setName _unitName; _unit setVariable ["SC_unitLocationName", _locationName,true]; _unit setVariable ["SC_unitLocationPosition", _pos,true]; _unit setVariable ["SC_unitSide", _side,true]; @@ -259,6 +257,8 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi [_unit] joinSilent grpNull; [_unit] joinSilent _group2; [_side,_unit] call SC_fnc_addMarker; + _unitName = [_side] call SC_fnc_selectName; + if(!isNil "_unitName") then { _unit setName _unitName; }; reload _unit; }foreach units _group2; diff --git a/scripts/occupationSea.sqf b/scripts/occupationSea.sqf index e1b5073..eaba2e1 100644 --- a/scripts/occupationSea.sqf +++ b/scripts/occupationSea.sqf @@ -107,9 +107,7 @@ for "_i" from 1 to _vehiclesToSpawn do _vehicleSeat = _x select 1; if(_vehicleRole == "Driver") then { - _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; - _unitName = ["bandit"] call SC_fnc_selectName; - _unit setName _unitName; + _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; _amountOfCrew = _amountOfCrew + 1; _unit assignAsDriver _vehicle; _unit moveInDriver _vehicle; @@ -118,9 +116,7 @@ for "_i" from 1 to _vehiclesToSpawn do }; if(_vehicleRole == "Turret") then { - _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; - _unitName = ["bandit"] call SC_fnc_selectName; - _unit setName _unitName; + _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; _amountOfCrew = _amountOfCrew + 1; _unit moveInTurret [_vehicle, _vehicleSeat]; _unit setVariable ["DMS_AssignedVeh",_vehicle]; @@ -128,9 +124,7 @@ for "_i" from 1 to _vehiclesToSpawn do }; if(_vehicleRole == "CARGO" && _amountOfCrew < _crewRequired) then { - _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; - _unitName = ["bandit"] call SC_fnc_selectName; - _unit setName _unitName; + _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; _amountOfCrew = _amountOfCrew + 1; _unit assignAsCargo _vehicle; _unit moveInCargo _vehicle; @@ -147,6 +141,8 @@ for "_i" from 1 to _vehiclesToSpawn do { _unit = _x; + _unitName = ["bandit"] call SC_fnc_selectName; + if(!isNil "_unitName") then { _unit setName _unitName; }; [_unit] joinSilent grpNull; [_unit] joinSilent _group; }foreach units _group; diff --git a/scripts/occupationSky.sqf b/scripts/occupationSky.sqf index f0f0c72..d57fb31 100644 --- a/scripts/occupationSky.sqf +++ b/scripts/occupationSky.sqf @@ -169,10 +169,14 @@ for "_i" from 1 to _vehiclesToSpawn do { _unit = _x; + _unitName = ["bandit"] call SC_fnc_selectName; + if(!isNil "_unitName") then { _unit setName _unitName; }; [_unit] joinSilent grpNull; [_unit] joinSilent _group; }foreach units _group; + _group setVariable ["DMS_AllowFreezing",false,true]; + if(SC_extendedLogging && _unitPlaced) then { _logDetail = format['[OCCUPATION:Sky] %1 spawned @ %2',_VehicleClassToUse,_spawnLocation]; diff --git a/scripts/occupationTransport.sqf b/scripts/occupationTransport.sqf index c90eb32..3352c4e 100644 --- a/scripts/occupationTransport.sqf +++ b/scripts/occupationTransport.sqf @@ -51,7 +51,7 @@ else // Create the driver/pilot and ensure he doest react to gunfire or being shot at. _group = createGroup resistance; _group setCombatMode "BLUE"; - +_group setVariable ["DMS_AllowFreezing",false,true]; // Spawn Vehicle @@ -94,7 +94,7 @@ else _group addVehicle _transport; -_group setVariable ["DMS_AllowFreezing",false,true]; + _transport enableCopilot false; _transportDriver = _group createUnit [DMS_AI_Classname, _spawnLocation, [], 0,"FORM"]; @@ -120,6 +120,7 @@ _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 ["SC_lastSpoke", time, true]; _transport addEventHandler ["getin", "_this call SC_fnc_getOnBus;"]; _transport addEventHandler ["getout", "_this call SC_fnc_getOffBus;"]; @@ -220,6 +221,14 @@ while {true} do _transportDriver enableAI "MOVE"; }; if(!Alive _transportDriver) exitWith {}; + _transportDriverlastSpoke = _transportDriver getVariable "SC_lastSpoke"; + if(time - _transportDriverlastSpoke > 30) then + { + _randomChat = [SC_occupyTransportMessages] call BIS_fnc_selectRandom; + _speech = _randomChat select 0; + _transportDriver vehiclechat _speech; + _transportDriver setVariable ["SC_lastSpoke", time, true]; + }; uiSleep 5; }; deleteMarker _mk; diff --git a/scripts/occupationVehicle.sqf b/scripts/occupationVehicle.sqf index c9453f5..f3ef3bd 100644 --- a/scripts/occupationVehicle.sqf +++ b/scripts/occupationVehicle.sqf @@ -185,8 +185,6 @@ if(_vehiclesToSpawn >= 1) then { _loadOut = [_side] call SC_fnc_selectGear; _unit = [_group,_spawnLocation,"custom","random",_side,"Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; - _unitName = [_side] call SC_fnc_selectName; - _unit setName _unitName; _amountOfCrew = _amountOfCrew + 1; _unit disableAI "FSM"; _unit disableAI "MOVE"; @@ -209,9 +207,7 @@ if(_vehiclesToSpawn >= 1) then if(_vehicleRole == "Turret" && _amountOfCrew < _crewRequired) then { _loadOut = [_side] call SC_fnc_selectGear; - _unit = [_group,_spawnLocation,"custom","random",_side,"Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; - _unitName = [_side] call SC_fnc_selectName; - _unit setName _unitName; + _unit = [_group,_spawnLocation,"custom","random",_side,"Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; _amountOfCrew = _amountOfCrew + 1; [_side,_unit] call SC_fnc_addMarker; _unit moveInTurret [_vehicle, _vehicleSeat]; @@ -222,9 +218,7 @@ if(_vehiclesToSpawn >= 1) then if(_vehicleRole == "CARGO" && _amountOfCrew < _crewRequired) then { _loadOut = [_side] call SC_fnc_selectGear; - _unit = [_group,_spawnLocation,"custom","random",_side,"Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; - _unitName = [_side] call SC_fnc_selectName; - _unit setName _unitName; + _unit = [_group,_spawnLocation,"custom","random",_side,"Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; _amountOfCrew = _amountOfCrew + 1; [_side,_unit] call SC_fnc_addMarker; _unit assignAsCargo _vehicle; @@ -250,9 +244,12 @@ if(_vehiclesToSpawn >= 1) then sleep 2; { - _x enableAI "FSM"; - _x enableAI "MOVE"; - reload _x; + _unit = _x; + _unit enableAI "FSM"; + _unit enableAI "MOVE"; + reload _unit; + _unitName = [_side] call SC_fnc_selectName; + if(!isNil "_unitName") then { _unit setName _unitName; }; }forEach units _group; [_group, _spawnLocation, 2000] call bis_fnc_taskPatrol; diff --git a/scripts/startOccupation.sqf b/scripts/startOccupation.sqf index cf1bd48..0975fcc 100644 --- a/scripts/startOccupation.sqf +++ b/scripts/startOccupation.sqf @@ -1,12 +1,26 @@ if (!isServer) exitWith {}; +if(SC_processReporter) then +{ + _logDetail = format ["[processReporter]:: Initialised at %1",time]; + [_logDetail] call SC_fnc_log; + fnc_processReporter = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\extras\processReporter.sqf"; + [60, fnc_processReporter, [], true] call ExileServer_system_thread_addTask; +}; + _logDetail = format ["[OCCUPATION]:: Detected DMS version %1",DMS_Version]; [_logDetail] call SC_fnc_log; _logDetail = format ["[OCCUPATION]:: Occupation %2 Adding modules to Exile system thread manager at %1",time,SC_occupationVersion]; [_logDetail] call SC_fnc_log; -[] call ExileClient_system_map_initialize; + +if(SC_occupyLootCratesMarkers OR SC_removeUserMapMarkers) 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; +}; if(SC_debug) then { SC_refreshTime = 60; }else{ SC_refreshTime = 300; }; @@ -33,12 +47,7 @@ if(SC_occupyTraders) then 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; - }; + uiSleep 15; // delay the start call compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationLootCrates.sqf"; };