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

51 lines
1.5 KiB
Plaintext
Raw Normal View History

2017-10-26 01:36:31 +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+
2017-10-26 01:51:06 +00:00
Modded for Arma 3: Epoch Mod
2017-10-26 01:36:31 +00:00
Changes: Dango
https://www.hod-servers.com
*/
2017-10-26 01:51:06 +00:00
private ["_ai","_entity_array","_tracewhat","_player_rating","_clientmachine"];
2017-10-26 01:36:31 +00:00
if (!isServer) exitWith {};
_ai = _this select 0;
_tracewhat = "CAManBase";
while {alive _ai} do {
2017-10-26 01:51:06 +00:00
_entity_array = (position _ai) nearEntities [_tracewhat, SAR_DETECT_HOSTILE_FROM_VEHICLE];
2017-10-26 01:36:31 +00:00
{
2017-10-26 01:51:06 +00:00
if (isPlayer _x && {vehicle _x == _x}) then { // only do that for players that are not in a vehicle
2017-10-26 01:36:31 +00:00
_player_rating = rating _x;
2017-10-26 01:51:06 +00:00
//_respect = _x getVariable ["ExileScore",0];
if (rating player < SAR_RESPECT_HOSTILE_LIMIT && (_player_rating > -10000)) then {
2017-10-26 01:36:31 +00:00
2017-10-26 01:51:06 +00:00
if (SAR_EXTREME_DEBUG) then {
2017-10-26 01:36:31 +00:00
diag_log format["SAR EXTREME DEBUG: reducing rating (trace_from_vehicle) for player: %1", _x];
};
//define global variable
adjustrating = [_x,(0 - (10000+_player_rating))];
// get the players machine ID
_clientmachine = owner _x;
// transmit the global variable to this client machine
_clientmachine publicVariableClient "adjustrating";
// reveal player to vehicle group
_ai reveal [_x,4];
};
};
} forEach _entity_array;
2017-10-26 01:51:06 +00:00
sleep SAR_DETECT_FROM_VEHICLE_INTERVAL;
2017-10-26 01:36:31 +00:00
};