mirror of
https://github.com/Teh-Dango/Sarge-AI.git
synced 2024-08-30 16:32:11 +00:00
Hotfix
Moved all code to be executed on the server. This resolves an issue with player respect alterations.
This commit is contained in:
parent
2f119d5fbc
commit
c19d9431d0
@ -10,26 +10,26 @@
|
||||
Modded for Arma 3: Exile Mod
|
||||
Changes: Dango
|
||||
http://www.hod-servers.com
|
||||
|
||||
https://github.com/Teh-Dango
|
||||
*/
|
||||
private ["_worldname","_startx","_starty","_gridsize_x","_gridsize_y","_gridwidth","_markername","_triggername","_trig_act_stmnt","_trig_deact_stmnt","_trig_cond","_check","_script_handler","_legendname"];
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
if (!isNil "A3XAI_isActive") exitWith {diag_log format ["Sarge's AI System: A3XAI has been detected. Sarge AI is not compatibale with A3XAI. Sarge AI is now exiting!"];};
|
||||
|
||||
call compile preprocessFileLineNumbers "sarge\SAR_config.sqf";
|
||||
|
||||
diag_log format["Sarge's AI System: Starting Sarge AI version %1",SAR_version];
|
||||
|
||||
if (!isServer) then {
|
||||
if (!isServer || hasInterface) then {
|
||||
"adjustrating" addPublicVariableEventHandler {((_this select 1) select 0) addRating ((_this select 1) select 1);};
|
||||
};
|
||||
|
||||
SAR_AI_hit = compile preprocessFileLineNumbers "sarge\SAR_aihit.sqf";
|
||||
SAR_AI_killed = compile preprocessFileLineNumbers "sarge\SAR_aikilled.sqf";
|
||||
SAR_AI_trace = compile preprocessFileLineNumbers "sarge\SAR_trace_entities.sqf";
|
||||
SAR_AI_base_trace = compile preprocessFileLineNumbers "sarge\SAR_trace_base_entities.sqf";
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
SAR_AI = compile preprocessFileLineNumbers "sarge\SAR_setup_AI_patrol.sqf";
|
||||
SAR_AI_heli = compile preprocessFileLineNumbers "sarge\SAR_setup_AI_patrol_heli.sqf";
|
||||
SAR_AI_land = compile preprocessFileLineNumbers "sarge\SAR_setup_AI_patrol_land.sqf";
|
||||
@ -37,7 +37,6 @@ SAR_AI_trace_veh = compile preprocessFileLineNumbers "sarge\SAR_trace_from_vehi
|
||||
SAR_AI_reammo = compile preprocessFileLineNumbers "sarge\SAR_reammo_refuel_AI.sqf";
|
||||
SAR_AI_spawn = compile preprocessFileLineNumbers "sarge\SAR_AI_spawn.sqf";
|
||||
SAR_AI_despawn = compile preprocessFileLineNumbers "sarge\SAR_AI_despawn.sqf";
|
||||
SAR_AI_killed = compile preprocessFileLineNumbers "sarge\SAR_aikilled.sqf";
|
||||
SAR_AI_VEH_HIT = compile preprocessFileLineNumbers "sarge\SAR_ai_vehicle_hit.sqf";
|
||||
SAR_AI_GUARDS = compile preprocessFileLineNumbers "sarge\SAR_setup_AI_patrol_guards.sqf";
|
||||
|
||||
@ -70,6 +69,7 @@ WEST setFriend [RESISTANCE, 1];
|
||||
_worldname = toLower worldName;
|
||||
diag_log format["Sarge's AI System: Setting up SAR_AI for %1",_worldname];
|
||||
|
||||
// Lets hope this helps with the AI's view of buildings locality
|
||||
waituntil {PublicServerIsLoaded};
|
||||
|
||||
if (SAR_dynamic_spawning) then {
|
||||
|
@ -37,11 +37,11 @@ if (SAR_HITKILL_DEBUG && {isServer}) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: AI attacker - Type: %1 Name: %2 Side: %3 Group Side: %4",_aikiller_type,_aikiller_name, _aikiller_side,_aikiller_group_side];
|
||||
};
|
||||
|
||||
if((!isNull _aikiller) && (isPlayer _aikiller) && (_aikiller isKindOf "Exile_Unit_Player")) then {
|
||||
_playerUID = getPlayerUID _aikiller;
|
||||
|
||||
_playerUID = getPlayerUID _aikiller;
|
||||
if ((!isNull _aikiller) && {(_playerUID != "") && {_aikiller isKindOf "Exile_Unit_Player"}}) then {
|
||||
|
||||
if (_aikilled_group_side isEqualTo SAR_AI_friendly_side) then { // hit a friendly AI
|
||||
if (_aikilled_group_side == SAR_AI_friendly_side) then { // hit a friendly AI
|
||||
|
||||
if (SAR_HITKILL_DEBUG && {isServer}) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: friendly AI was hit by Player %1",_aikiller];
|
||||
@ -67,6 +67,7 @@ if((!isNull _aikiller) && (isPlayer _aikiller) && (_aikiller isKindOf "Exile_Uni
|
||||
|
||||
ExileClientPlayerScore = _playerRespect;
|
||||
(owner _aikiller) publicVariableClient "ExileClientPlayerScore";
|
||||
ExileClientPlayerScore = nil;
|
||||
|
||||
format ["setAccountMoneyAndRespect:%1:%2:%3", _playerMoney, _playerRespect, _playerUID] call ExileServer_system_database_query_fireAndForget;
|
||||
|
||||
@ -90,7 +91,7 @@ if((!isNull _aikiller) && (isPlayer _aikiller) && (_aikiller isKindOf "Exile_Uni
|
||||
} foreach units group _ai;
|
||||
};
|
||||
|
||||
if (_aikilled_group_side isEqualTo SAR_AI_unfriendly_side) then { // hit an unfriendly AI
|
||||
if (_aikilled_group_side == SAR_AI_unfriendly_side) then { // hit an unfriendly AI
|
||||
|
||||
if (SAR_HITKILL_DEBUG && {isServer}) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: unfriendly AI was hit by Player %1",_aikiller];
|
||||
@ -106,6 +107,7 @@ if((!isNull _aikiller) && (isPlayer _aikiller) && (_aikiller isKindOf "Exile_Uni
|
||||
|
||||
ExileClientPlayerScore = _playerRespect;
|
||||
(owner _aikiller) publicVariableClient "ExileClientPlayerScore";
|
||||
ExileClientPlayerScore = nil;
|
||||
|
||||
format ["setAccountMoneyAndRespect:%1:%2:%3", _playerMoney, _playerRespect, _playerUID] call ExileServer_system_database_query_fireAndForget;
|
||||
|
||||
|
@ -55,11 +55,11 @@ if (SAR_HITKILL_DEBUG) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: AI Killer - Type: %1 Name: %2 Side: %3 Group Side: %4",_aikiller_type,_aikiller_name, _aikiller_side,_aikiller_group_side];
|
||||
};
|
||||
|
||||
if ((!isNull _aikiller) && (_aikiller isKindOf "Exile_Unit_Player")) then {
|
||||
_playerUID = getPlayerUID _aikiller;
|
||||
|
||||
_playerUID = getPlayerUID _aikiller;
|
||||
if ((!isNull _aikiller) && {(_playerUID != "") && {_aikiller isKindOf "Exile_Unit_Player"}}) then {
|
||||
|
||||
if (_aikilled_group_side isEqualTo SAR_AI_friendly_side) then {
|
||||
if (_aikilled_group_side == SAR_AI_friendly_side) then {
|
||||
|
||||
if (SAR_DEBUG) then {diag_log format ["Sarge's AI System: Adjusting respect for survivor or soldier kill by %2 for %1",_aikiller,SAR_surv_kill_value];};
|
||||
|
||||
@ -73,6 +73,7 @@ if ((!isNull _aikiller) && (_aikiller isKindOf "Exile_Unit_Player")) then {
|
||||
|
||||
ExileClientPlayerScore = _playerRespect;
|
||||
(owner _aikiller) publicVariableClient "ExileClientPlayerScore";
|
||||
ExileClientPlayerScore = nil;
|
||||
|
||||
format ["setAccountMoneyAndRespect:%1:%2:%3", _playerMoney, _playerRespect, _playerUID] call ExileServer_system_database_query_fireAndForget;
|
||||
|
||||
@ -83,16 +84,16 @@ if ((!isNull _aikiller) && (_aikiller isKindOf "Exile_Unit_Player")) then {
|
||||
if ((random 100) > 3) then {
|
||||
_message = format["%1 killed a friendly AI - sending reinforcements!",_aikiller_name];
|
||||
//[nil, nil, rspawn, [[West,"airbase"], _message], { (_this select 0) sideChat (_this select 1) }] call RE;
|
||||
[[[West,"airbase"], _message],{(_this select 0) sideChat (_this select 1)}] call BIS_fnc_MP;
|
||||
[[[West,"airbase"], _message],sideChat] call BIS_fnc_MP;
|
||||
} else {
|
||||
if ((random 100) < 3) then {
|
||||
_message = format["Tango down ... we offer a decent reward for the head of %1!",_aikiller_name];
|
||||
//[nil, nil, rspawn, [[West,"airbase"], _message], { (_this select 0) sideChat (_this select 1) }] call RE;
|
||||
[[[West,"airbase"], _message],{(_this select 0) sideChat (_this select 1)}] call BIS_fnc_MP;
|
||||
[[[West,"airbase"], _message],sideChat] call BIS_fnc_MP;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (_aikilled_group_side isEqualTo SAR_AI_unfriendly_side) then {
|
||||
if (_aikilled_group_side == SAR_AI_unfriendly_side) then {
|
||||
|
||||
if (SAR_DEBUG) then {diag_log format ["Sarge's AI System: Adjusting respect for bandit kill by %2 for %1",_aikiller,SAR_band_kill_value];};
|
||||
|
||||
@ -106,6 +107,7 @@ if ((!isNull _aikiller) && (_aikiller isKindOf "Exile_Unit_Player")) then {
|
||||
|
||||
ExileClientPlayerScore = _playerRespect;
|
||||
(owner _aikiller) publicVariableClient "ExileClientPlayerScore";
|
||||
ExileClientPlayerScore = nil;
|
||||
|
||||
format ["setAccountMoneyAndRespect:%1:%2:%3", _playerMoney, _playerRespect, _playerUID] call ExileServer_system_database_query_fireAndForget;
|
||||
|
||||
@ -117,12 +119,12 @@ if ((!isNull _aikiller) && (_aikiller isKindOf "Exile_Unit_Player")) then {
|
||||
if ((random 100) < 3) then {
|
||||
_message = format["nice bandit kill %1!",_aikiller_name];
|
||||
//[nil, nil, rspawn, [[West,"airbase"], _message], { (_this select 0) sideChat (_this select 1) }] call RE;
|
||||
[_message,"(_this select 0) sideChat (_this select 1)",true,false] call BIS_fnc_MP;
|
||||
//[_message,"(_this select 0) sideChat (_this select 1)",true,false] call BIS_fnc_MP;
|
||||
} else {
|
||||
if ((random 100) < 3) then {
|
||||
_message = format["another bandit down ... %1 is going to be the root cause of bandit extinction :-)",_aikiller_name];
|
||||
//[nil, nil, rspawn, [[West,"airbase"], _message], { (_this select 0) sideChat (_this select 1) }] call RE;
|
||||
[_message,"(_this select 0) sideChat (_this select 1)",true,false] call BIS_fnc_MP;
|
||||
//[_message,"(_this select 0) sideChat (_this select 1)",true,false] call BIS_fnc_MP;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user