HC HotFix

I forgot the current method of HC spawning has a bug that causes player
respect not to change when killing AI. This hotfix will fix that bug.
This commit is contained in:
Teh Dango 2016-04-02 15:20:54 -04:00
parent 1218f04f15
commit 7266c93a16
6 changed files with 157 additions and 133 deletions

View File

@ -14,14 +14,12 @@
*/
private ["_worldname","_startx","_starty","_gridsize_x","_gridsize_y","_gridwidth","_markername","_triggername","_trig_act_stmnt","_trig_deact_stmnt","_trig_cond","_check","_script_handler","_legendname"];
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!"];};
if (!isServer && hasInterface) then {
"adjustrating" addPublicVariableEventHandler {((_this select 1) select 0) addRating ((_this select 1) select 1);};
};
if (elec_stop_exec == 1) 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];
@ -30,14 +28,15 @@ 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";
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";
SAR_AI_trace_veh = compile preprocessFileLineNumbers "sarge\SAR_trace_from_vehicle.sqf";
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_VEH_HIT = compile preprocessFileLineNumbers "sarge\SAR_ai_vehicle_hit.sqf";
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";
SAR_AI_GUARDS = compile preprocessFileLineNumbers "sarge\SAR_setup_AI_patrol_guards.sqf";
call compile preprocessFileLineNumbers "sarge\SAR_functions.sqf";
@ -66,12 +65,14 @@ RESISTANCE setFriend [WEST, 1];
WEST setFriend [EAST, 0];
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 object locality
waituntil {PublicServerIsLoaded};
if (elec_stop_exec == 1) exitWith {};
_worldname = toLower worldName;
diag_log format["Sarge's AI System: Setting up SAR_AI for %1",_worldname];
if (SAR_dynamic_spawning) then {
scopeName "SAR_AI_DYNAI";

View File

@ -12,9 +12,9 @@
http://www.hod-servers.com
*/
private ["_ai","_aikiller","_aikilled_type","_aikilled_side","_aikilled_group_side","_aikiller_group_side","_aikiller_type","_aikiller_name","_aikiller_side","_respect","_message"];
//private ["_ai","_aikiller","_aikilled_type","_aikilled_side","_aikilled_group_side","_aikiller_group_side","_aikiller_type","_aikiller_name","_aikiller_side","_respect","_message"];
if (elec_stop_exec == 1) exitWith {};
if (!isServer && hasInterface) exitWith {};
_ai = _this select 0;
_aikiller = _this select 1;
@ -33,7 +33,7 @@ if (!(_aikiller_type in SAR_heli_type) && !("LandVehicle" countType [vehicle _ai
_aikiller_side = side _aikiller;
_aikiller_group_side = side (group _aikiller);
/*
if (SAR_HITKILL_DEBUG) then {
switch (elec_hc_connected) do {
case 0: {
@ -50,14 +50,14 @@ if (SAR_HITKILL_DEBUG) then {
};
};
};
*/
_playerUID = getPlayerUID _aikiller;
if ((!isNull _aikiller) && {(_playerUID != "") && {_aikiller isKindOf "Exile_Unit_Player"}}) then {
if (_aikilled_group_side == SAR_AI_friendly_side) then { // hit a friendly AI
if (SAR_HITKILL_DEBUG) then {
/* if (SAR_HITKILL_DEBUG) then {
switch (elec_hc_connected) do {
case 0: {
if (isServer) then {
@ -70,37 +70,43 @@ if ((!isNull _aikiller) && {(_playerUID != "") && {_aikiller isKindOf "Exile_Uni
};
};
};
};
}; */
if ((random 100) < 3) then {
if (SAR_KILL_MSG) then {
_message = format["Sarge AI: Dammit %1! You are firing on a friendly group check your fire!",_aikiller_name];
_message remoteExec ["systemChat",0];
if (!isServer && !hasInterface) then {
_message = format["Sarge AI: Dammit %1! You are firing on a friendly group check your fire!",_aikiller_name];
_message remoteExec ["systemChat",0];
};
};
} else {
if ((random 100) < 3) then {
if (SAR_KILL_MSG) then {
_message = format["Sarge AI: %1, this was the last time you shot one of our team! We are coming for you!",_aikiller_name];
_message remoteExec ["systemChat",0];
if (!isServer && !hasInterface) then {
if (SAR_KILL_MSG) then {
_message = format["Sarge AI: %1, this was the last time you shot one of our team! We are coming for you!",_aikiller_name];
_message remoteExec ["systemChat",0];
};
};
};
};
_playerRespect = _aikiller getVariable ["ExileScore", 0];
_playerMoney = _aikiller getVariable ["ExileMoney", 0];
_repChange = SAR_surv_kill_value / 10;
_playerRespect = _playerRespect - _repChange;
_aikiller setVariable ["ExileScore",_playerRespect];
ExileClientPlayerScore = _playerRespect;
(owner _aikiller) publicVariableClient "ExileClientPlayerScore";
ExileClientPlayerScore = nil;
format ["setAccountMoneyAndRespect:%1:%2:%3", _playerMoney, _playerRespect, _playerUID] call ExileServer_system_database_query_fireAndForget;
if (isServer) then {
_playerRespect = _aikiller getVariable ["ExileScore", 0];
_playerMoney = _aikiller getVariable ["ExileMoney", 0];
if (SAR_HITKILL_DEBUG) then {
_repChange = SAR_surv_kill_value / 10;
_playerRespect = _playerRespect - _repChange;
_aikiller setVariable ["ExileScore",_playerRespect];
ExileClientPlayerScore = _playerRespect;
(owner _aikiller) publicVariableClient "ExileClientPlayerScore";
ExileClientPlayerScore = nil;
format ["setAccountMoneyAndRespect:%1:%2:%3",_playerMoney ,_playerRespect ,getPlayerUID _aikiller] call ExileServer_system_database_query_fireAndForget;
};
/* if (SAR_HITKILL_DEBUG) then {
switch (elec_hc_connected) do {
case 0: {
if (isServer) then {
@ -113,10 +119,10 @@ if ((!isNull _aikiller) && {(_playerUID != "") && {_aikiller isKindOf "Exile_Uni
};
};
};
};
}; */
if (rating _aikiller > -10000) then { //check if shooter is not already marked as enemy
if (SAR_HITKILL_DEBUG) then {
/* if (SAR_HITKILL_DEBUG) then {
switch (elec_hc_connected) do {
case 0: {
if (isServer) then {
@ -129,7 +135,7 @@ if ((!isNull _aikiller) && {(_playerUID != "") && {_aikiller isKindOf "Exile_Uni
};
};
};
};
}; */
_aikiller addRating -10000;
};
@ -143,7 +149,7 @@ if ((!isNull _aikiller) && {(_playerUID != "") && {_aikiller isKindOf "Exile_Uni
if (_aikilled_group_side == SAR_AI_unfriendly_side) then { // hit an unfriendly AI
if (SAR_HITKILL_DEBUG) then {
/* if (SAR_HITKILL_DEBUG) then {
switch (elec_hc_connected) do {
case 0: {
if (isServer) then {
@ -156,23 +162,25 @@ if ((!isNull _aikiller) && {(_playerUID != "") && {_aikiller isKindOf "Exile_Uni
};
};
};
}; */
if (isServer) then {
_playerRespect = _aikiller getVariable ["ExileScore", 0];
_playerMoney = _aikiller getVariable ["ExileMoney", 0];
_repChange = SAR_surv_kill_value / 10;
_playerRespect = _playerRespect + _repChange;
_aikiller setVariable ["ExileScore",_playerRespect];
ExileClientPlayerScore = _playerRespect;
(owner _aikiller) publicVariableClient "ExileClientPlayerScore";
ExileClientPlayerScore = nil;
format ["setAccountMoneyAndRespect:%1:%2:%3",_playerMoney ,_playerRespect ,getPlayerUID _aikiller] call ExileServer_system_database_query_fireAndForget;
};
_playerRespect = _aikiller getVariable ["ExileScore", 0];
_playerMoney = _aikiller getVariable ["ExileMoney", 0];
_repChange = SAR_surv_kill_value / 10;
_playerRespect = _playerRespect + _repChange;
_aikiller setVariable ["ExileScore",_playerRespect];
ExileClientPlayerScore = _playerRespect;
(owner _aikiller) publicVariableClient "ExileClientPlayerScore";
ExileClientPlayerScore = nil;
format ["setAccountMoneyAndRespect:%1:%2:%3", _playerMoney, _playerRespect, _playerUID] call ExileServer_system_database_query_fireAndForget;
if (SAR_HITKILL_DEBUG) then {
/* if (SAR_HITKILL_DEBUG) then {
switch (elec_hc_connected) do {
case 0: {
if (isServer) then {
@ -185,6 +193,6 @@ if ((!isNull _aikiller) && {(_playerUID != "") && {_aikiller isKindOf "Exile_Uni
};
};
};
};
}; */
};
};

View File

@ -12,9 +12,9 @@
http://www.hod-servers.com
*/
private ["_message","_ai","_aikiller","_aikilled_type","_aikilled_side","_aikilled_group_side","_aikiller_group_side","_aikiller_type","_aikiller_name","_aikiller_side","_respect","_humankills","_banditkills","_tmp","_sphere_alpha","_sphere_red","_sphere_green","_sphere_blue","_obj_text_string","_ai_type","_ai_killer_type"];
//private ["_message","_ai","_aikiller","_aikilled_type","_aikilled_side","_aikilled_group_side","_aikiller_group_side","_aikiller_type","_aikiller_name","_aikiller_side","_respect","_humankills","_banditkills","_tmp","_sphere_alpha","_sphere_red","_sphere_green","_sphere_blue","_obj_text_string","_ai_type","_ai_killer_type"];
if (elec_stop_exec == 1) exitWith {};
if (!isServer && hasInterface) exitWith {};
_ai = _this select 0;
_aikiller = _this select 1;
@ -37,132 +37,147 @@ _ai_type = _ai getVariable ["SAR_AI_type",""];
_ai_killer_type = _aikiller getVariable ["SAR_AI_type",""];
if (SAR_KILL_MSG) then {
if (isPlayer _aikiller) then {
_message = format["A %2 was killed by Player: %1",_aikiller_name,_ai_type];
_message remoteExec ["systemChat",0];
};
if(!isPlayer _aikiller && !(isNull _aikiller)) then {
_message = format["A %1 was killed by a %2!",_ai_type,_ai_killer_type];
diag_log _message;
_message remoteExec ["systemChat",0];
if (!isServer && !hasInterface) then {
if (isPlayer _aikiller) then {
_message = format["Sarge AI: %2 was killed by Player: %1",name _aikiller,_ai_type];
_message remoteExec ["systemChat",0];
};
if(!isPlayer _aikiller && !(isNull _aikiller)) then {
_message = format["Sarge AI: %1 was killed by a %2!",_ai_type,_ai_killer_type];
diag_log _message;
_message remoteExec ["systemChat",0];
};
};
};
/*
if (SAR_HITKILL_DEBUG) then {
switch (elec_hc_connected) do {
case 0: {
if (isServer) then {
diag_log format["SAR_HITKILL_DEBUG: AI killed - Type: %1 Side: %2 Group Side: %3",_aikilled_type, _aikilled_side,_aikilled_group_side];
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];
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];
};
};
case 1: {
if (!isServer && !hasInterface) then {
diag_log format["SAR_HITKILL_DEBUG: AI killed - Type: %1 Side: %2 Group Side: %3",_aikilled_type, _aikilled_side,_aikilled_group_side];
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];
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];
};
};
};
};
*/
_playerUID = getPlayerUID _aikiller;
if ((!isNull _aikiller) && {(_playerUID != "") && {_aikiller isKindOf "Exile_Unit_Player"}}) then {
if (_aikilled_group_side == SAR_AI_friendly_side) then {
if (SAR_DEBUG) then {
/* if (SAR_DEBUG) then {
switch (elec_hc_connected) do {
case 0: {
if (isServer) then {
diag_log format ["Sarge's AI System: Adjusting respect for survivor or soldier kill by %2 for %1",_aikiller,SAR_surv_kill_value];
diag_log format ["Sarge's AI System: Adjusting respect for survivor or soldier kill by %2 for %1",_aikiller_name,SAR_surv_kill_value];
};
};
case 1: {
if (!isServer && !hasInterface) then {
diag_log format ["Sarge's AI System: Adjusting respect for survivor or soldier kill by %2 for %1",_aikiller,SAR_surv_kill_value];
diag_log format ["Sarge's AI System: Adjusting respect for survivor or soldier kill by %2 for %1",_aikiller_name,SAR_surv_kill_value];
};
};
};
}; */
if (isServer) then {
_playerRespect = _aikiller getVariable ["ExileScore", 0];
_playerMoney = _aikiller getVariable ["ExileMoney", 0];
_repChange = SAR_surv_kill_value / 10;
_playerRespect = _playerRespect - _repChange;
_aikiller setVariable ["ExileScore",_playerRespect];
_fragType = [[format ["%1 Kill",_ai_type],-_repChange]];
[_aikiller, "showFragRequest", [_fragType]] call ExileServer_system_network_send_to;
ExileClientPlayerScore = _playerRespect;
(owner _aikiller) publicVariableClient "ExileClientPlayerScore";
ExileClientPlayerScore = nil;
format ["setAccountMoneyAndRespect:%1:%2:%3",_playerMoney ,_playerRespect ,getPlayerUID _aikiller] call ExileServer_system_database_query_fireAndForget;
if (SAR_log_AI_kills) then {
_friendlyCount = profileNamespace getVariable["SAR_FRIENDLY_KILLS",0];
_aikiller setVariable ["SAR_FRIENDLY_KILLS",(_friendlyCount + 1),true];
};
};
_playerRespect = _aikiller getVariable ["ExileScore", 0];
_playerMoney = _aikiller getVariable ["ExileMoney", 0];
_repChange = SAR_surv_kill_value / 10;
_playerRespect = _playerRespect - _repChange;
_aikiller setVariable ["ExileScore",_playerRespect];
_fragType = [[format ["%1 Kill",_ai_type],-_repChange]];
[_aikiller, "showFragRequest", [_fragType]] call ExileServer_system_network_send_to;
ExileClientPlayerScore = _playerRespect;
(owner _aikiller) publicVariableClient "ExileClientPlayerScore";
ExileClientPlayerScore = nil;
format ["setAccountMoneyAndRespect:%1:%2:%3", _playerMoney, _playerRespect, _playerUID] call ExileServer_system_database_query_fireAndForget;
if (SAR_log_AI_kills) then {
_friendlyCount = profileNamespace getVariable["SAR_FRIENDLY_KILLS",0];
_aikiller setVariable ["SAR_FRIENDLY_KILLS",(_friendlyCount + 1),true];
};
if ((random 100) < 3) then {
_message = format["Sarge AI: %1 killed a friendly AI - sending reinforcements!",_aikiller_name];
_message remoteExec ["systemChat",0];
if (!isServer && !hasInterface) then {
_message = format["Sarge AI: %1 killed a friendly AI - sending reinforcements!",_aikiller_name];
_message remoteExec ["systemChat",0];
};
} else {
if ((random 100) < 3) then {
_message = format["Sarge AI: Tango down ... we offer a decent reward for the head of %1!",_aikiller_name];
_message remoteExec ["systemChat",0];
if (!isServer && !hasInterface) then {
_message = format["Sarge AI: Tango down ... we offer a decent reward for the head of %1!",_aikiller_name];
_message remoteExec ["systemChat",0];
};
};
};
};
if (_aikilled_group_side == SAR_AI_unfriendly_side) then {
if (SAR_DEBUG) then {
/* if (SAR_DEBUG) then {
switch (elec_hc_connected) do {
case 0: {
if (isServer) then {
diag_log format ["Sarge's AI System: Adjusting respect for bandit kill by %2 for %1",_aikiller,SAR_band_kill_value];
diag_log format ["Sarge's AI System: Adjusting respect for bandit kill by %2 for %1",_aikiller_name,SAR_band_kill_value];
};
};
case 1: {
if (!isServer && !hasInterface) then {
diag_log format ["Sarge's AI System: Adjusting respect for bandit kill by %2 for %1",_aikiller,SAR_band_kill_value];
diag_log format ["Sarge's AI System: Adjusting respect for bandit kill by %2 for %1",_aikiller_name,SAR_band_kill_value];
};
};
};
}; */
if (isServer) then {
_playerRespect = _aikiller getVariable ["ExileScore", 0];
_playerMoney = _aikiller getVariable ["ExileMoney", 0];
_repChange = SAR_surv_kill_value / 10;
_playerRespect = _playerRespect + _repChange;
_aikiller setVariable ["ExileScore",_playerRespect];
_fragType = [[format ["%1 Kill",_ai_type],_repChange]];
[_aikiller, "showFragRequest", [_fragType]] call ExileServer_system_network_send_to;
ExileClientPlayerScore = _playerRespect;
(owner _aikiller) publicVariableClient "ExileClientPlayerScore";
ExileClientPlayerScore = nil;
format ["setAccountMoneyAndRespect:%1:%2:%3",_playerMoney ,_playerRespect ,getPlayerUID _aikiller] call ExileServer_system_database_query_fireAndForget;
if(SAR_log_AI_kills) then {
_hostileCount = profileNamespace getVariable["SAR_HOSTILE_KILLS",0];
_aikiller setVariable ["SAR_HOSTILE_KILLS",(_hostileCount + 1),true];
};
};
_playerRespect = _aikiller getVariable ["ExileScore", 0];
_playerMoney = _aikiller getVariable ["ExileMoney", 0];
_repChange = SAR_surv_kill_value / 10;
_playerRespect = _playerRespect + _repChange;
_aikiller setVariable ["ExileScore",_playerRespect];
_fragType = [[format ["%1 Kill",_ai_type],_repChange]];
[_aikiller, "showFragRequest", [_fragType]] call ExileServer_system_network_send_to;
ExileClientPlayerScore = _playerRespect;
(owner _aikiller) publicVariableClient "ExileClientPlayerScore";
ExileClientPlayerScore = nil;
format ["setAccountMoneyAndRespect:%1:%2:%3", _playerMoney, _playerRespect, _playerUID] call ExileServer_system_database_query_fireAndForget;
if(SAR_log_AI_kills) then {
_hostileCount = profileNamespace getVariable["SAR_HOSTILE_KILLS",0];
_aikiller setVariable ["SAR_HOSTILE_KILLS",(_hostileCount + 1),true];
};
if ((random 100) < 3) then {
_message = format["Sarge AI: Nice bandit kill %1!",_aikiller_name];
_message remoteExec ["systemChat",0];
} else {
if ((random 100) < 3) then {
_message = format["Sarge AI: Another bandit down ... %1 is going to be the root cause of bandit extinction :]",_aikiller_name];
if (!isServer && !hasInterface) then {
_message = format["Sarge AI: Nice bandit kill %1!",_aikiller_name];
_message remoteExec ["systemChat",0];
};
} else {
if ((random 100) < 3) then {
if (!isServer && !hasInterface) then {
_message = format["Sarge AI: Another bandit down ... %1 is going to be the root cause of bandit extinction :]",_aikiller_name];
_message remoteExec ["systemChat",0];
};
};
};
};

View File

@ -12,7 +12,7 @@
http://www.hod-servers.com
*/
PublicServerIsLoaded = false;
SAR_version = "2.1.0";
/* Debug & RPT Settings */

View File

@ -14,7 +14,7 @@
*/
private ["_ai","_sleeptime","_veh_weapons","_vehicle","_weapons","_reloadmag","_magazintypes","_legit_weapon","_weap_obj"];
if (elec_stop_exec == 1) exitWith {};
if (!isServer) exitWith {};
_ai = _this select 0;

View File

@ -160,7 +160,7 @@ if (_type == "static") then {
diag_log format["SAR_AI: Static Spawning for Helicopter patrols started"];
// define your static air patrols here
/*
//Heli Patrol NWAF
[SAR_marker_DEBUG_veh,1,true] call SAR_AI_heli;
@ -174,12 +174,12 @@ if (_type == "static") then {
// heli patrol east coast
[SAR_marker_DEBUG_veh,1,true] call SAR_AI_heli;
[SAR_marker_DEBUG_veh,1,true] call SAR_AI_heli;
*/
// example war scenario in the northwest. Comment OUT after having had a look at it!
[SAR_marker_DEBUG_veh,1,true,30] call SAR_AI_heli;
/* [SAR_marker_DEBUG_veh,1,true,30] call SAR_AI_heli;
[SAR_marker_DEBUG_veh,1,true,30] call SAR_AI_heli;
[SAR_marker_DEBUG_veh,3,true,30] call SAR_AI_heli;
[SAR_marker_DEBUG_veh,3,true,30] call SAR_AI_heli;
[SAR_marker_DEBUG_veh,3,true,30] call SAR_AI_heli; */
diag_log format["SAR_AI: Static Spawning for Helicopter patrols finished"];