From 69f964eb8b3719ca05d56d8045892c9c8d8a09b4 Mon Sep 17 00:00:00 2001 From: second_coming Date: Fri, 26 Aug 2016 08:58:29 +0100 Subject: [PATCH] V63 bugfixorama --- pre-packaged pbo/a3_exile_occupation.pbo | Bin 216255 -> 217344 bytes source/a3_exile_occupation/changeLog.txt | 5 ++ source/a3_exile_occupation/config.cpp | 2 +- source/a3_exile_occupation/config.sqf | 4 +- .../scripts/occupationRandomSpawn.sqf | 59 ++++++++++++------ 5 files changed, 48 insertions(+), 22 deletions(-) diff --git a/pre-packaged pbo/a3_exile_occupation.pbo b/pre-packaged pbo/a3_exile_occupation.pbo index 9686ff2f7e1ce62dc17d5a7c30178ea71214a26e..5659bea1e98c34bc3c7fb7cc71978f797b997bed 100644 GIT binary patch delta 805 zcmb7>Ur1AN6vsRFF7IG#*`41 zg2;MMFLCHWkid6s4~q!gb1x~q^p7HW1b>HY5LGLXaCCwQ1!0DybgIGrGcNM1tMn-aoq+2P;M6frPPH9q6D1=j zt3poJRGi~kKW_7E75Xv|a&T@Zhqp68aF^PO{VR;e!u9gt#qJHphk+)x1N(S5f^{++ z#fv=DVR?h`IJ)9?-*J4k2(D_5BlIf{-!8&AOlE+`$U``Rz3-r@imL=}@N6?i6{rUe z1%(0<3WU0?DH`@}*R%^+Nl?joV&{}$SI4a9{3I>h9NB-oV`*PgsP-*|@;)k**L4eg ze;toz1d&?4=WjbPG*S=@BGOyYQ|(*52OWu98{kwN0`3abX3xgatAOgWvwvjbYlWJ! zLhJZro^Et->(l>B#;Fkq?mIQN01fy3<52RCGmpP`m!{u@-h29X3eTT~f8G0*@7Znr F{s&*c@|OSr delta 348 zcmZoz#Jhhc?}TE$H@Xa9(C}wp_#54cjgrirfA&qBE5j_`zIWpuWhTBOPzA2P_k|zP zovg?tvYC;&h<$T7x2hhik%ESi>E=euMlnXi$rrsvChMoNZk7qy$uwEjOKI}iV3B6- z;O*SOjPC`fi={F~h}K&3a&dCT7pLZ=CYPk91mq-ErWQ@_uVs{-uARoXi=_Z4u>E}+ zV>aXTgG$Vz+dDEC4H>5kW-)3`cPU`hp1!$|QD(ZaBD2i&zG+N?OuSsvFDfw$Pp{v? zBnn||n8w6CeQqBk&-5!w%mUNr%P}HU@%b|fPJh?O$N`cQo6gBnT5WtkNec&A_RW>jG31OlLYr!UE6%wy!7uAj$PJN;-YqgZ=*KI8WAe5R=n aMJm-FmAkxH{x_SM*R0``lPmX;x%>dSd2a&% diff --git a/source/a3_exile_occupation/changeLog.txt b/source/a3_exile_occupation/changeLog.txt index 263910f..eaa8b62 100644 --- a/source/a3_exile_occupation/changeLog.txt +++ b/source/a3_exile_occupation/changeLog.txt @@ -1,3 +1,8 @@ +================================================================================= +V63 (26-08-2016) +================================================================================= +Major bug fix in the random spawn module + ================================================================================= V62 (25-08-2016) ================================================================================= diff --git a/source/a3_exile_occupation/config.cpp b/source/a3_exile_occupation/config.cpp index b05e3a8..fe474dd 100644 --- a/source/a3_exile_occupation/config.cpp +++ b/source/a3_exile_occupation/config.cpp @@ -4,7 +4,7 @@ class CfgPatches units[] = {}; weapons[] = {}; requiredVersion = 0.1; - a3_exile_occupation_version = "V62 (25-08-2016)"; + a3_exile_occupation_version = "V63 (26-08-2016)"; requiredAddons[] = {"a3_dms"}; author[]= {"second_coming"}; }; diff --git a/source/a3_exile_occupation/config.sqf b/source/a3_exile_occupation/config.sqf index d5c4b25..80f428c 100644 --- a/source/a3_exile_occupation/config.sqf +++ b/source/a3_exile_occupation/config.sqf @@ -66,14 +66,14 @@ SC_fastNightsMultiplierDay = 4; // the time multiplier to SC_randomSpawnMinPlayers = 1; // Minimum number of players to be online before random spawning AI can spawn SC_randomSpawnMaxGroups = 4; // Maximum amount of random AI groups allowed at any time -SC_randomSpawnMinGroupSize = 1; // Minimum amount of random AI groups allowed per group +SC_randomSpawnMinGroupSize = 2; // Minimum amount of random AI groups allowed per group SC_randomSpawnMaxGroupSize = 4; // Maximum amount of random AI groups allowed per group SC_randomSpawnChance = 12; // Percentage chance of spawning if suitable player found SC_randomSpawnIgnoreCount = true; // true if you want spawn random AI groups regardless of overall AI count (they still count towards the total though) SC_randomSpawnFrequency = 3600; // time in seconds between the possibility of random AI hunting the same player (1800 for 30 minutes) SC_randomSpawnAnnounce = true; // true if you want a warning toast issued to all players when AI spawns -SC_randomSpawnNearBases = false; // true if you want to allow random spawns in range of territories +SC_randomSpawnNearBases = true; // true if you want to allow random spawns in range of territories SC_randomSpawnNearSpawns = false; // true if you want to allow random spawns in range of spawn zones SC_randomSpawnTargetBambis = false; // true if you want to allow random spawns to target bambis diff --git a/source/a3_exile_occupation/scripts/occupationRandomSpawn.sqf b/source/a3_exile_occupation/scripts/occupationRandomSpawn.sqf index 664ba38..cb10f34 100644 --- a/source/a3_exile_occupation/scripts/occupationRandomSpawn.sqf +++ b/source/a3_exile_occupation/scripts/occupationRandomSpawn.sqf @@ -45,24 +45,26 @@ if(time < 300) exitWith _distanceFromSelectedPlayer = 500; _selectedPlayer = _group getVariable "SC_huntedPlayer"; - if(alive _selectedPlayer) then + if(alive _selectedPlayer && !isNil "_selectedPlayer") then { _distanceFromSelectedPlayer = _selectedPlayer distance _groupLeader; + _logDetail = format['[OCCUPATION:RandomSpawn] group %1 is now %2m away from the target (%3)',_group,_distanceFromSelectedPlayer,_selectedPlayer]; + [_logDetail] call SC_fnc_log; }; - _selectedPlayer getVariable "SC_lastHunted"; + _suitableTargets = []; if(!alive _selectedPlayer OR _distanceFromSelectedPlayer >= 500) then { // Select a new target or despawn if no target nearby - _nearPlayers = player nearEntities ["Exile_Unit_Player", 500]; + _nearPlayers = _groupLeader nearEntities ["Exile_Unit_Player", 500]; { _selectedPlayer = _x; _playersPosition = position _selectedPlayer; _suitablePlayer = [ _playersPosition ] call SC_fnc_isSafePosRandom; _suitablePlayerisBambi = _selectedPlayer getVariable "ExileIsBambi"; - if(_suitablePlayer && (!_suitablePlayerisBambi OR SC_randomSpawnTargetBambis)) then + if(_suitablePlayer && (!_suitablePlayerisBambi OR SC_randomSpawnTargetBambis) && alive _selectedPlayer) then { _suitableTargets pushBack _selectedPlayer; }; @@ -74,31 +76,50 @@ if(time < 300) exitWith _group setVariable ["SC_huntedPlayer",_selectedPlayer]; // Hunt the selected player - _group reveal [_selectedPlayer,1.5]; _destination = getPos _selectedPlayer; - _group allowFleeing 0; - _wp = _group addWaypoint [_destination, 0] ; - _wp setWaypointFormation "Column"; - _wp setWaypointBehaviour "AWARE"; - _wp setWaypointCombatMode "RED"; - _wp setWaypointCompletionRadius 25; - _wp setWaypointType "SAD"; - - [_group, _destination, 350] call bis_fnc_taskPatrol; - _group allowFleeing 0; - _group setBehaviour "AWARE"; - _group setCombatMode "RED"; - + if(!isNil "_destination") then + { + _group reveal [_selectedPlayer,1.5]; + + _group allowFleeing 0; + _wp = _group addWaypoint [_destination, 0] ; + _wp setWaypointFormation "Column"; + _wp setWaypointBehaviour "AWARE"; + _wp setWaypointCombatMode "RED"; + _wp setWaypointCompletionRadius 5; + _wp setWaypointType "SAD"; + + [_group, _destination, 350] call bis_fnc_taskPatrol; + _group allowFleeing 0; + _group setBehaviour "AWARE"; + _group setCombatMode "RED"; + } + else + { + // Remove the group + SC_liveRandomGroups = SC_liveRandomGroups - [_group]; + _groupToClean = _group; + _cleanup = []; + { + _cleanup pushBack _x; + } forEach units _group; + _cleanup call DMS_fnc_CleanUp; + _logDetail = format['[OCCUPATION:RandomSpawn] group %1 had no target, so was deleted',_groupToClean]; + [_logDetail] call SC_fnc_log; + }; } else { // Remove the group - SC_liveRandomGroups = SC_liveRandomGroups - [_group]; + SC_liveRandomGroups = SC_liveRandomGroups - [_group]; + _groupToClean = _group; _cleanup = []; { _cleanup pushBack _x; } forEach units _group; _cleanup call DMS_fnc_CleanUp; + _logDetail = format['[OCCUPATION:RandomSpawn] group %1 had no target, so was deleted',_groupToClean]; + [_logDetail] call SC_fnc_log; }; } else