diff --git a/pre-packaged pbo/a3_exile_occupation.pbo b/pre-packaged pbo/a3_exile_occupation.pbo index 9686ff2..5659bea 100644 Binary files a/pre-packaged pbo/a3_exile_occupation.pbo and b/pre-packaged pbo/a3_exile_occupation.pbo differ 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