Mr H. 402 Posted August 28, 2017 Hi! So here's my problem: I want a script to execute only for players within hearing distance of a NPC The script will be executed from another script, the latter being launched from an addaction. I want the script to execute only on the machines of players nearby but obviously can't use a trigger area to count them. How should I go about it? 1 Share this post Link to post Share on other sites
Mr H. 402 Posted August 28, 2017 _list = anastasia nearEntities ["Man", 10]; {0= [] execVM "fnc\dialogue1.sqf";} forEach _list; this doesn't work Share this post Link to post Share on other sites
Belbo 462 Posted August 28, 2017 That's how you execute the script on all clients in MP: {[] execVM "fnc\dialogue1.sqf"} remoteExec ["bis_fnc_call",0]; And then you put this at the top of your script: if ( (player distance anastasia) > 10 ) exitWith {}; That way the script will be executed on ALL machines, but everything after the exitWith {}; will only be executed by the machines of players who are less than 10 meters in distance to anastasia. 1 1 Share this post Link to post Share on other sites
Mr H. 402 Posted August 28, 2017 I will try that immediatly thanks! Share this post Link to post Share on other sites
Mr H. 402 Posted August 28, 2017 It works perfectly thanks! + It's a very clever way to do it, I wouldn't have thought of it myself! Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted August 29, 2017 <arguments> remoteExec ['tag_fnc_myFunction',(allPlayers select {((_x distance <center_position>) <= <radius>)})]; 3 Share this post Link to post Share on other sites
Captinlarry 0 Posted December 2, 2021 On 8/28/2017 at 3:22 PM, Mr H. said: _list = anastasia nearEntities ["Man", 10]; {0= [] execVM "fnc\dialogue1.sqf";} forEach _list; this doesn't work On 8/28/2017 at 3:30 PM, Belbo said: That's how you execute the script on all clients in MP: {[] execVM "fnc\dialogue1.sqf"} remoteExec ["bis_fnc_call",0]; And then you put this at the top of your script: if ( (player distance anastasia) > 10 ) exitWith {}; That way the script will be executed on ALL machines, but everything after the exitWith {}; will only be executed by the machines of players who are less than 10 meters in distance to anastasia. How would this work for an OOG file on a trigger? I have the player base split and only want the players near the guy to hear the OOG "Incoming" Share this post Link to post Share on other sites
Cysiu 13 Posted December 3, 2021 Use say3D or playSound3D, you can specify max distance at which the sound can be heard. Share this post Link to post Share on other sites