BEAKSBY 11 Posted May 27, 2014 (edited) ONLY the WEST side is working for the BLUaddmoney.sqf / OPPaddmoney.sqf when I test on LAN init.sqf BLUmoney = 5000; OPPmoney = 1000; call compile preProcessFileLineNumbers "scripts\UIFunctions.sqf"; waitUntil {!isNull player}; //////////////////////////////////////////////////// */ If (side player == WEST) then {// for west units player addAction ["Player identity", { hint format ["Player name is %1", _this select 3] }, name player]; player addAction ["<t color='#00dd00'>Account Status </t>", "BLUaccount.sqf"]; // TESTING HINT MESSAGE ON EITHER PLAYER AND THIS WORKS player addAction ["Player side", { hint format ["Player side is %1", _this select 3] }, side player]; {if (side _x != side player) then {_x addEventHandler ["Killed", {[100] execVM "BLUaddmoney.sqf";}];};} forEach allUnits; } else {// change this for east units player addAction ["Player identity", { hint format ["Player name is %1", _this select 3] }, name player]; player addAction ["<t color='#00dd00'>Account Status </t>", "OPPaccount.sqf"]; // TESTING HINT MESSAGE ON EITHER PLAYER AND THIS WORKS player addAction ["Player side", { hint format ["Player side is %1", _this select 3] }, side player]; {if (side _x != side player) then {_x addEventHandler ["Killed", {[100] execVM "OPPaddmoney.sqf";}];};} forEach allUnits; }; _menu = player addAction ["<t color=""#3399FF"">" +"Weapons", {call FUS_fnc_dialogInit;}]; BLUaddmoney.sqf _BLUsum = _this select 0; BLUmoney = BLUmoney + _BLUsum; hint format ["You have %1$", BLUmoney]; OPPaddmoney.sqf _OPPsum = _this select 0; OPPmoney = OPPmoney + _OPPsum; hint format ["You have %1$", OPPmoney]; I think this all has to do with addEventHandler --> effects of the given scripting command are not broadcasted over the network and remain local to the client the command is executed on. Check Locality in Multiplayer for more information about locality of objects. I'm not sure how to check which machine it is run on server or client then run the addEventHandler on the appropriate machine. SO how do I run addEventHandler effects on a specific machine, server or client? Edited May 27, 2014 by BEAKSBY Share this post Link to post Share on other sites
dna_uk 30 Posted May 28, 2014 Before I help, mind if I ask what you're trying to achieve overall? There might be a better way of doing things. Share this post Link to post Share on other sites
BEAKSBY 11 Posted May 28, 2014 Before I help, mind if I ask what you're trying to achieve overall? There might be a better way of doing things. Thanks DnA_UK When a unit (including the player) kills an enemy unit, the side that made the kill should receive $100 in their account (I.e. BLUmoney or OPPmoney). This $100 should be displayed as a hint on the machine of the player's side that made the kill only. This is for MP. Share this post Link to post Share on other sites
dna_uk 30 Posted May 28, 2014 https://dl.dropboxusercontent.com/u/9556723/ArmA3/Scripts/money.Stratis.zip Here is a quick example I whipped up. Killed event handler is added to all units server side. When an enemy has been killed the server will broadcast the command to add $100 to the players account. Share this post Link to post Share on other sites
BEAKSBY 11 Posted May 29, 2014 OK, Thanks! I will need some time to digunderstand it and add it to the OPPFOR side too. Thanks again Share this post Link to post Share on other sites
dna_uk 30 Posted May 29, 2014 It already works for any other side. Share this post Link to post Share on other sites
BEAKSBY 11 Posted May 31, 2014 It already works for any other side. Thanks DnA_UK Question: I replaced //--- Check if player is killed and is of opposite sideif ( isPlayer _killer && { side group _killer != side group _unit } ) then { with //--- Check if opposite side is killed by killerif (side group _killer != side group _unit) then { Do you think this will affect MP gameplay as any unit from one side will generate money for their side and vice-versa? This was my original intent. My game will be designed for 4 Vs 4 for the maximum amount of players, yet each player can spawn dozens of units each. New initServer.sqf { //--- Add killed EH to unit _handle = _x addEventHandler [ "Killed", { _unit = _this select 0; _killer = _this select 1; _handle = _unit getVariable [ "DNA_EH_Killed_Money", -1 ]; //--- Check if opposite side is killed by killer if (side group _killer != side group _unit) then { //--- Add money to the client [ 100, "DNA_fnc_addMoney", _killer ] call BIS_fnc_MP; }; //--- Remove the event handler _unit removeEventHandler [ "Killed", _handle ]; } ]; //--- Store killed EH handle in unit namespace _x setVariable [ "DNA_EH_Killed_Money", _handle ]; } forEach allUnits; Share this post Link to post Share on other sites
BEAKSBY 11 Posted June 1, 2014 (edited) It already works for any other side. Thanks, works great! I'm still having troubles getting the hint to display the current account after a unit (or player) from the side of the player makes a kill. Both players should see a hint displaying their current account after one of their own units make a kill. Edited June 2, 2014 by BEAKSBY Share this post Link to post Share on other sites
dna_uk 30 Posted June 3, 2014 Ah, I understand what you want now. I'll help you out if/when I get some free time :P Share this post Link to post Share on other sites
BEAKSBY 11 Posted June 3, 2014 Thanks and much appreciated! Share this post Link to post Share on other sites