777eza 10 Posted April 2, 2017 (edited) So I've been away from Arma for a bit now and just getting back into editing however I'm having a bit of a problem with a addaction working in multiplayer. What I want to do is have an addaction on a player (h1), and have it so another player (s1) when using it, changes a variable which will then enable simulation on that player (h1) from a trigger (hide and seek gamemode :D ). I have it working when I'm s1 but whenever another player is s1 the addaction doesn't work. This is what I have on the addaction unit (h1) nul = [this] execVM "test.sqf"; and this is what in the test.sqf h1 addAction ["<t color='#FF0000'>Catch!</t>",{varhh1 = 1},nil,1,true,false,"","_this == s1",2,false] call BIS_fnc_MP; s1 is the player who uses the addaction. and varhh1 is the variable then I have a trigger set so when varhh1 == 1;. h1 enableSimulationGlobal true;. Any help would be appreciated! Edited April 2, 2017 by 777eza Share this post Link to post Share on other sites
MKD3 27 Posted April 2, 2017 Use this: https://community.bistudio.com/wiki/remoteExec maybe something like: h1 addaction ["Catch!", "[_this select 0, _this select 1] remoteExec ["fn_catch",allplayers];"]; //init.sqf fn_Catch = { params ["_hider", "_seeker"]; if (_hider == player) then {player enablesimulation false;}; }; 1 Share this post Link to post Share on other sites
777eza 10 Posted April 2, 2017 7 hours ago, MKD3-FHI said: maybe something like: h1 addaction ["Catch!", "[_this select 0, _this select 1] remoteExec ["fn_catch",allplayers];"]; Can't seem to get that working I have it in the test.sqf but getting an error missing "]" which is weird since there all closed. Share this post Link to post Share on other sites
MKD3 27 Posted April 2, 2017 Forgot to double the ""; h1 addaction ["Catch!", "[_this select 0, _this select 1] remoteExec [""fn_catch"",allplayers]"]; See if that works Share this post Link to post Share on other sites
777eza 10 Posted April 2, 2017 7 hours ago, MKD3-FHI said: See if that works well I get an addaction now but nothing triggers when selecting it, now I have to define _hider and _seekers can I do that in the init? so? _hider = ["h1"]; _seeker = ["s1"]; as you can probably tell I'm not much of a coder :P Share this post Link to post Share on other sites
Midnighters 152 Posted April 3, 2017 I recommend you use remoteExec instead of bis_fnc_MP next time. 1 Share this post Link to post Share on other sites
Chuc 83 Posted April 4, 2017 If you are using names for the units how bout adding nul = [this] execVM "test.sqf"; Into a trigger of some sort so it activates when anyone enters it. Or just place it in your init.sqf file so it happens on mission start just like putting it in the unit init. You could also just add this h1 addAction ["<t color='#FF0000'>Catch!</t>",{varhh1 = 1},nil,1,true,false,"","_this == s1",2,false] call BIS_fnc_MP; into the units init or your init.sqf file or even a radio trigger to mimic a radio call to catch someone. Im not the best at all and I hop this can help Share this post Link to post Share on other sites
MKD3 27 Posted April 4, 2017 On 4/2/2017 at 11:09 PM, 777eza said: well I get an addaction now but nothing triggers when selecting it, now I have to define _hider and _seekers can I do that in the init? so? _hider = ["h1"]; _seeker = ["s1"]; as you can probably tell I'm not much of a coder :P _hider and _seeker are passed to the function via the addaction. No need to do anything with naming them. Just tested myself using this code fn_Catch = { params ["_hider", "_seeker"]; if (_hider == player) then {player enablesimulation false;}; hint format ["%1,%2", _hider, _seeker]; }; That will show you who is set as hider and seeker in a hint if you want to see that its working in SP, use it on an AI unit, youll see no result other than a hint. The code I gave will work, but as it requires the _hider to be a player (_hider == player) in this instance, it will only work in MP Share this post Link to post Share on other sites
777eza 10 Posted April 4, 2017 5 hours ago, MKD3-FHI said: The code I gave will work, but as it requires the _hider to be a player (_hider == player) in this instance, it will only work in MP ok so I found the problem. so what I want to do is enablesimulation true since I have a trigger that freeze the hiders after x amount of sec. however since it's not enablesimulationglobal, what happens is the hider can move on his/her screen but on the seekers screen the hider is frozen on the spot. and since you can't use enablesimulationglobal with out it breaking the addaction I'm back to square one. tho the code I posted did work when the host was the seeker the only problem was when someone else went seeker the addaction didn't work any idea why? Share this post Link to post Share on other sites
MKD3 27 Posted April 6, 2017 On 4/5/2017 at 2:49 AM, 777eza said: what I want to do is enablesimulation true since I have a trigger that freeze the hiders after x amount of sec. however since it's not enablesimulationglobal RemoteExec calls the function on all player clients, meaning global commands are not needed. Shouldnt affect anything. Use the code with the hint in it and see if your friend sees it, if he doesn't, then there is a problem. This doesnt require a trigger. Try adding the code to initplayerlocal.sqf, that will ensure its defined on all clients. Share this post Link to post Share on other sites
Midnighters 152 Posted April 6, 2017 5 hours ago, MKD3-FHI said: RemoteExec calls the function on all player clients, meaning global commands are not needed. Shouldnt affect anything. Use the code with the hint in it and see if your friend sees it, if he doesn't, then there is a problem. This doesnt require a trigger. Try adding the code to initplayerlocal.sqf, that will ensure its defined on all clients. RemoteExec doesn't have to be executed on all the player clients. There are different modes: 2 (server) 0 (all clients) etc. Share this post Link to post Share on other sites
MKD3 27 Posted April 7, 2017 10 hours ago, Midnighters said: RemoteExec doesn't have to be executed on all the player clients. There are different modes: 2 (server) 0 (all clients) etc. Yeah, but not in what I provided... Share this post Link to post Share on other sites