Sarge-AI/sarge/code/functions/fn_AI_trace.sqf

45 lines
1.2 KiB
Plaintext
Raw Normal View History

2016-08-19 02:58:49 +00:00
/*
# Original #
Sarge AI System 1.5
Created for Arma 2: DayZ Mod
Author: Sarge
https://github.com/Swiss-Sarge
# Fork #
Sarge AI System 2.0+
Modded for Arma 3: Exile Mod
Changes: Dango
http://www.hod-servers.com
*/
2017-10-26 01:04:52 +00:00
private ["_ai","_entity_array"];
2016-08-19 02:58:49 +00:00
2017-10-26 01:04:52 +00:00
// Prevent server and/or dedicated clients from running this script!!
if (isServer || !hasInterface) exitWith {};
2016-08-19 02:58:49 +00:00
_ai = _this select 0;
while {alive _ai} do {
2017-10-26 01:04:52 +00:00
_entity_array = (position _ai) nearEntities ["CAManBase",SAR_DETECT_HOSTILE];
2016-08-19 02:58:49 +00:00
{
2017-10-26 01:04:52 +00:00
// Only do this for AI not in a vehicle!!
if (vehicle _ai == _ai) then {
2016-08-19 02:58:49 +00:00
if (_x isKindof "civilclass") then {
2017-10-26 01:04:52 +00:00
if (rating _x > -10000) then {
2016-08-19 02:58:49 +00:00
_x addrating -10000;
2017-10-26 01:04:52 +00:00
if (SAR_EXTREME_DEBUG) then {diag_log format ["SAR EXTREME DEBUG: %1 rating reduced by 10,000!", typeOf _x];};
2016-08-19 02:58:49 +00:00
};
};
};
2017-10-26 01:04:52 +00:00
// only do this for players not in a vehicle!!
if (isPlayer _x && (vehicle _x == _x)) then {
//_respect = _x getVariable ["ExileScore",0];
If (rating < SAR_RESPECT_HOSTILE_LIMIT && {rating _x > -10000}) then {
2016-08-19 02:58:49 +00:00
_x addrating -10000;
2017-10-26 01:04:52 +00:00
if (SAR_EXTREME_DEBUG) then {diag_log format["SAR EXTREME DEBUG: %1 rating reduced by 10,000!", name _x];};
2016-08-19 02:58:49 +00:00
};
};
} forEach _entity_array;
2017-10-26 01:04:52 +00:00
sleep SAR_DETECT_INTERVAL;
2016-08-19 02:58:49 +00:00
};