From fcdc4a57d7c0c580dac18d55d6b5199f81393a0c Mon Sep 17 00:00:00 2001 From: Ghostrider-DbD- Date: Sun, 12 Mar 2017 22:42:19 -0400 Subject: [PATCH] Updated Killed EH, Added a HIt EH, Changed the Intelligence so that AI awareness of player location increases gradually. --- .../Compiles/Units/GMS_EH_AIHit.sqf | 23 +++++++++++++++++++ .../Units/GMS_EH_unitWeaponReloaded.sqf | 17 +++++++++----- .../Units/GMS_fnc_alertNearbyLeader.sqf | 17 ++++++++++++++ .../Units/GMS_fnc_alertNearbyUnits.sqf | 3 ++- .../Compiles/Units/GMS_fnc_processAIKill.sqf | 2 +- .../Compiles/Units/GMS_fnc_spawnUnit.sqf | 4 +++- .../custom_server/Compiles/blck_functions.sqf | 2 ++ .../Configs/blck_configs_epoch.sqf | 4 ++-- .../Configs/blck_configs_exile.sqf | 2 +- .../addons/custom_server/init/build.sqf | 4 ++-- 10 files changed, 64 insertions(+), 14 deletions(-) create mode 100644 @epochhive/addons/custom_server/Compiles/Units/GMS_EH_AIHit.sqf create mode 100644 @epochhive/addons/custom_server/Compiles/Units/GMS_fnc_alertNearbyLeader.sqf diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_EH_AIHit.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_EH_AIHit.sqf new file mode 100644 index 0000000..0b454c2 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_EH_AIHit.sqf @@ -0,0 +1,23 @@ +/* + By Ghostrider-DbD- + Last Modified 3-12-17 +*/ +private ["_unit","_instigator"]; +//diag_log format["_EH_AIHit::-->> _this = %1",_this]; +_unit = _this select 0 select 0; +_instigator = _this select 0 select 3; +//diag_log format["EH_AIHit:: _units = %1 and _instigator = %2 units damage is %3",_unit,_instigator, damage _unit]; +if (!(alive _unit)) exitWith {}; +if (!(isPlayer _instigator)) exitWith {}; +[_unit,_instigator] call blck_fnc_alertNearbyLeader; +if (_unit getVariable ["hasHealed",false]) exitWith {}; +if ((damage _unit) > 0.1 ) then +{ + //diag_log format["_EH_AIHit::-->> Healing unit %1",_unit]; + _unit setVariable["hasHealed",true,true]; + _unit addMagazine "SmokeShellOrange"; + _unit fire "SmokeShellMuzzle"; + _unit addItem "FirstAidKit"; + _unit action ["HealSoldierSelf", soldier1]; +}; + diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_EH_unitWeaponReloaded.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_EH_unitWeaponReloaded.sqf index 6021468..24534af 100644 --- a/@epochhive/addons/custom_server/Compiles/Units/GMS_EH_unitWeaponReloaded.sqf +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_EH_unitWeaponReloaded.sqf @@ -15,9 +15,14 @@ */ -private ["_unit","_mag"]; -_unit = _this select 0; -_mag = _this select 3 select 0; -if (blck_debugLevel > 2) then {diag_log format["_EH_unitWeaponReloaded:: unit %1 reloaded weapon %2 with magazine %3",_unit,_this select 1,_mag]; -if (blck_debugLevel > 2) then (diag_log format["_EH_unitWeaponReloaded:: one magazine of type %1 added to inventory of unit %2",_mag,_unit]; -_unit addMagazine _mag; +//private ["_unit","_mag"]; +//_unit = _this select 0; +//_mag = _this select 3 select 0; +(_this select 0) addMagazine (_this select 3 select 0); +if (blck_debugON) then { + //diag_log format["_EH_unitWeaponReloaded:: unit %1 reloaded weapon %2 with magazine %3",_this select 0, (_this select 3 select 0)]; + //diag_log format["_EH_unitWeaponReloaded:: unit %1 currently has the following magazines 2",_this select 0,magazines (_this select 0)]; +}; +//if (blck_debugLevel > 2) then (diag_log format["_EH_unitWeaponReloaded:: one magazine of type %1 added to inventory of unit %2",_mag,_unit]; + + diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_alertNearbyLeader.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_alertNearbyLeader.sqf new file mode 100644 index 0000000..869eff3 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_alertNearbyLeader.sqf @@ -0,0 +1,17 @@ +/* + by Ghostrider + 9-20-15 + Because this is p-ecompiled there is less concern about keeping comments in. +*/ + +private["_knowsAbout","_intelligence";"_group"]; +params["_unit","_target"]; +_intelligence = _unit getVariable ["intelligence",1]; +_group = group _unit; +{ + _knowsAbout = _x knowsAbout _target; + _x reveal [_target,_knowsAbout + _intelligence]; +}forEach units _group; + + + diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_alertNearbyUnits.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_alertNearbyUnits.sqf index 363b0c4..a2dadae 100644 --- a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_alertNearbyUnits.sqf +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_alertNearbyUnits.sqf @@ -14,7 +14,8 @@ if (_alertDist > 0) then { //diag_log format["+----+ alerting units close to %1",_unit]; { if (((position _x) distance2D (position _unit)) <= _alertDist) then { - _x reveal [_killer, _intelligence]; + _knowsAbout = _x knowsAbout _killer; + _x reveal [_killer, _knowsAbout + _intelligence]; //diag_log "Killer revealed"; } } forEach allUnits; diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf index 1c2f786..b9810c1 100644 --- a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf @@ -50,5 +50,5 @@ if (blck_useKillMessages) then [_unit,_killer,_kills] call blck_fnc_rewardKiller; { _unit removeAllEventHandlers _x; -}forEach ["Killed","Fired","HandleDamage","HandleHeal","FiredNear"] +}forEach ["Killed","Fired","HandleDamage","HandleHeal","FiredNear","Hit"] diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit.sqf index 24644a9..f9fc89d 100644 --- a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit.sqf +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_spawnUnit.sqf @@ -151,7 +151,9 @@ else //_ai1 addeventhandler ["fired", {(_this select 0) setvehicleammo 1;}]; _ai1 addEventHandler ["reloaded", {_this call compile preprocessfilelinenumbers blck_EH_unitWeaponReloaded;}]; _ai1 addEventHandler ["killed",{ [(_this select 0), (_this select 1)] call compile preprocessfilelinenumbers blck_EH_AIKilled;}]; // changed to reduce number of concurrent threads, but also works as spawn blck_AIKilled; }]; -//_ai addEventHandler ["HandleDamage",{ [(_this select 0), (_this select 1)] execVM blck_EH_AIHandleDamage;}]; +_ai1 addEventHandler ["Hit",{ [_this] call compile preprocessFileLineNumbers blck_EH_AHHit;}]; +//_ai1 addEventHandler ["FiredNear",{diag_log "-------->>>>>>>> Weapon fired Near Unit";}]; +//_ai1 addEventHandler ["FiredNear",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIFiredNear;};]; switch (_skillLevel) do { diff --git a/@epochhive/addons/custom_server/Compiles/blck_functions.sqf b/@epochhive/addons/custom_server/Compiles/blck_functions.sqf index 35db98e..ace683e 100644 --- a/@epochhive/addons/custom_server/Compiles/blck_functions.sqf +++ b/@epochhive/addons/custom_server/Compiles/blck_functions.sqf @@ -83,6 +83,8 @@ blck_fnc_vehicleMonitor = compileFinal preprocessFileLineNumbers "\q\addons\cust blck_fnc_removeGear = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_removeGear.sqf"; // Strip an AI unit of all gear. blck_fnc_spawnAI = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_spawnUnit.sqf"; // spawn individual AI blck_EH_AIKilled = "\q\addons\custom_server\Compiles\Units\GMS_EH_AIKilled.sqf"; // Event handler to process AI deaths +blck_EH_AHHit = "\q\addons\custom_server\Compiles\Units\GMS_EH_AIHit.sqf"; +blck_EH_AIFiredNear = "\q\addons\custom_server\Compiles\Units\GMS_EH_AIFiredNear.sqf"; blck_EH_unitWeaponReloaded = "\q\addons\custom_server\Compiles\Units\GMS_EH_unitWeaponReloaded.sqf"; blck_fnc_processAIKill = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_processAIKill.sqf"; blck_fnc_removeLaunchers = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_removeLaunchers.sqf"; diff --git a/@epochhive/addons/custom_server/Configs/blck_configs_epoch.sqf b/@epochhive/addons/custom_server/Configs/blck_configs_epoch.sqf index 68e2270..19f99c8 100644 --- a/@epochhive/addons/custom_server/Configs/blck_configs_epoch.sqf +++ b/@epochhive/addons/custom_server/Configs/blck_configs_epoch.sqf @@ -70,7 +70,7 @@ Last modified 8/1/15 blck_MinDistanceFromMission = 2000; // global loot crate options - // Options to spawn a smoking wreck near the mission. When the first parameter is true, a wreck or junk pile will be spawned. + // Options to spawn a smoking wreck near the crate. When the first parameter is true, a wreck or junk pile will be spawned. // It's position can be either "center" or "random". smoking wreck will be spawned at a random location between 15 and 50 m from the mission. blck_SmokeAtMissions = [false,"random"]; // set to [false,"anything here"] to disable this function altogether. blck_useSignalEnd = true; // When true a smoke grenade/chemlight will appear at the loot crate for 2 min after mission completion. @@ -192,7 +192,7 @@ Last modified 8/1/15 //blck_AIAlertDistance = [150,225,400,500]; // How precisely player locations will be revealed to AI after an AI kill // values are ordered as follows [blue, red, green, orange]; - blck_AIIntelligence = [0.5, 1, 2, 4]; + blck_AIIntelligence = [0.3, 0.5, 0.7, 0.9]; blck_baseSkill = 1.0; // The overal skill of the AI - range 0.1 to 1.0. diff --git a/@epochhive/addons/custom_server/Configs/blck_configs_exile.sqf b/@epochhive/addons/custom_server/Configs/blck_configs_exile.sqf index 69fdab3..45f809c 100644 --- a/@epochhive/addons/custom_server/Configs/blck_configs_exile.sqf +++ b/@epochhive/addons/custom_server/Configs/blck_configs_exile.sqf @@ -196,7 +196,7 @@ Last modified 8/1/15 //blck_AIAlertDistance = [150,225,400,500]; // How precisely player locations will be revealed to AI after an AI kill // values are ordered as follows [blue, red, green, orange]; - blck_AIIntelligence = [0.5, 1, 2, 4]; + blck_AIIntelligence = [0.3, 0.5, 0.7, 0.9]; blck_baseSkill = 1.0; // The overal skill of the AI - range 0.1 to 1.0. diff --git a/@epochhive/addons/custom_server/init/build.sqf b/@epochhive/addons/custom_server/init/build.sqf index 2c6d4b3..1a3ffc9 100644 --- a/@epochhive/addons/custom_server/init/build.sqf +++ b/@epochhive/addons/custom_server/init/build.sqf @@ -1,3 +1,3 @@ private ["_version","_versionDate"]; -_blck_version = "6.56 Build 39"; -_blck_versionDate = "2-24-17 8:00 PM"; +_blck_version = "6.57 Build 40"; +_blck_versionDate = "3-11-17 8:00 PM";