From 4a2e7088b904cafa892e4ac1a4d773f9a7e42dde Mon Sep 17 00:00:00 2001 From: Ghostrider-DbD- Date: Sun, 20 Nov 2016 13:16:41 -0500 Subject: [PATCH] Added several improvements to the user interface. See Changlog for details Added mission notifications using Toasts (Exile Only) Added Killer notifications that display Bonus Recieved for the Kill. Minor corrections of typos and bug fixes --- .../Compiles/Functions/GMS_fnc_AIM - Copy.sqf | 16 ----------- .../Compiles/Functions/GMS_fnc_AIM.sqf | 4 +-- .../Functions/GMS_fnc_cleanEmptyGroups.sqf | 2 +- .../Compiles/Functions/GMS_fnc_mainThread.sqf | 28 +++++++++++++------ .../Compiles/Units/GMS_fnc_processAIKill.sqf | 11 ++++++-- .../Compiles/Units/GMS_fnc_rewardKiller.sqf | 7 +++-- .../Units/nu-GMS_EH_AIHandleDamage.sqf | 21 ++++++++++++++ .../Units/nu-GMS_fnc_sendRewardMessage.sqf | 23 +++++++++++++++ .../custom_server/Compiles/blck_functions.sqf | 1 + @epochhive/addons/custom_server/changeLog.sqf | 3 ++ 10 files changed, 82 insertions(+), 34 deletions(-) delete mode 100644 @epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_AIM - Copy.sqf create mode 100644 @epochhive/addons/custom_server/Compiles/Units/nu-GMS_EH_AIHandleDamage.sqf create mode 100644 @epochhive/addons/custom_server/Compiles/Units/nu-GMS_fnc_sendRewardMessage.sqf diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_AIM - Copy.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_AIM - Copy.sqf deleted file mode 100644 index ec8689a..0000000 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_AIM - Copy.sqf +++ /dev/null @@ -1,16 +0,0 @@ -//This script sends Message Information to allplayers -// Last modified 9/3/15 by Ghostrider-DBD- - -blck_Message = _this; -//diag_log format["AIM.sqf ===] _this = %1",_this]; -{ - //diag_log format["AIM.sqf ===] (owner _x) = %1", (owner _x)]; - (owner _x) publicVariableClient "blck_Message"; -} forEach playableUnits; -/* -if (_modType isEqualTo "Exile") then -{ - [_blck_Message] remoteExec["fn_blck_MessageHandler",0]; -}; -*/ - diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_AIM.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_AIM.sqf index cf3a501..6143be1 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_AIM.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_AIM.sqf @@ -3,10 +3,10 @@ //blck_Message = _this; params["_msg",["_players",playableUnits]]; -diag_log format["AIM.sqf ===] _this = %1 | _msg = %2 | _players = %3",_this,_msg, _players]; +//diag_log format["AIM.sqf ===] _this = %1 | _msg = %2 | _players = %3",_this,_msg, _players]; blck_Message = _msg; { - diag_log format["AIM.sqf ===] _ = %2, and (owner _x) = %1", (owner _x), _x]; + //diag_log format["AIM.sqf ===] _ = %2, and (owner _x) = %1", (owner _x), _x]; (owner _x) publicVariableClient "blck_Message"; } forEach _players; /* diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_cleanEmptyGroups.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_cleanEmptyGroups.sqf index d7a18b1..411d83c 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_cleanEmptyGroups.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_cleanEmptyGroups.sqf @@ -4,7 +4,7 @@ By Ghostrider-DbD- 11/16/16 */ -if (_fnc_cleanEmptyGroups) then +if (true) then { diag_log format ["_fnc_cleanEmptyGroups:: -- >> group count = %1 ",(count allGroups)]; }; diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf index 593a3e8..84e74f6 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf @@ -11,6 +11,8 @@ private _index = 0; _timeAccelUpdated = diag_tickTime; _timer1min = diag_tickTime; _timer5min = diag_tickTime; +_timer10Min = diag_tickTime; +_modType = [] call blck_fnc_getModType; while {true} do { uiSleep blck_mainThreadUpdateInterval; @@ -33,16 +35,24 @@ while {true} do }forEach blck_oldMissionObjects; [] call GMS_fnc_cleanupDeadAI; - - if ((diag_tickTime - _timeAccelUpdated) > 300) then - { - [] call blck_fnc_timeAcceleration; - _timeAccelUpdated = diag_tickTime; - }; - - if (blck_useHC) then {[] call blck_fnc_monitorHC;}; - [] call blck_fnc_cleanEmptyGroups; + + if (_modType isEqualTo "Epoch") then {[] call blck_fnc_cleanEmptyGroups;}; // Exile cleans up empty groups automatically so this should not be needed with that mod. }; + + + if ((diag_tickTime - _timer5min) > 300) then { + [] call blck_fnc_timeAcceleration; + if (blck_useHC) then {[] call blck_fnc_monitorHC;}; + _timer5min = diag_tickTime; + }; + + /* + if ((diag_tickTime - _timer10Min) > 600) then + { + // Reserved for future use + _timer10Min = diag_tickTime; + }; + */ /* { if (_x select 6 > 0) then // The mission is not running, check the time left till it is spawned 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 678fa60..af92639 100644 --- a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf @@ -1,6 +1,6 @@ /* Handle AI Deaths - Last Modified 11/6/16 + Last Modified 11/20/16 By Ghostrider-DBD- Copyright 2016 */ @@ -20,6 +20,9 @@ if (blck_removeNVG) then {[_unit] spawn blck_fnc_removeNVG;}; if !(isPlayer _killer) exitWith {}; [_unit,_killer] call blck_fnc_alertNearbyUnits; _isLegal = [_unit,_killer] call blck_fnc_processIlleagalAIKills; + +if !(_isLegal) exitWith {}; + _lastkill = _killer getVariable["blck_lastkill",diag_tickTime]; _killer setVariable["blck_lastkill",diag_tickTime]; _kills = (_killer getVariable["blck_kills",0]) + 1; @@ -29,9 +32,10 @@ if ((diag_tickTime - _lastkill) < 240) then } else { _killer setVariable["blck_kills",0]; }; -if (_isLegal) then {[_unit,_killer,_kills] call blck_fnc_rewardKiller;}; + _weapon = currentWeapon _killer; _killstreakMsg = format[" %1X KILLSTREAK",_kills]; + if (blck_useKilledAIName) then { _message = format["[blck] %2: killed by %1 from %3m",name _killer,name _unit,round(_unit distance _killer)]; @@ -39,8 +43,9 @@ if (blck_useKilledAIName) then _message = format["[blck] %1 killed with %2 from %3 meters",name _killer,getText(configFile >> "CfgWeapons" >> _weapon >> "DisplayName"), round(_unit distance _killer)]; }; _message =_message + _killstreakMsg; -//diag_log format["[blck] unit killed message is %1",_message,""]; +diag_log format["[blck] unit killed message is %1",_message,""]; [["aikilled",_message,"victory"]] call blck_fnc_messageplayers; +[_unit,_killer,_kills] call blck_fnc_rewardKiller; { _unit removeAllEventHandlers _x; }forEach ["Killed","Fired","HandleDamage","HandleHeal","FiredNear"] diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_rewardKiller.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_rewardKiller.sqf index 128c93d..1c7a02a 100644 --- a/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_rewardKiller.sqf +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_fnc_rewardKiller.sqf @@ -34,9 +34,10 @@ if (_modType isEqualTo "Epoch") then if (_dist < 800) then { _reward = _maxReward - (_maxReward / 2); _reward }; if (_dist > 800) then { _reward = _maxReward - (_maxReward / 4); _reward }; - _reward=+(_kills*2); + private _killstreakReward=+(_kills*2); //diag_log format["fnd_rewardKiller:: _bonus returned will be %1",_reward]; - [_killer,_reward] call blck_fnc_giveTakeCrypto; + [_killer,_reward + _killstreakReward] call blck_fnc_giveTakeCrypto; + [["showScore",[_reward,"",_kills],""],[_killer]] call blck_fnc_messageplayers; }; }; @@ -59,8 +60,8 @@ if (_modType isEqualTo "Exile") then _killer setVariable ["ExileMoney", _money]; format["setAccountMoney:%1:%2", _money, (getPlayerUID _killer)] call ExileServer_system_database_query_fireAndForget; _message = ["showFragRequest",_overallRespectChange]; - //_message remoteExecCall ["ExileClient_system_network_dispatchIncomingMessage", (owner _killer)]; _killer call ExileServer_object_player_sendStatsUpdate; + [["showScore",[50,_distanceBonus,_kills]], [_killer]] call blck_fnc_messageplayers; }; //_reward diff --git a/@epochhive/addons/custom_server/Compiles/Units/nu-GMS_EH_AIHandleDamage.sqf b/@epochhive/addons/custom_server/Compiles/Units/nu-GMS_EH_AIHandleDamage.sqf new file mode 100644 index 0000000..07238f3 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Units/nu-GMS_EH_AIHandleDamage.sqf @@ -0,0 +1,21 @@ +/* + + + unit: Object - Object the event handler is assigned to. + selectionName: String - Name of the selection where the unit was damaged. "" for over-all structural damage, "?" for unknown selections. + damage: Number - Resulting level of damage for the selection. + source: Object - The source unit that caused the damage. + projectile: String - Classname of the projectile that caused inflicted the damage. ("" for unknown, such as falling damage.) + +(Since Arma 3 v 1.49.131802) + + hitPartIndex: Number - Hit part index of the hit point, -1 otherwise. +*/ + +private ["_unit","_killer","_group","_deleteAI_At"]; +_unit = _this select 0; +_source = _this select 3; + +if (isPlayer _source) then { + [_unit,_source] call GRMS_fnc_alertGroup; +}; diff --git a/@epochhive/addons/custom_server/Compiles/Units/nu-GMS_fnc_sendRewardMessage.sqf b/@epochhive/addons/custom_server/Compiles/Units/nu-GMS_fnc_sendRewardMessage.sqf new file mode 100644 index 0000000..2e75ffc --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Units/nu-GMS_fnc_sendRewardMessage.sqf @@ -0,0 +1,23 @@ + +/* + Send player a mesage regarding reward for the kill. + +*/ + +params["_killer","_distanceBonus"]; +private["_kills","_mt"]; +_mt = call blck_fnc_getModType; +diag_log format["_fnc_sendRewardMessage:: -- >> _this = %1 and mod type = %2",_this, _mt]; + +if (_mt isEqualTo "Exile") then +{ + _kills = getVariable [_killer,"ExileKills"]; + private _killerMsg = []; + _killerMsg pushback "Enemy AI Killed"; + _killerMsg pushback _newKillerScore; + _killerMsg pushback format["%1X Killstreak",_kills]; + _killerMsg pushback format["Killstreak Bonus %1",(_kills*2)]; + private _message = ["showFragRequest",_killerMsg]; + diag_log format ["_fnc_rewardKiller:: -- >> _killer %1 _kills %2 _distanceBonus %3 _killerMsg = %1",_killer, _kills, _distanceBonus, _killerMsg]; + _message remoteExecCall ["ExileClient_system_network_dispatchIncomingMessage", (owner _killer)]; +}; diff --git a/@epochhive/addons/custom_server/Compiles/blck_functions.sqf b/@epochhive/addons/custom_server/Compiles/blck_functions.sqf index 4054c9f..12998f6 100644 --- a/@epochhive/addons/custom_server/Compiles/blck_functions.sqf +++ b/@epochhive/addons/custom_server/Compiles/blck_functions.sqf @@ -19,6 +19,7 @@ blck_fnc_getModType = compileFinal preprocessFileLineNumbers "\q\addons\custom_ // Player-related functions blck_fnc_rewardKiller = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_rewardKiller.sqf"; blck_fnc_MessagePlayers = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_AIM.sqf"; // Send messages to players regarding Missions +//blck_fnc_sendRewardMessage = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_sendRewardMessage.sqf"; // Mission-related functions blck_fnc_missionTimer = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionTimer.sqf"; diff --git a/@epochhive/addons/custom_server/changeLog.sqf b/@epochhive/addons/custom_server/changeLog.sqf index d0ca8d8..647b103 100644 --- a/@epochhive/addons/custom_server/changeLog.sqf +++ b/@epochhive/addons/custom_server/changeLog.sqf @@ -4,6 +4,9 @@ Loosely based on the AI mission system by blckeagls ver 2.0.2 Contributions by Narines: bug fixes, testing, 'fired' event handler Ideas or code from that by Vampire and KiloSwiss have been used for certain functions. +11/20/16 Build 6.45 Build 16 +Added Option to display mission information in Toasts (Exile Only). + 11/16/16 Version 6.44 Build 15 Added parameters blck_blacklistTraderCities=true; // the locations of the Epoch/Exile trader cities will be pulled from the config and added to the location blacklist for the mission system.