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 fdeebac..a716bad 100644 Binary files a/Pre-Packed PBO/a3_dms.pbo and b/Pre-Packed PBO/a3_dms.pbo differ diff --git a/README.md b/README.md index ff03075..8a5f368 100644 --- a/README.md +++ b/README.md @@ -12,33 +12,6 @@ so your ```_aLocalM``` would look like: ``` _aLocalM = ["DMS_MissionMarkerCircle","DMS_MissionMarkerDot"]; ``` -## IF YOU ARE UPDATING YOUR DMS FROM BEFORE THE 5th OF SEPTEMBER, PLEASE READ BELOW: -The crate loot system has undergone an improvement. You can now define loot values for different crates for the same mission, or none at all! -HOWEVER: This requires you to change the organization of the crate in the mission. - -Previously, _missionObjs was defined with the format: -``` -[ - [_cleanupObj1,_cleanupObj2,...,_cleanupObjX], - [_crate,_vehicle1,_vehicle2,...,_vehicleX], - _crate_loot_values -] -``` - - -Now you must define it as: -``` -[ - [_cleanupObj1,_cleanupObj2,...,_cleanupObjX], - [_vehicle1,_vehicle2,...,_vehicleX], - [ - [_crate1,_crate_loot_values1], - [_crate2,_crate_loot_values2] - ] -] -``` - -Please refer to the current default missions if you are unsure. The Bauhaus truck mission shows an example of spawning 2 crates. ## Optional: @@ -78,6 +51,22 @@ if (!hasInterface && !isServer) then ## Changelog: +#### September 21, 2015 (11:30 PM CST-America): +* 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. + + #### September 20, 2015 (11:30 PM CST-America): * CONFIG VALUES: Changed "DMS_MissionTypes" to "DMS_BanditMissionTypes" * Renamed some variables to "future-proof" them