cb65 86 Posted May 28, 2018 Hi everyone, I need some help getting a local variable inside the array of this remoteExec code. This code works perfectly. [_camScreen, ["<t color='#e5b348'>Normal View</t>",{[0,"renderscreen"] call fnc_render_camera},[],-1,true,true,"",(format ["((vehicle player) distance (position %1) <= 4)",_camScreen])]] remoteExec ["addAction",0]; But this code does not work. _camRender = "renderscreen"; [_camScreen, ["<t color='#e5b348'>Normal View</t>",{[0,_camRender] call fnc_render_camera},[],-1,true,true,"",(format ["((vehicle player) distance (position %1) <= 4)",_camScreen])]] remoteExec ["addAction",0]; I was able to work out how to get the variable _camScreen in using the format code, but I tried to do the same with the _camRender variable and couldn't get it to work. How do I get the local _camRender variable into the [?] call fnc_render_camera array part of the remoteExec code shown above? Hope this makes any sense. Cheers. Share this post Link to post Share on other sites
gokitty1199 225 Posted May 28, 2018 you kinda cant use local variables for this as far as i know, but you can use set/get variable since the variable will be stored on your camScreen object like so _camScreen setVariable ["camRender", "renderscreen", true]; [_camScreen, ["<t color='#e5b348'>Normal View</t>", { _camRender = (_this select 0) getVariable "camRender"; [0,_camRender] call fnc_render_camera; },[],-1,true,true,"","_this distance _target <= 4"]] remoteExec ["addAction",0]; also an easier way to get the distance between a player and the object for the addaction is by doing this _this distance _target <= 4 instead of (format ["((vehicle player) distance (position %1) <= 4) _this is the object the action is applied to, _target is the player Share this post Link to post Share on other sites
cb65 86 Posted May 28, 2018 @gokitty1199 Thanks heaps mate that worked like a charm. Share this post Link to post Share on other sites
HazJ 1289 Posted May 30, 2018 On 5/29/2018 at 12:02 AM, gokitty1199 said: also an easier way to get the distance between a player and the object for the addaction is by doing this _this distance _target <= 4 instead of (format ["((vehicle player) distance (position %1) <= 4) _this is the object the action is applied to, _target is the player There is also the radius parameter for addAction now. Since 1.63 version. Quote radius: Number - (Optional, default 50) 3D distance in meters the unit activating the action must be within to activate it. -1 disables this radius https://community.bistudio.com/wiki/addAction Share this post Link to post Share on other sites