Skip to content

Commit

Permalink
Fix findKiller
Browse files Browse the repository at this point in the history
  • Loading branch information
SnarkIndustries committed Jul 13, 2014
1 parent 62e2f5c commit 8263804
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
6 changes: 3 additions & 3 deletions DZAI/compile/ai_death.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ _unitType = _unitGroup getVariable ["unitType",""];
call {
if (_unitType == "static") exitWith {
[_victim,_killer,_unitGroup,_unitsAlive] call DZAI_AI_killed_static;
0 = [_victim,_killer,_unitGroup,_unitType] call DZAI_AI_killed_all;
0 = [_victim,_killer,_unitGroup,_unitType,_unitsAlive] call DZAI_AI_killed_all;
DZAI_numAIUnits = DZAI_numAIUnits - 1;
};
if (_unitType == "dynamic") exitWith {
[_victim,_killer,_unitGroup,_unitsAlive] call DZAI_AI_killed_dynamic;
0 = [_victim,_killer,_unitGroup,_unitType] call DZAI_AI_killed_all;
0 = [_victim,_killer,_unitGroup,_unitType,_unitsAlive] call DZAI_AI_killed_all;
DZAI_numAIUnits = DZAI_numAIUnits - 1;
};
if (_unitType in ["air","aircustom"]) exitWith {
[_victim,_unitGroup] call DZAI_AI_killed_air;
};
if (_unitType in ["land","landcustom"]) exitWith {
0 = [_victim,_killer,_unitGroup,_unitType,_unitsAlive] call DZAI_AI_killed_all;
0 = [_victim,_killer,_unitGroup,_unitType] call DZAI_AI_killed_all;
if (_unitsAlive == 0) then {
[_unitGroup] call DZAI_AI_killed_land;
};
Expand Down
2 changes: 1 addition & 1 deletion DZAI/compile/ai_killed_all.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (isPlayer _killer) then {
_unitGroup setFormDir ([(leader _unitGroup),_killer] call BIS_fnc_dirTo);
(units _unitGroup) doTarget (vehicle _killer);
(units _unitGroup) doFire (vehicle _killer);
if (DZAI_findKiller) then {0 = [_trigger,_killer,_unitGroup,300] spawn DZAI_huntKiller};
if (DZAI_findKiller) then {0 = [_killer,_unitGroup] spawn DZAI_huntKiller};
if (DZAI_lastManStanding && {_unitsAlive == 1}) then {0 = _unitGroup spawn DZAI_skillBoost;}; //"Last man standing" mode on
if (DZAI_debugLevel > 0) then {diag_log format["DZAI Debug: AI group %1 killed, %2 units left alive in group.",_unitGroup,_unitsAlive];};
};
Expand Down
16 changes: 7 additions & 9 deletions DZAI/compile/fn_findKiller.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
Last updated: 2:00 AM 7/1/2014
*/
private ["_unitGroup","_targetPlayer","_startPos","_chaseDist"];
private ["_unitGroup","_targetPlayer","_startPos"];

_startPos = _this select 0;
_targetPlayer = _this select 1;
_unitGroup = _this select 2;
_chaseDist = _this select 3;
_targetPlayer = _this select 0;
_unitGroup = _this select 1;

//Disable killer-finding for dynamic AI in hunting mode
if (_unitGroup getVariable ["seekActive",false]) exitWith {};
Expand All @@ -21,13 +19,13 @@ if (((_unitGroup getVariable ["pursuitTime",0]) > 0) && {((_unitGroup getVariabl
if (DZAI_debugLevel > 0) then {diag_log format ["DZAI Debug: Pursuit time +20 sec for Group %1 (Target: %2) to %3 seconds (fn_findKiller).",_unitGroup,name _targetPlayer,(_unitGroup getVariable ["pursuitTime",0]) - diag_tickTime]};
};

_startPos = _unitGroup getVariable ["trigger",DZAI_defaultTrigger];
if ((isNull _startPos) or (isNil "_startPos")) then {_startPos = _unitGroup getVariable ["spawnPos", getPosASL (leader _unitGroup)]};
_startPos = _unitGroup getVariable ["trigger",(getPosASL (leader _unitGroup))];

#define TRANSMIT_RANGE 50 //distance to broadcast radio text around target player
#define RECEIVE_DIST 150 //distance requirement to receive message from AI group leader
#define CHASE_DISTANCE 250 //distance to chase target from trigger position

if ((_startPos distance _targetPlayer) < _chaseDist) then {
if ((_startPos distance _targetPlayer) < CHASE_DISTANCE) then {
private ["_targetPlayerPos","_leader","_ableToChase","_debugMarkers","_marker"];
if (DZAI_debugLevel > 0) then {diag_log format ["DZAI Debug: Group %1 has entered pursuit state for 180 seconds. Target: %2. (fn_findKiller)",_unitGroup,_targetPlayer];};

Expand Down Expand Up @@ -55,7 +53,7 @@ if ((_startPos distance _targetPlayer) < _chaseDist) then {
(!isNull _targetPlayer) &&
{(alive _targetPlayer)} &&
{_ableToChase} &&
{((_startPos distance _targetPlayer) < _chaseDist)} &&
{((_startPos distance _targetPlayer) < CHASE_DISTANCE)} &&
{(!((vehicle _targetPlayer) isKindOf "Air"))}
} do {
if ((_unitGroup knowsAbout _targetPlayer) < 4) then {_unitGroup reveal [_targetPlayer,4]};
Expand Down
2 changes: 1 addition & 1 deletion DZAI/init/DZAI_version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
*/

#define DZAI_TYPE "DZAI"
#define DZAI_VERSION "2.1.0 Release Build 7072014"
#define DZAI_VERSION "2.1.0 Pre-release Build 6-7122014"

0 comments on commit 8263804

Please sign in to comment.