mirror of
https://github.com/Teh-Dango/Sarge-AI.git
synced 2024-08-30 16:32:11 +00:00
2.1.6
Better HC code. Exp system update.
This commit is contained in:
parent
2417a0fd74
commit
b30249a8de
@ -1,74 +0,0 @@
|
||||
//=========================================================================================================
|
||||
// HEADLESS CLIENT AUTO DETECTOR by elec v 1.0b
|
||||
// needs Arma 2 OA beta v101032 or higher
|
||||
//
|
||||
// Copy the script in your mission folder and add this code in the !! FIRST !! line of your init.sqf:
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
// elec_HC_detect = ["auto"] execVM "elec_HC_detect.sqf"; waitUntil {scriptDone elec_HC_detect};
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// ========SWITCH========
|
||||
// Use "auto" to autodetect if a headless client is connected and force execution on it.
|
||||
// Use "on" to force the execution of your scripts on the HC, even he is not connected to the server.
|
||||
// (so your scripts won't execute if no HC is connected to the server)
|
||||
// Use "off" to force server execution.
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
// Replace your
|
||||
// --- if(!isserver)exitWith{}; ---
|
||||
// line with
|
||||
// --- if(elec_stop_exec == 1) exitWith{}; ---
|
||||
// in your scripts, that you want to execute on the HC.
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
//=========================================================================================================
|
||||
|
||||
// ----------------------DONT EDIT BELOW THIS LINE----------------------//
|
||||
elec_stop_exec = 0;
|
||||
elec_hc_connected = 0;
|
||||
_elec_hc_manual = _this select 0;
|
||||
|
||||
//Check if switch is set
|
||||
if ((_elec_hc_manual != "on") && (_elec_hc_manual != "off")) then {
|
||||
if (!(isServer) && !(hasInterface)) then {
|
||||
elec_hc_connected = 1;
|
||||
publicVariable "elec_hc_connected";
|
||||
} else {
|
||||
if (!isServer) then{
|
||||
elec_stop_exec = 1;
|
||||
};
|
||||
sleep 3;
|
||||
if(elec_hc_connected == 0) then {
|
||||
_elec_hc_manual = "off";
|
||||
} else {
|
||||
_elec_hc_manual = "on";
|
||||
};
|
||||
};
|
||||
|
||||
//IF SET TO "on"
|
||||
if (_elec_hc_manual == "on") then {
|
||||
if ((isServer) OR (hasInterface)) then{
|
||||
elec_stop_exec = 1;
|
||||
};
|
||||
};
|
||||
|
||||
//IF SET TO "off"
|
||||
if (_elec_hc_manual == "off") then {
|
||||
if (!isServer) then{
|
||||
elec_stop_exec = 1;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
//IF SET TO "on"
|
||||
if (_elec_hc_manual == "on") then {
|
||||
|
||||
if ((isServer) OR (hasInterface)) then{
|
||||
elec_stop_exec = 1;
|
||||
};
|
||||
};
|
||||
|
||||
//IF SET TO "off"
|
||||
if (_elec_hc_manual == "off") then {
|
||||
if (!isServer) then{
|
||||
elec_stop_exec = 1;
|
||||
};
|
||||
};
|
||||
};
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
private ["_timeout","_triggername","_tmparr","_markername","_valuearray","_grps_band","_grps_sold","_grps_surv","_trigger"];
|
||||
|
||||
if (elec_stop_exec == 1) exitWith {};
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
_timeout = SAR_DESPAWN_TIMEOUT;
|
||||
|
||||
|
@ -20,20 +20,26 @@ 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_trace = compile preprocessFileLineNumbers "sarge\SAR_trace_entities.sqf";
|
||||
SAR_AI_base_trace = compile preprocessFileLineNumbers "sarge\SAR_trace_base_entities.sqf";
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
call compile preprocessFileLineNumbers "sarge\SAR_config.sqf";
|
||||
|
||||
diag_log format["Sarge's AI System: Starting Sarge AI version %1",SAR_version];
|
||||
|
||||
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_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_trace_veh = compile preprocessFileLineNumbers "sarge\SAR_trace_from_vehicle.sqf";
|
||||
|
||||
SAR_AI_spawn = compile preprocessFileLineNumbers "sarge\SAR_AI_spawn.sqf";
|
||||
SAR_AI_Heli_spawn = compile preprocessFileLineNumbers "sarge\SAR_AI_Heli_spawn.sqf";
|
||||
SAR_AI_despawn = compile preprocessFileLineNumbers "sarge\SAR_AI_despawn.sqf";
|
||||
SAR_AI_reammo = compile preprocessFileLineNumbers "sarge\SAR_reammo_refuel_AI.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";
|
||||
@ -47,13 +53,14 @@ publicvariable "SAR_DEBUG";
|
||||
publicvariable "SAR_EXTREME_DEBUG";
|
||||
publicvariable "SAR_DETECT_HOSTILE";
|
||||
publicvariable "SAR_DETECT_INTERVAL";
|
||||
publicvariable "SAR_RESPECT_HOSTILE_LIMIT";
|
||||
publicvariable "SAR_HUMANITY_HOSTILE_LIMIT";
|
||||
|
||||
createCenter EAST;
|
||||
createCenter WEST;
|
||||
|
||||
// unfriendly AI bandits
|
||||
EAST setFriend [EAST, 1];
|
||||
EAST setFriend [CIVILIAN, 1];
|
||||
EAST setFriend [WEST, 0];
|
||||
EAST setFriend [RESISTANCE, 0];
|
||||
|
||||
@ -66,9 +73,8 @@ WEST setFriend [EAST, 0];
|
||||
WEST setFriend [RESISTANCE, 1];
|
||||
|
||||
// Lets hope this helps with the AI's view of object locality
|
||||
waituntil {PublicServerIsLoaded};
|
||||
|
||||
if (elec_stop_exec == 1) exitWith {};
|
||||
waituntil {(!isNil "PublicServerIsLoaded")};
|
||||
waituntil {(PublicServerIsLoaded)};
|
||||
|
||||
_worldname = toLower worldName;
|
||||
diag_log format["Sarge's AI System: Setting up SAR_AI for %1",_worldname];
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
private ["_snipers","_soldiers","_group","_check","_probability","_chance","_playerlist","_triggername","_tmparr","_markername","_player","_valuearray","_max_grps","_rnd_grps","_max_p_grp","_grps_band","_grps_sold","_grps_surv","_grps_upd","_respawn"];
|
||||
|
||||
if (elec_stop_exec == 1) exitWith {};
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
_playerlist = _this select 0;
|
||||
_triggername = _this select 1;
|
||||
@ -51,6 +51,8 @@ _grps_sold = _valuearray select 4;
|
||||
_grps_surv = _valuearray select 5;
|
||||
_grps_upd = [];
|
||||
|
||||
_grps_upd = _grps_band;
|
||||
|
||||
//for [{_i = (count _grps_band)},{_i < (_max_grps select 0)}, {_i=_i+1}] do
|
||||
for "_i" from (count _grps_band) to ((_max_grps select 0) - 1) do
|
||||
{
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
private ["_ai_veh_dmg","_ai_veh","_ai_veh_hitsource","_ai_veh_type","_ai_veh_side","_ai_veh_group_side","_ai_veh_hitsource_group_side","_ai_veh_hitsource_type","_ai_veh_hitsource_name","_ai_veh_hitsource_side","_clientmachine","_player_rating","_shot_veh","_ai_part","_ai_veh_projectile","_message"];
|
||||
|
||||
if (elec_stop_exec == 1) exitWith {};
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
_ai_veh = _this select 0;
|
||||
_ai_part = _this select 1;
|
||||
|
@ -12,9 +12,7 @@
|
||||
https://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"];
|
||||
|
||||
if (!isServer && hasInterface) exitWith {};
|
||||
private ["_ai","_aikiller","_aikilled_type","_aikilled_side","_aikilled_group_side","_aikiller_group_side","_aikiller_type","_aikiller_name","_aikiller_side","_respect","_message"];
|
||||
|
||||
_ai = _this select 0;
|
||||
_aikiller = _this select 1;
|
||||
@ -33,109 +31,52 @@ 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: {
|
||||
if (isServer) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: AI hit - %2 - Type: %1 Side: %3 Group Side: %4",_aikilled_type,_ai,_aikilled_side,_aikilled_group_side];
|
||||
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];
|
||||
};
|
||||
};
|
||||
case 1: {
|
||||
if (!isServer && !hasInterface) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: AI hit - %2 - Type: %1 Side: %3 Group Side: %4",_aikilled_type,_ai,_aikilled_side,_aikilled_group_side];
|
||||
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];
|
||||
};
|
||||
};
|
||||
};
|
||||
diag_log format["SAR_HITKILL_DEBUG: AI hit - %2 - Type: %1 Side: %3 Group Side: %4",_aikilled_type,_ai,_aikilled_side,_aikilled_group_side];
|
||||
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];
|
||||
};
|
||||
*/
|
||||
_playerUID = getPlayerUID _aikiller;
|
||||
|
||||
if ((!isNull _aikiller) && {(_playerUID != "") && {_aikiller isKindOf "Exile_Unit_Player"}}) then {
|
||||
if(isPlayer _aikiller) then {
|
||||
|
||||
if (_aikilled_group_side == SAR_AI_friendly_side) then { // hit a friendly AI
|
||||
|
||||
/* if (SAR_HITKILL_DEBUG) then {
|
||||
switch (elec_hc_connected) do {
|
||||
case 0: {
|
||||
if (isServer) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: friendly AI was hit by Player %1",_aikiller];
|
||||
};
|
||||
};
|
||||
case 1: {
|
||||
if (!isServer && !hasInterface) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: friendly AI was hit by Player %1",_aikiller];
|
||||
};
|
||||
};
|
||||
};
|
||||
}; */
|
||||
if (SAR_HITKILL_DEBUG) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: friendly AI was hit by Player %1",_aikiller];
|
||||
};
|
||||
|
||||
_playerRespect = _aikiller getVariable ["ExileScore", 0];
|
||||
_playerMoney = _aikiller getVariable ["ExileMoney", 0];
|
||||
|
||||
_repChange = SAR_surv_kill_value / 20;
|
||||
|
||||
_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 ((random 100) < 3) then {
|
||||
if (SAR_KILL_MSG) then {
|
||||
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];
|
||||
};
|
||||
};
|
||||
_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 (!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];
|
||||
};
|
||||
};
|
||||
_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) 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;
|
||||
if (SAR_HITKILL_DEBUG) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: Adjusting respect for survivor hit by %2 for %1",_aikiller,(SAR_surv_kill_value/10)];
|
||||
};
|
||||
|
||||
/* if (SAR_HITKILL_DEBUG) then {
|
||||
switch (elec_hc_connected) do {
|
||||
case 0: {
|
||||
if (isServer) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: Adjusting respect for survivor hit by %2 for %1",_aikiller,(SAR_surv_kill_value/10)];
|
||||
};
|
||||
};
|
||||
case 1: {
|
||||
if (!isServer && !hasInterface) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: Adjusting respect for survivor hit by %2 for %1",_aikiller,(SAR_surv_kill_value/10)];
|
||||
};
|
||||
};
|
||||
};
|
||||
}; */
|
||||
|
||||
if (rating _aikiller > -10000) then { //check if shooter is not already marked as enemy
|
||||
/* if (SAR_HITKILL_DEBUG) then {
|
||||
switch (elec_hc_connected) do {
|
||||
case 0: {
|
||||
if (isServer) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: Marking Player %1 as an enemy for a friendly AI hit!",_aikiller];
|
||||
};
|
||||
};
|
||||
case 1: {
|
||||
if (!isServer && !hasInterface) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: Marking Player %1 as an enemy for a friendly AI hit!",_aikiller];
|
||||
};
|
||||
};
|
||||
};
|
||||
}; */
|
||||
if (SAR_HITKILL_DEBUG) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: Marking Player %1 as an enemy for a friendly AI hit!",_aikiller];
|
||||
};
|
||||
_aikiller addRating -10000;
|
||||
};
|
||||
|
||||
@ -149,50 +90,26 @@ 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 {
|
||||
switch (elec_hc_connected) do {
|
||||
case 0: {
|
||||
if (isServer) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: unfriendly AI was hit by Player %1",_aikiller];
|
||||
};
|
||||
};
|
||||
case 1: {
|
||||
if (!isServer && !hasInterface) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: unfriendly AI was hit by Player %1",_aikiller];
|
||||
};
|
||||
};
|
||||
};
|
||||
}; */
|
||||
|
||||
if (isServer) then {
|
||||
_playerRespect = _aikiller getVariable ["ExileScore", 0];
|
||||
_playerMoney = _aikiller getVariable ["ExileMoney", 0];
|
||||
|
||||
_repChange = SAR_band_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 {
|
||||
diag_log format["SAR_HITKILL_DEBUG: unfriendly AI was hit by Player %1",_aikiller];
|
||||
};
|
||||
|
||||
/* if (SAR_HITKILL_DEBUG) then {
|
||||
switch (elec_hc_connected) do {
|
||||
case 0: {
|
||||
if (isServer) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: Adjusting respect for bandit hit by %2 for %1",_aikiller,(SAR_band_kill_value/10)];
|
||||
};
|
||||
};
|
||||
case 1: {
|
||||
if (!isServer && !hasInterface) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: Adjusting respect for bandit hit by %2 for %1",_aikiller,(SAR_band_kill_value/10)];
|
||||
};
|
||||
};
|
||||
};
|
||||
}; */
|
||||
if (SAR_HITKILL_DEBUG) then {
|
||||
diag_log format["SAR_HITKILL_DEBUG: Adjusting respect for bandit hit by %2 for %1",_aikiller,(SAR_band_kill_value/10)];
|
||||
};
|
||||
|
||||
_playerRespect = _aikiller getVariable ["ExileScore", 0];
|
||||
_playerMoney = _aikiller getVariable ["ExileMoney", 0];
|
||||
|
||||
_repChange = SAR_surv_kill_value / 20;
|
||||
|
||||
_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;
|
||||
};
|
||||
};
|
||||
|
@ -12,9 +12,9 @@
|
||||
https://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","_ai_xp_type"];
|
||||
|
||||
if (!isServer && hasInterface) exitWith {};
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
_ai = _this select 0;
|
||||
_aikiller = _this select 1;
|
||||
@ -31,154 +31,195 @@ if (!(_aikiller_type in SAR_heli_type) && !("LandVehicle" countType [vehicle _ai
|
||||
_aikiller_name = _aikiller_type;
|
||||
};
|
||||
|
||||
_aikiller_side = side _aikiller;
|
||||
_aikiller_group_side = side (group _aikiller);
|
||||
_ai_type = _ai getVariable ["SAR_AI_type",""];
|
||||
_ai_killer_type = _aikiller getVariable ["SAR_AI_type",""];
|
||||
_aikiller_side = side _aikiller;
|
||||
_aikiller_group_side = side (group _aikiller);
|
||||
|
||||
// retrieve AI type from the killed AI
|
||||
_ai_type = _ai getVariable ["SAR_AI_type",""];
|
||||
|
||||
// retrieve AI type from the killer AI
|
||||
_ai_killer_type = _aikiller getVariable ["SAR_AI_type",""];
|
||||
|
||||
// retrieve experience value from the killed AI
|
||||
_ai_xp = _ai getVariable["SAR_AI_experience",0];
|
||||
|
||||
// retrieve experience value from the killing AI
|
||||
_ai_killer_xp = _aikiller getVariable["SAR_AI_experience",0];
|
||||
|
||||
if (_ai_xp < SAR_AI_XP_LVL_2) then {
|
||||
_ai_xp_type = SAR_AI_XP_NAME_1;
|
||||
};
|
||||
if (_ai_xp >= SAR_AI_XP_LVL_2 && _ai_xp < SAR_AI_XP_LVL_3) then {
|
||||
_ai_xp_type = SAR_AI_XP_NAME_2;
|
||||
};
|
||||
if (_ai_xp >= SAR_AI_XP_LVL_3) then {
|
||||
_ai_xp_type = SAR_AI_XP_NAME_3;
|
||||
};
|
||||
|
||||
if (_ai_killer_xp < SAR_AI_XP_LVL_2) then {
|
||||
_ai_killer_xp_type = SAR_AI_XP_NAME_1;
|
||||
};
|
||||
if (_ai_killer_xp >= SAR_AI_XP_LVL_2 && _ai_killer_xp < SAR_AI_XP_LVL_3) then {
|
||||
_ai_killer_xp_type = SAR_AI_XP_NAME_2;
|
||||
};
|
||||
if (_ai_killer_xp >= SAR_AI_XP_LVL_3) then {
|
||||
_ai_killer_xp_type = SAR_AI_XP_NAME_3;
|
||||
};
|
||||
|
||||
diag_log format ["Sarge AI System: _ai_xp = %1; _ai_xp_type = %2",_ai_xp,_ai_xp_type];
|
||||
|
||||
if (SAR_KILL_MSG) then {
|
||||
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 (isPlayer _aikiller) then {
|
||||
_message = format["Sarge AI: A %3 %2 was killed by Player: %1",_aikiller_name,_ai_type,_ai_xp_type];
|
||||
_message remoteExec ["systemChat",0];
|
||||
};
|
||||
if (_ai_xp >= SAR_AI_XP_LVL_2) then {
|
||||
_message = format["Sarge AI: A %3 %2 was killed by a %3 %4!",_ai_xp_type,_ai_type,_ai_killer_xp_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];
|
||||
};
|
||||
};
|
||||
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 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];
|
||||
};
|
||||
*/
|
||||
_playerUID = getPlayerUID _aikiller;
|
||||
|
||||
if ((!isNull _aikiller) && {(_playerUID != "") && {_aikiller isKindOf "Exile_Unit_Player"}}) then {
|
||||
|
||||
if (isPlayer _aikiller) then {
|
||||
if (_aikilled_group_side == SAR_AI_friendly_side) 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_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_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];
|
||||
};
|
||||
if (SAR_HITKILL_DEBUG) then {
|
||||
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 (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 ,getPlayerUID _aikiller] call ExileServer_system_database_query_fireAndForget;
|
||||
|
||||
if ((random 100) < 3) then {
|
||||
if (!isServer && !hasInterface) then {
|
||||
_message = format["Sarge AI: %1 killed a friendly AI - sending reinforcements!",_aikiller_name];
|
||||
_message remoteExec ["systemChat",0];
|
||||
};
|
||||
_message = format["Sarge AI: %1 killed a friendly AI - sending reinforcements!",_aikiller_name];
|
||||
_message remoteExec ["systemChat",0];
|
||||
} else {
|
||||
if ((random 100) < 3) then {
|
||||
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];
|
||||
};
|
||||
_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 {
|
||||
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_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_name,SAR_band_kill_value];
|
||||
};
|
||||
};
|
||||
};
|
||||
}; */
|
||||
|
||||
if (isServer) then {
|
||||
_playerRespect = _aikiller getVariable ["ExileScore", 0];
|
||||
_playerMoney = _aikiller getVariable ["ExileMoney", 0];
|
||||
|
||||
_repChange = SAR_band_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];
|
||||
};
|
||||
if (SAR_HITKILL_DEBUG) then {
|
||||
diag_log format ["Sarge's AI System: Adjusting respect for bandit kill by %2 for %1",_aikiller_name,SAR_band_kill_value];
|
||||
};
|
||||
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 ,getPlayerUID _aikiller] call ExileServer_system_database_query_fireAndForget;
|
||||
|
||||
if ((random 100) < 3) then {
|
||||
if (!isServer && !hasInterface) then {
|
||||
_message = format["Sarge AI: Nice bandit kill %1!",_aikiller_name];
|
||||
_message remoteExec ["systemChat",0];
|
||||
};
|
||||
_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];
|
||||
};
|
||||
_message = format["Sarge AI: Another bandit down ... %1 is going to be the root cause of bandit extinction :]",_aikiller_name];
|
||||
_message remoteExec ["systemChat",0];
|
||||
};
|
||||
};
|
||||
};
|
||||
} else {
|
||||
if(SAR_AI_XP_SYSTEM) then {
|
||||
|
||||
if(!isNull _aikiller) then { // check if AI was killed by an AI, and not driven over / fallen to death etc
|
||||
|
||||
// get xp from the victim
|
||||
_xp_gain = _ai_xp;
|
||||
|
||||
if(_xp_gain == 0) then {
|
||||
_xp_gain=1;
|
||||
};
|
||||
|
||||
// get old xp
|
||||
_ai_killer_xp = _aikiller getVariable ["SAR_AI_experience",0];
|
||||
|
||||
// calculate new xp
|
||||
_ai_killer_xp_new = _ai_killer_xp + _xp_gain;
|
||||
|
||||
if(_ai_killer_xp < SAR_AI_XP_LVL_3) then {
|
||||
|
||||
if(_ai_killer_xp < SAR_AI_XP_LVL_2 && _ai_killer_xp_new >= SAR_AI_XP_LVL_2 ) then { // from level 1 to level 2
|
||||
|
||||
if(SAR_SHOW_XP_LVL) then { diag_log format["Level up from 1 -> 2 for %1",_aikiller];};
|
||||
|
||||
_message = format["Sarge AI: A %1 %2 was promoted!",_ai_killer_xp_type,_ai_killer_type];
|
||||
_message remoteExec ["systemChat",0];
|
||||
|
||||
// restore health to full
|
||||
_aikiller setDamage 0;
|
||||
|
||||
// upgrades for the next level
|
||||
// medium armor
|
||||
_aikiller removeEventHandler ["HandleDamage",0];
|
||||
_aikiller addEventHandler ["HandleDamage",{if (_this select 1!="") then {_unit=_this select 0;damage _unit+((_this select 2)-damage _unit)*SAR_AI_XP_ARMOR_2}}];
|
||||
};
|
||||
|
||||
if(_ai_killer_xp < SAR_AI_XP_LVL_3 && _ai_killer_xp_new >= SAR_AI_XP_LVL_3 ) then { // from level 2 to level 3
|
||||
|
||||
if(SAR_SHOW_XP_LVL) then { diag_log format["Level up from 2 -> 3 for %1",_aikiller];};
|
||||
|
||||
_message = format["Sarge AI: A %1 %2 was promoted!",_ai_killer_xp_type,_ai_killer_type];
|
||||
_message remoteExec ["systemChat",0];
|
||||
|
||||
|
||||
// restore health to full
|
||||
_aikiller setDamage 0;
|
||||
|
||||
// upgrades for the next level
|
||||
// highest armor
|
||||
_aikiller removeEventHandler ["HandleDamage",0];
|
||||
_aikiller addEventHandler ["HandleDamage",{if (_this select 1!="") then {_unit=_this select 0;damage _unit+((_this select 2)-damage _unit)*SAR_AI_XP_ARMOR_3}}];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
//diag_log format["Start XP: %1, End XP: %2",_ai_killer_xp,_ai_killer_xp+_xp_gain];
|
||||
|
||||
// set new xp value for AI that killed the other AI
|
||||
_ai_killer_xp = _ai_killer_xp + _xp_gain;
|
||||
_aikiller setVariable["SAR_AI_experience",_ai_killer_xp];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -12,20 +12,22 @@
|
||||
https://www.hod-servers.com
|
||||
|
||||
*/
|
||||
PublicServerIsLoaded = false;
|
||||
SAR_version = "2.1.0";
|
||||
|
||||
SAR_HC = true;
|
||||
|
||||
/* Debug & RPT Settings */
|
||||
SAR_DEBUG = true; // Set to true for RPT info on AI
|
||||
SAR_EXTREME_DEBUG = false; // Set to true for RPT info on damn near everything
|
||||
SAR_HITKILL_DEBUG = true; // Set to true for RPT info on AI shooting and killing
|
||||
SAR_log_AI_kills = true; // Set to true for kill logging by variable. *These variables do not save to the database currently*
|
||||
SAR_KILL_MSG = true; // Set to true for announcing AI kills to the server *This is still in development*
|
||||
SAR_KILL_MSG = true; // Set to true for announcing AI kills to the server
|
||||
|
||||
/* Dynamic AI Settings */
|
||||
SAR_dynamic_spawning = true; // Turn dynamic grid spawns on or off
|
||||
SAR_Base_Gaurds = true; // Turn AI territory gurads on or off
|
||||
SAR_dynamic_group_respawn = true; // Turn dynamic grid AI respawn on or off
|
||||
SAR_dynamic_heli_respawn = true; // Turn dynamic grid AI respawn on or off
|
||||
SAR_AI_COMBAT_VEHICLE = false; // Turn the option for AI using vehicles when in combat on or off
|
||||
SAR_AI_STEAL_VEHICLE = false; // Turn the option for AI using vehicles to reach their destination on or off
|
||||
SAR_AI_disable_UPSMON_AI = false; // Turning this off could have unintended consequences
|
||||
@ -44,13 +46,148 @@ SAR_DETECT_FROM_VEHICLE_INTERVAL = 5; // How often AI can detect hostile AI &
|
||||
SAR_chance_bandits = 75; // Chance to spawn 1-100%
|
||||
SAR_chance_soldiers = 25; // Chance to spawn 1-100%
|
||||
SAR_chance_survivors = 50; // Chance to spawn 1-100%
|
||||
SAR_max_grps_bandits = 2; // Total groups per grid
|
||||
SAR_max_grps_bandits = 4; // Total groups per grid
|
||||
SAR_max_grps_soldiers = 2; // Total groups per grid
|
||||
SAR_max_grps_survivors = 2; // Total groups per grid
|
||||
SAR_max_grpsize_bandits = 2; // Size of the group
|
||||
SAR_max_grpsize_soldiers = 2; // Size of the group
|
||||
SAR_max_grpsize_survivors = 2; // Size of the group
|
||||
|
||||
SAR_chance_band_heli = 35;
|
||||
SAR_chance_surv_heli = 35;
|
||||
SAR_chance_mili_heli = 35;
|
||||
|
||||
SAR_Blacklist = ["TraderZoneSebjan","NorthernBoatTrader","SouthernBoatTrader"];
|
||||
|
||||
SAR_AI_XP_SYSTEM = true; // Turn this feature on or off
|
||||
SAR_AI_XP_LVL_1 = 0; // xp needed to reach this level
|
||||
SAR_AI_XP_NAME_1 = "Rookie"; // name of the level range
|
||||
SAR_AI_XP_ARMOR_1 = 1; // armor value for this level - values: 0.1 - 1, 1 = no change, 0.5 = damage taken reduced by 50%, 0.1 = damage taken reduced by 90%
|
||||
|
||||
SAR_AI_XP_LVL_2 = 5;
|
||||
SAR_AI_XP_NAME_2 = "Veteran";
|
||||
SAR_AI_XP_ARMOR_2 = 0.5;
|
||||
|
||||
SAR_AI_XP_LVL_3 = 20;
|
||||
SAR_AI_XP_NAME_3 = "Legendary";
|
||||
SAR_AI_XP_ARMOR_3 = 0.3;
|
||||
|
||||
|
||||
// military AI
|
||||
SAR_leader_sold_skills = [
|
||||
["aimingAccuracy",0.35, 0.10], // skilltype, <min value>, <random value added to min>;
|
||||
["aimingShake", 0.35, 0.10],
|
||||
["aimingSpeed", 0.80, 0.20],
|
||||
["spotDistance", 0.70, 0.30],
|
||||
["spotTime", 0.65, 0.20],
|
||||
["endurance", 0.80, 0.20],
|
||||
["courage", 0.80, 0.20],
|
||||
["reloadSpeed", 0.80, 0.20],
|
||||
["commanding", 0.80, 0.20],
|
||||
["general", 0.80, 0.20]
|
||||
];
|
||||
SAR_soldier_sold_skills = [
|
||||
["aimingAccuracy",0.25, 0.10], // skilltype, <min value>, <random value added to min>;
|
||||
["aimingShake", 0.25, 0.10],
|
||||
["aimingSpeed", 0.70, 0.20],
|
||||
["spotDistance", 0.55, 0.30],
|
||||
["spotTime", 0.30, 0.20],
|
||||
["endurance", 0.60, 0.20],
|
||||
["courage", 0.60, 0.20],
|
||||
["reloadSpeed", 0.60, 0.20],
|
||||
["commanding", 0.60, 0.20],
|
||||
["general", 0.60, 0.20]
|
||||
|
||||
];
|
||||
SAR_sniper_sold_skills = [
|
||||
["aimingAccuracy",0.80, 0.10], // skilltype, <min value>, <random value added to min>;
|
||||
["aimingShake", 0.90, 0.10],
|
||||
["aimingSpeed", 0.70, 0.20],
|
||||
["spotDistance", 0.70, 0.30],
|
||||
["spotTime", 0.75, 0.20],
|
||||
["endurance", 0.70, 0.20],
|
||||
["courage", 0.70, 0.20],
|
||||
["reloadSpeed", 0.70, 0.20],
|
||||
["commanding", 0.70, 0.20],
|
||||
["general", 0.70, 0.20]
|
||||
];
|
||||
|
||||
// bandit AI
|
||||
SAR_leader_band_skills = [
|
||||
["aimingAccuracy",0.35, 0.10], // skilltype, <min value>, <random value added to min>;
|
||||
["aimingShake", 0.35, 0.10],
|
||||
["aimingSpeed", 0.60, 0.20],
|
||||
["spotDistance", 0.40, 0.30],
|
||||
["spotTime", 0.45, 0.20],
|
||||
["endurance", 0.40, 0.20],
|
||||
["courage", 0.50, 0.20],
|
||||
["reloadSpeed", 0.60, 0.20],
|
||||
["commanding", 0.50, 0.20],
|
||||
["general", 0.50, 0.20]
|
||||
];
|
||||
SAR_soldier_band_skills = [
|
||||
["aimingAccuracy",0.15, 0.10], // skilltype, <min value>, <random value added to min>;
|
||||
["aimingShake", 0.15, 0.10],
|
||||
["aimingSpeed", 0.60, 0.20],
|
||||
["spotDistance", 0.40, 0.20],
|
||||
["spotTime", 0.40, 0.20],
|
||||
["endurance", 0.40, 0.20],
|
||||
["courage", 0.40, 0.20],
|
||||
["reloadSpeed", 0.40, 0.20],
|
||||
["commanding", 0.40, 0.20],
|
||||
["general", 0.40, 0.20]
|
||||
];
|
||||
SAR_sniper_band_skills = [
|
||||
["aimingAccuracy",0.70, 0.10], // skilltype, <min value>, <random value added to min>;
|
||||
["aimingShake", 0.80, 0.10],
|
||||
["aimingSpeed", 0.70, 0.20],
|
||||
["spotDistance", 0.90, 0.10],
|
||||
["spotTime", 0.55, 0.20],
|
||||
["endurance", 0.70, 0.20],
|
||||
["courage", 0.70, 0.20],
|
||||
["reloadSpeed", 0.70, 0.20],
|
||||
["commanding", 0.50, 0.20],
|
||||
["general", 0.60, 0.20]
|
||||
];
|
||||
|
||||
// survivor AI
|
||||
SAR_leader_surv_skills = [
|
||||
["aimingAccuracy",0.35, 0.10], // skilltype, <min value>, <random value added to min>;
|
||||
["aimingShake", 0.35, 0.10],
|
||||
["aimingSpeed", 0.60, 0.20],
|
||||
["spotDistance", 0.40, 0.30],
|
||||
["spotTime", 0.45, 0.20],
|
||||
["endurance", 0.40, 0.20],
|
||||
["courage", 0.50, 0.20],
|
||||
["reloadSpeed", 0.60, 0.20],
|
||||
["commanding", 0.50, 0.20],
|
||||
["general", 0.50, 0.20]
|
||||
];
|
||||
SAR_soldier_surv_skills = [
|
||||
["aimingAccuracy",0.15, 0.10], // skilltype, <min value>, <random value added to min>;
|
||||
["aimingShake", 0.15, 0.10],
|
||||
["aimingSpeed", 0.60, 0.20],
|
||||
["spotDistance", 0.45, 0.30],
|
||||
["spotTime", 0.20, 0.20],
|
||||
["endurance", 0.40, 0.20],
|
||||
["courage", 0.40, 0.20],
|
||||
["reloadSpeed", 0.40, 0.20],
|
||||
["commanding", 0.40, 0.20],
|
||||
["general", 0.40, 0.20]
|
||||
];
|
||||
SAR_sniper_surv_skills = [
|
||||
["aimingAccuracy",0.70, 0.10], // skilltype, <min value>, <random value added to min>;
|
||||
["aimingShake", 0.80, 0.10],
|
||||
["aimingSpeed", 0.70, 0.20],
|
||||
["spotDistance", 0.70, 0.30],
|
||||
["spotTime", 0.65, 0.20],
|
||||
["endurance", 0.70, 0.20],
|
||||
["courage", 0.70, 0.20],
|
||||
["reloadSpeed", 0.70, 0.20],
|
||||
["commanding", 0.50, 0.20],
|
||||
["general", 0.60, 0.20]
|
||||
];
|
||||
|
||||
// Military AI ----------------------------------------------------------
|
||||
// ----------------------------------------------------------------------
|
||||
SAR_leader_sold_list = ["B_officer_F"];
|
||||
@ -132,8 +269,7 @@ SAR_heli_type = ["B_Heli_Light_01_stripped_F"];
|
||||
/* -------------------------------- Do Not Edit Below. If you do the AI will not work properly. -------------------------------- */
|
||||
/* -------------------------------- Do Not Edit Below. If you do the AI will not work properly. -------------------------------- */
|
||||
/* -------------------------------- Do Not Edit Below. If you do the AI will not work properly. -------------------------------- */
|
||||
SAR_HC = false;
|
||||
//SAR_HC = false // Depreciated
|
||||
SAR_AI_friendly_side = RESISTANCE;
|
||||
SAR_AI_unfriendly_side = EAST;
|
||||
SAR_leader_number = 0;
|
||||
SAR_AI_monitor = [];
|
@ -12,103 +12,6 @@
|
||||
https://www.hod-servers.com
|
||||
|
||||
*/
|
||||
SAR_get_road_pos = {
|
||||
/*
|
||||
Parameters:
|
||||
_areaname = the markername where the position should be choosen
|
||||
*/
|
||||
private ["_targetPosTemp","_newpos","_loop2","_tries2","_roads","_area_name","_centerpos","_centerX","_centerY","_areasize","_rangeX","_rangeY","_areadir","_cosdir","_sindir"];
|
||||
|
||||
_area_name = _this select 0;
|
||||
|
||||
// remember center position of area marker
|
||||
_centerpos = getMarkerPos _area_name;
|
||||
_centerX = abs(_centerpos select 0);
|
||||
_centerY = abs(_centerpos select 1);
|
||||
|
||||
// X/Y range of target area
|
||||
_areasize = getMarkerSize _area_name;
|
||||
_rangeX = _areasize select 0;
|
||||
_rangeY = _areasize select 1;
|
||||
|
||||
// marker orientation (needed as negative value!)
|
||||
_areadir = (markerDir _area_name) * -1;
|
||||
|
||||
// store some trig calculations
|
||||
_cosdir=cos(_areadir);
|
||||
_sindir=sin(_areadir);
|
||||
|
||||
_tries2=0;
|
||||
_loop2 = false;
|
||||
|
||||
while {(!_loop2) && (_tries2 <100)} do {
|
||||
_tries2=_tries2pushBack1;
|
||||
_targetPosTemp = [_centerX,_centerY,_rangeX,_rangeY,_cosdir,_sindir,_areadir] call KRON_randomPos;
|
||||
_roads = (_targetPosTemp nearRoads 50);
|
||||
if ((count _roads) > 0) then {
|
||||
_targetPosTemp = getpos (_roads select 0);
|
||||
_newpos = _targetPosTemp;
|
||||
_loop2 = TRUE;
|
||||
};
|
||||
sleep 0.05;
|
||||
};
|
||||
_newpos;
|
||||
};
|
||||
|
||||
SAR_break_circle = {
|
||||
/*
|
||||
Parameters:
|
||||
_group = the group
|
||||
*/
|
||||
private ["_group"];
|
||||
|
||||
_group = _this select 0;
|
||||
_group setBehaviour "AWARE";
|
||||
{
|
||||
_x enableAI "TARGET";
|
||||
_x forceSpeed 1;
|
||||
} foreach units _group;
|
||||
};
|
||||
|
||||
SAR_move_to_circle_pos = {
|
||||
//Parameters:
|
||||
//_unit = the unit to move
|
||||
//_newpos = the position the unit should move to
|
||||
private ["_unit","_centerpos","_newpos","_viewangle","_defend"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_centerpos = _this select 1;
|
||||
_newpos = _this select 2;
|
||||
_viewangle = _this select 3;
|
||||
_defend = _this select 4;
|
||||
|
||||
_unit forceSpeed 1;
|
||||
|
||||
_unit moveTo _newpos;
|
||||
_unit doMove _newpos;
|
||||
|
||||
waituntil {moveToCompleted _unit};
|
||||
_unit forceSpeed 0;
|
||||
|
||||
//_unit doWatch (_veh modelToWorld [(sin (_foreachindex * _angle))*SAR_sit_radius, (cos (_foreachindex * _angle))*SAR_sit_radius, 0]);
|
||||
//_unit doWatch _veh;
|
||||
|
||||
//diag_log format["Unit: %1 Angle to look at: %2",_unit,_viewangle];
|
||||
|
||||
_unit setDir _viewangle;
|
||||
_unit setpos getPos _unit;
|
||||
|
||||
if(!_defend) then {
|
||||
_unit playActionNow "SitDown";
|
||||
sleep 1;
|
||||
} else{
|
||||
_unit setUnitPos "Middle";
|
||||
sleep 1;
|
||||
};
|
||||
|
||||
_unit disableAI "TARGET";
|
||||
//_unit disableAI "FSM";
|
||||
};
|
||||
|
||||
SAR_circle_static = {
|
||||
//Parameters:
|
||||
@ -210,26 +113,6 @@ SAR_isKindOf_weapon = {
|
||||
_found;
|
||||
};
|
||||
|
||||
SAR_AI_is_unfriendly_group = {
|
||||
// parameters
|
||||
// _trig_player_list = list of players in the trigger array
|
||||
|
||||
private ["_trig_player_list","_bandits_in_trigger","_player_respect"];
|
||||
|
||||
_trig_player_list = _this select 0;
|
||||
|
||||
_bandits_in_trigger = false;
|
||||
{
|
||||
_player_respect = _x getVariable ["ExileScore",0];
|
||||
|
||||
if(_player_respect < SAR_RESPECT_HOSTILE_LIMIT) then {
|
||||
_bandits_in_trigger = true;
|
||||
};
|
||||
} foreach _trig_player_list;
|
||||
|
||||
_bandits_in_trigger;
|
||||
};
|
||||
|
||||
SAR_unit_loadout_tools = {
|
||||
// Parameters:
|
||||
// _unittype (leader, soldier, sniper)
|
||||
@ -327,15 +210,11 @@ SAR_unit_loadout = {
|
||||
_tools = _this select 3;
|
||||
|
||||
removeAllWeapons _unit;
|
||||
removeAllItems _unit;
|
||||
removeAllAssignedItems _unit;
|
||||
removeAllItems _unit;
|
||||
removeBackpack _unit;
|
||||
removeGoggles _unit;
|
||||
removeVest _unit;
|
||||
if (_unit isKindOf "O_G_Soldier_lite_F") then {removeHeadgear _unit; sleep 1; _unit addHeadGear "H_Shemag_olive";};
|
||||
|
||||
_unit enableFatigue false;
|
||||
_unit allowDamage true;
|
||||
|
||||
{
|
||||
_weapon = _weapons select _forEachIndex;
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
private["_sizeX","_sizeY","_snipers","_rifleMen","_sizeOfBase","_marker","_markername","_tMark","_flagPoles","_baseLevel","_baseName"];
|
||||
|
||||
if (elec_stop_exec == 1) exitWith {};
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
_flagPoles = nearestObjects [getArray (configFile >> "CfgWorlds" >> worldName >> "centerPosition"), ["Exile_Construction_Flag_Static"], 25000];
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
private ["_leadername","_type","_patrol_area_name","_grouptype","_snipers","_riflemen","_action","_side","_leaderList","_riflemenlist","_sniperlist","_rndpos","_group","_leader","_cond","_respawn","_leader_weapon_names","_leader_items","_leader_tools","_soldier_weapon_names","_soldier_items","_soldier_tools","_sniper_weapon_names","_sniper_items","_sniper_tools","_leaderskills","_riflemanskills","_sniperskills","_ups_para_list","_respawn_time","_argc","_ai_type"];
|
||||
|
||||
if (elec_stop_exec == 1) exitWith {};
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
_patrol_area_name = _this select 0;
|
||||
_grouptype = _this select 1;
|
||||
@ -53,10 +53,10 @@ switch (_grouptype) do
|
||||
};
|
||||
|
||||
_leaderList = call compile format ["SAR_leader_%1_list", _type];
|
||||
//_leaderskills = call compile format ["SAR_leader_%1_skills", _type];
|
||||
_leaderskills = call compile format ["SAR_leader_%1_skills", _type];
|
||||
|
||||
// get a random starting position that is on land
|
||||
_rndpos = [_patrol_area_name] call UPSMON_pos;
|
||||
_rndpos = [_patrol_area_name,0,SAR_Blacklist] call UPSMON_pos;
|
||||
|
||||
_group = createGroup _side;
|
||||
|
||||
@ -69,6 +69,8 @@ _leader_tools = ["leader",_type] call SAR_unit_loadout_tools;
|
||||
|
||||
[_leader,_leader_weapon_names,_leader_items,_leader_tools] call SAR_unit_loadout;
|
||||
|
||||
if (_side == SAR_AI_unfriendly_side) then {removeHeadgear _leader; _leader addHeadGear (["H_Shemag_olive","H_Shemag_olive_hs","H_ShemagOpen_khk","H_ShemagOpen_tan"] call BIS_fnc_selectRandom);};
|
||||
|
||||
[_leader] spawn SAR_AI_trace;
|
||||
_leader setIdentity "id_SAR_sold_lead";
|
||||
[_leader] spawn SAR_AI_reammo;
|
||||
@ -76,33 +78,26 @@ _leader setIdentity "id_SAR_sold_lead";
|
||||
_leader addMPEventHandler ["MPkilled", {Null = _this spawn SAR_AI_killed;}];
|
||||
_leader addMPEventHandler ["MPHit", {Null = _this spawn SAR_AI_hit;}];
|
||||
|
||||
[_leader] joinSilent _group;
|
||||
/*
|
||||
[_leader] join _group;
|
||||
|
||||
// set skills of the leader
|
||||
{
|
||||
_leader setskill [_x select 0,(_x select 1 +(floor(random 2) * (_x select 2)))];
|
||||
} foreach _leaderskills;
|
||||
|
||||
// define and store the leadername
|
||||
SAR_leader_number = SAR_leader_number + 1;
|
||||
_leadername = format ["SAR_leader_%1",SAR_leader_number];
|
||||
|
||||
_leader setVehicleVarname _leadername;
|
||||
_leader setVariable ["SAR_leader_name",_leadername,false];
|
||||
*/
|
||||
// store AI type on the AI
|
||||
_leader setVariable ["SAR_AI_type",_ai_type + " Leader",false];
|
||||
/*
|
||||
|
||||
// store experience value on AI
|
||||
_leader setVariable ["SAR_AI_experience",0,false];
|
||||
|
||||
// set behaviour & speedmode
|
||||
_leader setspeedmode "FULL";
|
||||
_leader setBehaviour "AWARE";
|
||||
|
||||
// if needed broadcast to the clients **I believe the new UPSMON does this already
|
||||
//_leader Call Compile Format ["%1=_This ; PublicVariable ""%1""",_leadername];
|
||||
*/
|
||||
// Establish siper unit type and skills
|
||||
_sniperlist = call compile format ["SAR_sniper_%1_list", _type];
|
||||
//_sniperskills = call compile format ["SAR_sniper_%1_skills", _type];
|
||||
_sniperskills = call compile format ["SAR_sniper_%1_skills", _type];
|
||||
|
||||
// create crew
|
||||
for "_i" from 0 to (_snipers - 1) do
|
||||
@ -115,6 +110,8 @@ for "_i" from 0 to (_snipers - 1) do
|
||||
|
||||
[_this,_sniper_weapon_names,_sniper_items,_sniper_tools] call SAR_unit_loadout;
|
||||
|
||||
if (_side == SAR_AI_unfriendly_side) then {removeHeadgear _this; _this addHeadGear (["H_Shemag_olive","H_Shemag_olive_hs","H_ShemagOpen_khk","H_ShemagOpen_tan"] call BIS_fnc_selectRandom);};
|
||||
|
||||
[_this] spawn SAR_AI_trace;
|
||||
_this setIdentity "id_SAR";
|
||||
[_this] spawn SAR_AI_reammo;
|
||||
@ -122,20 +119,23 @@ for "_i" from 0 to (_snipers - 1) do
|
||||
_this addMPEventHandler ["MPkilled", {Null = _this spawn SAR_AI_killed;}];
|
||||
_this addMPEventHandler ["MPHit", {Null = _this spawn SAR_AI_hit;}];
|
||||
|
||||
[_this] joinSilent _group;
|
||||
/*
|
||||
[_this] join _group;
|
||||
|
||||
// set skills
|
||||
{
|
||||
_this setskill [_x select 0,(_x select 1 +(floor(random 2) * (_x select 2)))];
|
||||
} foreach _sniperskills;
|
||||
*/
|
||||
|
||||
// store AI type on the AI
|
||||
_this setVariable ["SAR_AI_type",_ai_type,false];
|
||||
|
||||
// store experience value on AI
|
||||
_this setVariable ["SAR_AI_experience",0,false];
|
||||
};
|
||||
|
||||
// Establish rifleman unit type and skills
|
||||
_riflemenlist = call compile format ["SAR_soldier_%1_list", _type];
|
||||
//_riflemanskills = call compile format ["SAR_soldier_%1_skills", _type];
|
||||
_riflemanskills = call compile format ["SAR_soldier_%1_skills", _type];
|
||||
|
||||
for "_i" from 0 to (_riflemen - 1) do
|
||||
{
|
||||
@ -147,6 +147,8 @@ for "_i" from 0 to (_riflemen - 1) do
|
||||
|
||||
[_this,_soldier_weapon_names,_soldier_items,_soldier_tools] call SAR_unit_loadout;
|
||||
|
||||
if (_side == SAR_AI_unfriendly_side) then {removeHeadgear _this; _this addHeadGear (["H_Shemag_olive","H_Shemag_olive_hs","H_ShemagOpen_khk","H_ShemagOpen_tan"] call BIS_fnc_selectRandom);};
|
||||
|
||||
[_this] spawn SAR_AI_trace;
|
||||
_this setIdentity "id_SAR_sold_man";
|
||||
[_this] spawn SAR_AI_reammo;
|
||||
@ -154,15 +156,18 @@ for "_i" from 0 to (_riflemen - 1) do
|
||||
_this addMPEventHandler ["MPkilled", {Null = _this spawn SAR_AI_killed;}];
|
||||
_this addMPEventHandler ["MPHit", {Null = _this spawn SAR_AI_hit;}];
|
||||
|
||||
[_this] joinSilent _group;
|
||||
/*
|
||||
[_this] join _group;
|
||||
|
||||
// set skills
|
||||
{
|
||||
_this setskill [_x select 0,(_x select 1 +(floor(random 2) * (_x select 2)))];
|
||||
} foreach _riflemanskills;
|
||||
*/
|
||||
|
||||
// store AI type on the AI
|
||||
_this setVariable ["SAR_AI_type",_ai_type,false];
|
||||
|
||||
// store experience value on AI
|
||||
_this setVariable ["SAR_AI_experience",0,false];
|
||||
};
|
||||
|
||||
// initialize upsmon for the group
|
||||
@ -174,10 +179,10 @@ if (_respawn) then {
|
||||
_ups_para_list pushBack [_respawn_time];
|
||||
};
|
||||
|
||||
if !(SAR_AI_STEAL_VEHICLE) then {
|
||||
if (!SAR_AI_STEAL_VEHICLE) then {
|
||||
_ups_para_list pushBack ['NOVEH'];
|
||||
};
|
||||
if !(SAR_AI_COMBAT_VEHICLE) then {
|
||||
if (!SAR_AI_COMBAT_VEHICLE) then {
|
||||
_ups_para_list pushBack ['NOVEH2'];
|
||||
};
|
||||
|
||||
@ -212,6 +217,10 @@ switch (_action) do {
|
||||
};
|
||||
};
|
||||
|
||||
if (SAR_DEBUG) then {
|
||||
diag_log format ["Sarge's AI System: Infantry group (%3) spawned in: %1 with action: %2 on side: %4",_patrol_area_name,_action,_group,(side _group)];
|
||||
};
|
||||
|
||||
if (SAR_HC) then {
|
||||
{
|
||||
_hcID = getPlayerUID _x;
|
||||
@ -219,19 +228,15 @@ if (SAR_HC) then {
|
||||
_SAIS_HC = _group setGroupOwner (owner _x);
|
||||
if (_SAIS_HC) then {
|
||||
if (SAR_DEBUG) then {
|
||||
diag_log format ["Sarge's AI System: Moved group %1 to Headless Client %2",_group,_hcID];
|
||||
diag_log format ["Sarge's AI System: Now moving group %1 to Headless Client %2",_group,_hcID];
|
||||
};
|
||||
} else {
|
||||
if (SAR_DEBUG) then {
|
||||
diag_log format ["Sarge's AI System: Moving group %1 to Headless Client %2 has failed",_group,_hcID];
|
||||
diag_log format ["Sarge's AI System: ERROR! Moving group %1 to Headless Client %2 has failed!",_group,_hcID];
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach allPlayers;
|
||||
};
|
||||
|
||||
if (SAR_DEBUG) then {
|
||||
diag_log format ["Sarge's AI System: Infantry group (%3) spawned in: %1 with action: %2 on side: %4",_patrol_area_name,_action,_group,(side _group)];
|
||||
};
|
||||
|
||||
_group;
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
private ["_sizeOfBase","_authorizedGateCodes","_authorizedUID","_flagPole","_leadername","_type","_patrol_area_name","_grouptype","_snipers","_riflemen","_action","_side","_leaderList","_riflemenlist","_sniperlist","_rndpos","_group","_leader","_cond","_respawn","_leader_weapon_names","_leader_items","_leader_tools","_soldier_weapon_names","_soldier_items","_soldier_tools","_sniper_weapon_names","_sniper_items","_sniper_tools","_leaderskills","_riflemanskills","_sniperskills","_ups_para_list","_respawn_time","_argc","_ai_type"];
|
||||
|
||||
if (elec_stop_exec == 1) exitWith {};
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
diag_log "Sarge AI System: Territory gaurds are initializing now.";
|
||||
|
||||
@ -57,12 +57,12 @@ switch (_grouptype) do
|
||||
};
|
||||
|
||||
_leaderList = call compile format ["SAR_leader_%1_list",_type];
|
||||
/*
|
||||
|
||||
_leaderskills = call compile format ["SAR_leader_%1_skills",_type];
|
||||
_riflemanskills = call compile format ["SAR_soldier_%1_skills",_type];
|
||||
_sniperskills = call compile format ["SAR_sniper_%1_skills",_type];
|
||||
*/
|
||||
_rndpos = [_patrol_area_name] call UPSMON_pos;
|
||||
|
||||
_rndpos = [_patrol_area_name,0,SAR_Blacklist] call UPSMON_pos;
|
||||
|
||||
_group = createGroup _side;
|
||||
|
||||
@ -79,6 +79,8 @@ _leader_tools = ["leader",_type] call SAR_unit_loadout_tools;
|
||||
|
||||
[_leader,_leader_weapon_names,_leader_items,_leader_tools] call SAR_unit_loadout;
|
||||
|
||||
if (_side == SAR_AI_unfriendly_side) then {removeHeadgear _this; _this addHeadGear (["H_Shemag_olive","H_Shemag_olive_hs","H_ShemagOpen_khk","H_ShemagOpen_tan"] call BIS_fnc_selectRandom);};
|
||||
|
||||
[_leader] spawn SAR_AI_base_trace;
|
||||
_leader setIdentity "id_SAR_sold_lead";
|
||||
[_leader] spawn SAR_AI_reammo;
|
||||
@ -91,32 +93,25 @@ _cond="(side _this == west) && (side _target == resistance) && ('ItemBloodbag' i
|
||||
[nil,_leader,rADDACTION,"Give me a blood transfusion!", "sarge\SAR_interact.sqf","",1,true,true,"",_cond] call RE;
|
||||
*/
|
||||
[_leader] joinSilent _group;
|
||||
/*
|
||||
|
||||
// set skills of the leader
|
||||
{
|
||||
_leader setskill [_x select 0,(_x select 1 +(floor(random 2) * (_x select 2)))];
|
||||
} foreach _leaderskills;
|
||||
|
||||
// define and store the leadername
|
||||
SAR_leader_number = SAR_leader_number + 1;
|
||||
_leadername = format["SAR_leader_%1",SAR_leader_number];
|
||||
|
||||
_leader setVehicleVarname _leadername;
|
||||
_leader setVariable ["SAR_leader_name",_leadername,false];
|
||||
*/
|
||||
// store AI type on the AI
|
||||
_leader setVariable ["SAR_AI_type",_ai_type + " Leader",false];
|
||||
|
||||
// store experience value on AI
|
||||
_leader setVariable ["SAR_AI_experience",0,false];
|
||||
|
||||
_leader setVariable ["SAR_FLAG_FRIENDLY", _authorizedUID, true];
|
||||
_leader setVariable ["ATTACK_ALL", false, true];
|
||||
/*
|
||||
|
||||
// set behaviour & speedmode
|
||||
_leader setspeedmode "FULL";
|
||||
_leader setBehaviour "AWARE";
|
||||
|
||||
// Lets broadcast this to be sure.
|
||||
//_leader Call Compile Format ["%1=_This ; PublicVariable ""%1""",_leadername];
|
||||
*/
|
||||
_sniperlist = call compile format ["SAR_sniper_%1_list",_type];
|
||||
|
||||
// create crew
|
||||
@ -124,7 +119,6 @@ for "_i" from 0 to (_snipers - 1) do
|
||||
{
|
||||
|
||||
_this = _group createunit [_sniperlist call BIS_fnc_selectRandom, [getPosATL _flagPole,1,_sizeOfBase,5,0,10,0] call BIS_fnc_findSafePos, [], 0.5, "CAN_COLLIDE"];
|
||||
sleep 0.5;
|
||||
|
||||
_sniper_weapon_names = ["sniper",_type] call SAR_unit_loadout_weapons;
|
||||
_sniper_items = ["sniper",_type] call SAR_unit_loadout_items;
|
||||
@ -132,6 +126,8 @@ for "_i" from 0 to (_snipers - 1) do
|
||||
|
||||
[_this,_sniper_weapon_names,_sniper_items,_sniper_tools] call SAR_unit_loadout;
|
||||
|
||||
if (_side == SAR_AI_unfriendly_side) then {removeHeadgear _this; _this addHeadGear (["H_Shemag_olive","H_Shemag_olive_hs","H_ShemagOpen_khk","H_ShemagOpen_tan"] call BIS_fnc_selectRandom);};
|
||||
|
||||
[_this] spawn SAR_AI_base_trace;
|
||||
_this setIdentity "id_SAR";
|
||||
[_this] spawn SAR_AI_reammo;
|
||||
@ -140,17 +136,20 @@ for "_i" from 0 to (_snipers - 1) do
|
||||
_this addMPEventHandler ["MPHit", {Null = _this spawn SAR_AI_hit;}];
|
||||
|
||||
[_this] joinSilent _group;
|
||||
/*
|
||||
|
||||
// set skills
|
||||
{
|
||||
_this setskill [_x select 0,(_x select 1 +(floor(random 2) * (_x select 2)))];
|
||||
} foreach _sniperskills;
|
||||
|
||||
//[nil,_this,rADDACTION,"Give me a blood transfusion!", "sarge\SAR_interact.sqf","",1,true,true,"",_cond] call RE;
|
||||
*/
|
||||
|
||||
// store AI type on the AI
|
||||
_this setVariable ["SAR_AI_type",_ai_type,false];
|
||||
|
||||
// store experience value on AI
|
||||
_this setVariable ["SAR_AI_experience",0,false];
|
||||
|
||||
_this setVariable ["SAR_FLAG_FRIENDLY", _authorizedUID, true];
|
||||
_this setVariable ["ATTACK_ALL", false, true];
|
||||
|
||||
@ -163,7 +162,6 @@ _riflemenlist = call compile format ["SAR_soldier_%1_list",_type];
|
||||
for "_i" from 0 to (_riflemen - 1) do
|
||||
{
|
||||
_this = _group createunit [_riflemenlist call BIS_fnc_selectRandom, [getPosATL _flagPole,1,_sizeOfBase,5,0,10,0] call BIS_fnc_findSafePos, [], 0.5, "CAN_COLLIDE"];
|
||||
sleep 0.5;
|
||||
|
||||
_soldier_items = ["rifleman",_type] call SAR_unit_loadout_items;
|
||||
_soldier_tools = ["rifleman",_type] call SAR_unit_loadout_tools;
|
||||
@ -171,6 +169,8 @@ for "_i" from 0 to (_riflemen - 1) do
|
||||
|
||||
[_this,_soldier_weapon_names,_soldier_items,_soldier_tools] call SAR_unit_loadout;
|
||||
|
||||
if (_side == SAR_AI_unfriendly_side) then {removeHeadgear _this; _this addHeadGear (["H_Shemag_olive","H_Shemag_olive_hs","H_ShemagOpen_khk","H_ShemagOpen_tan"] call BIS_fnc_selectRandom);};
|
||||
|
||||
[_this] spawn SAR_AI_base_trace;
|
||||
_this setIdentity "id_SAR_sold_man";
|
||||
[_this] spawn SAR_AI_reammo;
|
||||
@ -179,17 +179,20 @@ for "_i" from 0 to (_riflemen - 1) do
|
||||
_this addMPEventHandler ["MPHit", {Null = _this spawn SAR_AI_hit;}];
|
||||
|
||||
[_this] joinSilent _group;
|
||||
/*
|
||||
|
||||
// set skills
|
||||
{
|
||||
_this setskill [_x select 0,(_x select 1 +(floor(random 2) * (_x select 2)))];
|
||||
_this setskill [_x select 0,(_x select 1) * (_x select 2)];
|
||||
} foreach _riflemanskills;
|
||||
|
||||
//[nil,_this,rADDACTION,"Give me a blood transfusion!", "sarge\SAR_interact.sqf","",1,true,true,"",_cond] call RE;
|
||||
*/
|
||||
|
||||
// store AI type on the AI
|
||||
_this setVariable ["SAR_AI_type",_ai_type,false];
|
||||
|
||||
// store experience value on AI
|
||||
_this setVariable ["SAR_AI_experience",0,false];
|
||||
|
||||
//flagpole settings
|
||||
_this setVariable ["SAR_FLAG_FRIENDLY", _authorizedUID, true];
|
||||
_this setVariable ["ATTACK_ALL", false, true];
|
||||
@ -242,6 +245,10 @@ switch (_action) do {
|
||||
};
|
||||
};
|
||||
|
||||
if(SAR_DEBUG) then {
|
||||
diag_log format["Sarge's AI System: Territory group (%3) spawned in: %1 with action: %2 on side: %4",_patrol_area_name,_action,_group,(side _group)];
|
||||
};
|
||||
|
||||
if (SAR_HC) then {
|
||||
{
|
||||
_hcID = getPlayerUID _x;
|
||||
@ -249,19 +256,15 @@ if (SAR_HC) then {
|
||||
_SAIS_HC = _group setGroupOwner (owner _x);
|
||||
if (_SAIS_HC) then {
|
||||
if (SAR_DEBUG) then {
|
||||
diag_log format ["Sarge's AI System: Moved group %1 to Headless Client %2",_group,_hcID];
|
||||
diag_log format ["Sarge's AI System: Now moving group %1 to Headless Client %2",_group,_hcID];
|
||||
};
|
||||
} else {
|
||||
if (SAR_DEBUG) then {
|
||||
diag_log format ["Sarge's AI System: Moving group %1 to Headless Client %2 has failed",_group,_hcID];
|
||||
diag_log format ["Sarge's AI System: ERROR! Moving group %1 to Headless Client %2 has failed!",_group,_hcID];
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach allPlayers;
|
||||
};
|
||||
|
||||
if(SAR_DEBUG) then {
|
||||
diag_log format["Sarge's AI System: Territory group (%3) spawned in: %1 with action: %2 on side: %4",_patrol_area_name,_action,_group,(side _group)];
|
||||
};
|
||||
|
||||
_group;
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
private ["_ai_type","_riflemenlist","_side","_leader_group","_patrol_area_name","_rndpos","_groupheli","_heli","_leader","_man2heli","_man3heli","_argc","_grouptype","_respawn","_leader_weapon_names","_leader_items","_leader_tools","_soldier_weapon_names","_soldier_items","_soldier_tools","_leaderskills","_sniperskills","_ups_para_list","_type","_error","_respawn_time","_leadername"];
|
||||
|
||||
if (elec_stop_exec == 1) exitWith {};
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
_patrol_area_name = _this select 0;
|
||||
_argc = count _this;
|
||||
@ -221,4 +221,22 @@ if(SAR_DEBUG) then {
|
||||
diag_log format["Sarge's AI System: AI Heli patrol (%2) spawned in: %1.",_patrol_area_name,_groupheli];
|
||||
};
|
||||
|
||||
if (SAR_HC) then {
|
||||
{
|
||||
_hcID = getPlayerUID _x;
|
||||
if(_hcID select [0,2] isEqualTo 'HC')then {
|
||||
_SAIS_HC = _group setGroupOwner (owner _x);
|
||||
if (_SAIS_HC) then {
|
||||
if (SAR_DEBUG) then {
|
||||
diag_log format ["Sarge's AI System: Now moving group %1 to Headless Client %2",_group,_hcID];
|
||||
};
|
||||
} else {
|
||||
if (SAR_DEBUG) then {
|
||||
diag_log format ["Sarge's AI System: ERROR! Moving group %1 to Headless Client %2 has failed!",_group,_hcID];
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach allPlayers;
|
||||
};
|
||||
|
||||
_groupheli;
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
private ["_riflemenlist","_side","_leader_group","_patrol_area_name","_rndpos","_argc","_grouptype","_respawn","_leader_weapon_names","_leader_items","_leader_tools","_soldier_weapon_names","_soldier_items","_soldier_tools","_leaderskills","_sniperskills","_ups_para_list","_sniperlist","_riflemanskills","_vehicles","_error","_vehicles_crews","_leader","_leadername","_snipers","_riflemen","_veh","_veh_setup","_forEachIndex","_groupvehicles","_sniper_weapon_names","_sniper_items","_sniper_tools","_leader_veh_crew","_type","_respawn_time","_ai_type"];
|
||||
|
||||
if (elec_stop_exec == 1) exitWith {};
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
_patrol_area_name = _this select 0;
|
||||
|
||||
@ -88,13 +88,13 @@ if (_argc > 5) then {
|
||||
|
||||
if(_error) exitWith {diag_log "SAR_AI: Vehicle patrol setup failed, wrong parameters passed!";};
|
||||
|
||||
/*
|
||||
|
||||
_leaderskills = call compile format ["SAR_leader_%1_skills",_type];
|
||||
_riflemanskills = call compile format ["SAR_soldier_%1_skills",_type];
|
||||
_sniperskills = call compile format ["SAR_sniper_%1_skills",_type];
|
||||
*/
|
||||
|
||||
// get a random starting position, UPSMON will handle the rest
|
||||
_rndpos = [_patrol_area_name] call UPSMON_pos;
|
||||
_rndpos = [_patrol_area_name,0,SAR_Blacklist] call UPSMON_pos;
|
||||
|
||||
// create the group
|
||||
_groupvehicles = createGroup _side;
|
||||
@ -104,7 +104,7 @@ _groupvehicles = createGroup _side;
|
||||
// create the vehicle
|
||||
_veh = createVehicle [_x, [_rndpos select 0, _rndpos select 1, 0], [], 0, "CAN_COLLIDE"];
|
||||
_veh setFuel 1;
|
||||
//_veh setVariable ["Sarge",1,true];
|
||||
_veh setVariable ["Sarge",1,true];
|
||||
_veh engineon true;
|
||||
|
||||
_veh addMPEventHandler ["HandleDamage", {_this spawn SAR_AI_VEH_HIT;_this select 2;}];
|
||||
@ -127,6 +127,8 @@ _groupvehicles = createGroup _side;
|
||||
|
||||
[_leader,_leader_weapon_names,_leader_items,_leader_tools] call SAR_unit_loadout;
|
||||
|
||||
if (_side == SAR_AI_unfriendly_side) then {removeHeadgear _leader; _leader addHeadGear (["H_Shemag_olive","H_Shemag_olive_hs","H_ShemagOpen_khk","H_ShemagOpen_tan"] call BIS_fnc_selectRandom);};
|
||||
|
||||
[_leader] spawn SAR_AI_trace_veh;
|
||||
switch (_grouptype) do
|
||||
{
|
||||
@ -143,26 +145,22 @@ _groupvehicles = createGroup _side;
|
||||
_leader assignAsDriver _veh;
|
||||
|
||||
[_leader] joinSilent _groupvehicles;
|
||||
/*
|
||||
|
||||
// set skills of the leader
|
||||
{
|
||||
_leader setskill [_x select 0,(_x select 1 +(floor(random 2) * (_x select 2)))];
|
||||
} foreach _leaderskills;
|
||||
*/
|
||||
|
||||
// store AI type on the AI
|
||||
_leader setVariable ["SAR_AI_type",_ai_type + " Leader",false];
|
||||
/*
|
||||
SAR_leader_number = SAR_leader_number + 1;
|
||||
|
||||
_leadername = format["SAR_leader_%1",SAR_leader_number];
|
||||
|
||||
_leader setVehicleVarname _leadername;
|
||||
_leader setVariable ["SAR_leader_name",_leadername,false];
|
||||
// store experience value on AI
|
||||
_leader setVariable ["SAR_AI_experience",0,false];
|
||||
|
||||
// set behaviour & speedmode
|
||||
_leader setspeedmode "FULL";
|
||||
_leader setBehaviour "SAFE";
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
_snipers = _veh_setup select 1;
|
||||
@ -178,6 +176,8 @@ _groupvehicles = createGroup _side;
|
||||
|
||||
[_this,_sniper_weapon_names,_sniper_items,_sniper_tools] call SAR_unit_loadout;
|
||||
|
||||
if (_side == SAR_AI_unfriendly_side) then {removeHeadgear _this; _this addHeadGear (["H_Shemag_olive","H_Shemag_olive_hs","H_ShemagOpen_khk","H_ShemagOpen_tan"] call BIS_fnc_selectRandom);};
|
||||
|
||||
[_this] spawn SAR_AI_trace_veh;
|
||||
switch (_grouptype) do
|
||||
{
|
||||
@ -200,14 +200,17 @@ _groupvehicles = createGroup _side;
|
||||
_this moveInCargo _veh;
|
||||
_this assignAsCargo _veh;
|
||||
};
|
||||
/*
|
||||
|
||||
// set skills
|
||||
{
|
||||
_this setskill [_x select 0,(_x select 1 +(floor(random 2) * (_x select 2)))];
|
||||
} foreach _sniperskills;
|
||||
*/
|
||||
|
||||
// store AI type on the AI
|
||||
_this setVariable ["SAR_AI_type",_ai_type,false];
|
||||
|
||||
// store experience value on AI
|
||||
_this setVariable ["SAR_AI_experience",0,false];
|
||||
};
|
||||
|
||||
_riflemen = _veh_setup select 2;
|
||||
@ -223,6 +226,8 @@ _groupvehicles = createGroup _side;
|
||||
|
||||
[_this,_soldier_weapon_names,_soldier_items,_soldier_tools] call SAR_unit_loadout;
|
||||
|
||||
if (_side == SAR_AI_unfriendly_side) then {removeHeadgear _this; _this addHeadGear (["H_Shemag_olive","H_Shemag_olive_hs","H_ShemagOpen_khk","H_ShemagOpen_tan"] call BIS_fnc_selectRandom);};
|
||||
|
||||
[_this] spawn SAR_AI_trace_veh;
|
||||
switch (_grouptype) do
|
||||
{
|
||||
@ -240,35 +245,20 @@ _groupvehicles = createGroup _side;
|
||||
// move in vehicle
|
||||
_this moveInCargo _veh;
|
||||
_this assignAsCargo _veh;
|
||||
/*
|
||||
|
||||
// set skills
|
||||
{
|
||||
_this setskill [_x select 0,(_x select 1 +(floor(random 2) * (_x select 2)))];
|
||||
} foreach _riflemanskills;
|
||||
*/
|
||||
|
||||
// store AI type on the AI
|
||||
_this setVariable ["SAR_AI_type",_ai_type,false];
|
||||
|
||||
// store experience value on AI
|
||||
_this setVariable ["SAR_AI_experience",0,false];
|
||||
};
|
||||
} foreach _vehicles;
|
||||
|
||||
if (SAR_HC) then {
|
||||
{
|
||||
_hcID = getPlayerUID _x;
|
||||
if(_hcID select [0,2] isEqualTo 'HC')then {
|
||||
_SAIS_HC = _groupvehicles setGroupOwner (owner _x);
|
||||
if (_SAIS_HC) then {
|
||||
if (SAR_DEBUG) then {
|
||||
diag_log format ["Sarge's AI System: Moved group %1 to Headless Client %2",_groupvehicles,_hcID];
|
||||
};
|
||||
} else {
|
||||
if (SAR_DEBUG) then {
|
||||
diag_log format ["Sarge's AI System: Moving group %1 to Headless Client %2 has failed",_groupvehicles,_hcID];
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach allPlayers;
|
||||
};
|
||||
|
||||
// initialize upsmon for the group
|
||||
_ups_para_list = [_leader,_patrol_area_name,'ONROAD','NOFOLLOW','SAFE','SPAWNED','DELETE:',SAR_DELETE_TIMEOUT];
|
||||
|
||||
@ -288,4 +278,22 @@ if(SAR_DEBUG) then {
|
||||
diag_log format["Sarge's AI System: Land vehicle group (%2), side %3 spawned in %1 in a %4, side %5.",_patrol_area_name,_groupvehicles, _side, typeOf _veh, side _veh];
|
||||
};
|
||||
|
||||
if (SAR_HC) then {
|
||||
{
|
||||
_hcID = getPlayerUID _x;
|
||||
if(_hcID select [0,2] isEqualTo 'HC')then {
|
||||
_SAIS_HC = _group setGroupOwner (owner _x);
|
||||
if (_SAIS_HC) then {
|
||||
if (SAR_DEBUG) then {
|
||||
diag_log format ["Sarge's AI System: Now moving group %1 to Headless Client %2",_group,_hcID];
|
||||
};
|
||||
} else {
|
||||
if (SAR_DEBUG) then {
|
||||
diag_log format ["Sarge's AI System: ERROR! Moving group %1 to Headless Client %2 has failed!",_group,_hcID];
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach allPlayers;
|
||||
};
|
||||
|
||||
_groupvehicles;
|
@ -9,7 +9,7 @@
|
||||
Sarge AI System 2.0+
|
||||
Modded for Arma 3: Exile Mod
|
||||
Changes: Dango
|
||||
https://www.hod-servers.com
|
||||
http://www.hod-servers.com
|
||||
|
||||
*/
|
||||
private ["_ai","_entity_array","_sleeptime","_detectrange"];
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
private ["_ai","_entity_array","_humanity","_humanitylimit","_sleeptime","_detectrange","_tracewhat","_player_rating","_clientmachine"];
|
||||
|
||||
if (elec_stop_exec == 1) exitWith {};
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
_ai = _this select 0;
|
||||
_tracewhat = "CAManBase";
|
||||
|
@ -174,13 +174,13 @@ 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"];
|
||||
//---------------------------------------------------------------------------------
|
||||
|
@ -46,7 +46,7 @@ _type = _this select 0;
|
||||
// grid definition for the automatic spawn system
|
||||
if ((_type == "dynamic") && SAR_dynamic_spawning) then {
|
||||
|
||||
// West Point, 2 bandit groups, 1 soldier groups, 2 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
|
||||
/* // West Point, 2 bandit groups, 1 soldier groups, 2 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
|
||||
_check = [["max_grps","rnd_grps","max_p_grp"],[[2,1,2],[50,75,100],[2,3,3]],"SAR_area_0_0"] call SAR_AI_mon_upd;
|
||||
|
||||
// Water, 0 bandit groups, 0 soldier groups, 0 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
|
||||
@ -78,7 +78,7 @@ if ((_type == "dynamic") && SAR_dynamic_spawning) then {
|
||||
|
||||
// Tara, 2 bandit groups, 0 soldier groups, 2 survivor groups - spawn probability ba,so,su - maximum group members ba,so,su
|
||||
_check = [["max_grps","rnd_grps","max_p_grp"],[[2,0,2],[75,0,75],[3,0,3]],"SAR_area_2_1"] call SAR_AI_mon_upd;
|
||||
};
|
||||
}; */
|
||||
|
||||
if (_type == "static") then {
|
||||
// ---------------------------------------------------------------
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user