From c52c7c33d110cfa23baef2aff8c9fdd49e63405c Mon Sep 17 00:00:00 2001 From: eraser1 Date: Mon, 21 Sep 2015 23:17:51 -0500 Subject: [PATCH] Today's Feature... Some of you are gonna like this * NEW CONFIG VALUES: DMS_Diff_RepOrTabs_on_roadkill DMS_Bandit_Soldier_RoadkillMoney DMS_Bandit_Soldier_RoadkillRep DMS_Bandit_Static_RoadkillMoney DMS_Bandit_Static_RoadkillRep DMS_Bandit_Vehicle_RoadkillMoney DMS_Bandit_Vehicle_RoadkillRep * Removed config value: "DMS_credit_roadkill" * You can now REDUCE a player's respect/poptabs when the player roadkills an AI. The default values are -10 poptabs and -5 respect (hardly noticeable, but I didn't want it to be extreme). * Alternatively, you can simply reduce the amount of poptabs gained by giving each corresponding config a positive value less than the regular. Set the value to 0 if you don't want to credit the poptabs/respect. * The player will get an appropriately colored message if he/she LOSES poptabs (as opposed to gaining them). * The player also gets a little more information regarding the type of AI he/she has killed. --- @ExileServer/addons/a3_dms/config.sqf | 9 ++- .../addons/a3_dms/scripts/fn_OnKilled.sqf | 53 ++++++++++++------ Pre-Packed PBO/a3_dms.pbo | Bin 202152 -> 203861 bytes README.md | 43 ++++++-------- 4 files changed, 60 insertions(+), 45 deletions(-) diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index 44a518a..6f6798a 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -109,11 +109,18 @@ DMS_DEBUG = false; DMS_Bandit_Vehicle_MoneyGain = 100; // The amount of Poptabs gained for killing a bandit vehicle crew member DMS_Bandit_Vehicle_RepGain = 25; // The amount of Respect gained for killing a bandit vehicle crew member + DMS_Diff_RepOrTabs_on_roadkill = true; // Whether or not you want to use different values for giving respect/poptabs when you run an AI over. Default values are NEGATIVE. This means player will LOSE respect or poptabs. + DMS_Bandit_Soldier_RoadkillMoney = -10; // The amount of Poptabs gained/lost for running over a bandit soldier + DMS_Bandit_Soldier_RoadkillRep = -5; // The amount of Respect gained/lost for running over a bandit soldier + DMS_Bandit_Static_RoadkillMoney = -10; // The amount of Poptabs gained/lost for running over a bandit static gunner + DMS_Bandit_Static_RoadkillRep = -5; // The amount of Respect gained/lost for running over a bandit static gunner + DMS_Bandit_Vehicle_RoadkillMoney = -10; // The amount of Poptabs gained/lost for running over a bandit vehicle crew member + DMS_Bandit_Vehicle_RoadkillRep = -5; // The amount of Respect gained/lost for running over a bandit vehicle crew member + DMS_banditSide = EAST; // The side (team) that AI Bandits will spawn on DMS_clear_AI_body = false; // Clear AI body as soon as they die DMS_clear_AI_body_chance = 50; // Percentage chance that AI bodies will be cleared when they die DMS_ai_disable_ramming_damage = true; // Disables damage due to ramming into AI. !!!NOTE: THIS WILL NOT BE RELIABLE WITH "DMS_ai_offload_to_client"!!! - DMS_credit_roadkill = false; // Credit players with respect/poptabs if they kill an AI by running it over DMS_remove_roadkill = true; // Remove gear from AI bodies that are roadkilled DMS_remove_roadkill_chance = 50; // Percentage chance that roadkilled AI bodies will be deleted DMS_RemoveNVG = false; // Remove NVGs from AI bodies diff --git a/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf b/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf index 8afadc7..2148d77 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf @@ -15,7 +15,7 @@ */ -private ["_unit", "_killer", "_side", "_type", "_launcher", "_playerObj", "_rockets", "_grpUnits", "_av", "_memCount", "_gunner", "_driver", "_veh", "_moneyGain", "_repGain", "_money", "_respect"]; +private ["_unit", "_killer", "_side", "_type", "_launcher", "_playerObj", "_rockets", "_grpUnits", "_av", "_memCount", "_gunner", "_driver", "_veh", "_moneyChange", "_repChange", "_money", "_respect", "_roadKilled"]; if (DMS_DEBUG) then @@ -237,6 +237,7 @@ if (!isNull _av) then }; }; +_roadKilled = false; if (isPlayer _killer) then { @@ -266,12 +267,7 @@ if (isPlayer _killer) then { _playerObj = driver _veh; - - // Don't reward players with poptabs/respect if configured to do so - if !(DMS_credit_roadkill) then - { - _playerObj = objNull; - }; + _roadKilled = true; // Remove gear from roadkills if configured to do so @@ -285,33 +281,56 @@ if (isPlayer _killer) then if ((!isNull _playerObj) && {((getPlayerUID _playerObj) != "") && {_playerObj isKindOf "Exile_Unit_Player"}}) then { - _moneyGain = missionNamespace getVariable [format ["DMS_%1_%2_MoneyGain",_side,_type],0]; - _repGain = missionNamespace getVariable [format ["DMS_%1_%2_RepGain",_side,_type],0]; + _moneyChange = missionNamespace getVariable [format ["DMS_%1_%2_MoneyGain",_side,_type],0]; + _repChange = missionNamespace getVariable [format ["DMS_%1_%2_RepGain",_side,_type],0]; - if ((_moneyGain>0) || (_repGain>0)) then + if (_roadKilled && {DMS_Diff_RepOrTabs_on_roadkill}) then + { + _moneyChange = missionNamespace getVariable [format ["DMS_%1_%2_RoadkillMoney",_side,_type],0]; + _repChange = missionNamespace getVariable [format ["DMS_%1_%2_RoadkillRep",_side,_type],0]; + }; + + if ((_moneyChange!=0) || (_repChange!=0)) then { _money = _playerObj getVariable ["ExileMoney", 0]; _respect = _playerObj getVariable ["ExileScore", 0]; - if (_moneyGain>0) then + if (_moneyChange!=0) then { + private ["_msgType", "_msgParams"]; + // Set client's money - _money = _money + _moneyGain; + // I also make sure that they don't get negative poptabs + _money = (_money + _moneyChange) max 0; _playerObj setVariable ["ExileMoney",_money]; + // Change message for players when they're actually LOSING poptabs + _msgType = "moneyReceivedRequest"; + _msgParams = [str _money, format ["killing a %1 AI",_type]]; + + if (_moneyChange<0) then + { + _msgType = "notificationRequest"; + _msgParams = ["Whoops",[format ["Lost %1 poptabs from running over a %2 AI!",abs _moneyChange,_type]]]; + + // With the error message the money value won't be updated on the client, so I just directly PVC the value. + ExileClientPlayerMoney = _money; + (owner _playerObj) publicVariableClient "ExileClientPlayerMoney"; + ExileClientPlayerMoney = nil; + }; + // Send notification and update client's money stats - // Somebody done fucked up so you don't see the sender for the money sending ;) - [_playerObj, "moneyReceivedRequest", [str _money, "killing AI"]] call ExileServer_system_network_send_to; + [_playerObj, _msgType, _msgParams] call ExileServer_system_network_send_to; }; - if (_repGain>0) then + if (_repChange!=0) then { // Set client's respect - _respect = _respect + _repGain; + _respect = _respect + _repChange; _playerObj setVariable ["ExileScore",_respect]; // Send frag message - [_playerObj, "showFragRequest", [ [["AI KILL",_repGain]] ] ] call ExileServer_system_network_send_to; + [_playerObj, "showFragRequest", [ [[format ["%1 AI KILL",toUpper _type],_repChange]] ] ] call ExileServer_system_network_send_to; // Send updated respect value to client ExileClientPlayerScore = _respect; diff --git a/Pre-Packed PBO/a3_dms.pbo b/Pre-Packed PBO/a3_dms.pbo index fdeebac48051ff3d5dea024bc16876e8bc4f4707..a716badad48bfaba15c7639925ee6126a1b3a711 100644 GIT binary patch delta 1806 zcmb7FL2DaF6t=g}MsA`C>Vzga%}n1{1O%SUt_W z?|a|--qZc>k3M^J^sCR}Gpt8G$)9?PGwi|Ff4mWYoC-sKKkX?#PCfkM$okpSlV+u& z7pODuE|E1)XSVJ#Vyv5%1)SwV$mM};Qg;+4X@&S!Ck1gST%DTEE#-?-qp(ynJ*ZP+ zd*E0fkOp;OOVF8}Uz~~{072U*qsRJUlXHvuWnvp9*B6;(nAFt^?JDM&O&hT+jEpxw z8X7o}v6#mtXXIoH(t=U*!B9HUzJOZ9#QFD{J45d@{~L-Qeg{r+!p-slte1k_8XkFN zuv^2aQ$<=c%N9KV_p;LVv@^{Qwd1df_;63#>-{8=`8<*7Z6z|wg~El28nLTX)j-u< z>U4dp3ys@x>45MZ1)aghQKQ8^Rz5w^FP#-eAPW^@dGuoIuRz&Q`eU*EKXTWntv|n2 za=ovIH~~CY#shj=N$m^#h=F|f)pO_IhH%5-w%#5Dj=n_K+`vyvm*l%Z5~=h16%ICT zE63kNf>F(qOT6nCT1Flk*}izJ50jb|NT<6KC$nRNaPualUnEIpzu8s3jD^7Xd+<;E zw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