W V 0 Posted March 10, 2020 Hello, i want to have 3 markers on the map where i can get an action 40m from it. i can get it to work if i change (getMarkerPos _markerList) to getMarkerPos 'APF_1' but then only one marker works. it feels really dumb to make 3 actions for the same thing. Do anyone know how to get it to take the names in an array instead? sorry for bad english. _markerList = ["APF_1","APF_2","APF_3"]; player addaction ["<t color='#ff0066'>Plant</t>","actions\plant.sqf", "", 0, true, true, "", "alive _target AND _target distance (getMarkerPos _markerList) <= 40"]; Share this post Link to post Share on other sites
Harzach 2505 Posted March 10, 2020 You need to retrieve the position of each element of the array _markerList separately. We do this using forEach. I can't test right now, but it should be something along the lines of player addaction ["<t color='#ff0066'>Plant</t>","actions\plant.sqf", "", 0, true, true, "", "alive _target AND {_target distance (getMarkerPos _x) <= 40} forEach _markerList"]; Share this post Link to post Share on other sites
mrcurry 468 Posted March 11, 2020 On 3/10/2020 at 2:29 AM, Harzach said: You need to retrieve the position of each element of the array _markerList separately. We do this using forEach. I can't test right now, but it should be something along the lines of player addaction ["<t color='#ff0066'>Plant</t>","actions\plant.sqf", "", 0, true, true, "", "alive _target AND {_target distance (getMarkerPos _x) <= 40} forEach _markerList"]; Unfortunately that's only gonna return the comparison of the last marker in the list. Also _markerList is not defined in the condition scope. Instead use findIf for the condition: "alive _target And TAG_markerList findIf {_target distance2D getMarkerPos _x <= 40} >= 0" and make the list global: TAG_markerList = ["APF_1","APF_2","APF_3"]; 1 Share this post Link to post Share on other sites
pierremgi 4736 Posted March 11, 2020 You can also use the 4th parameter for the scripr of action. (params ["_target", "_caller", "_actionId", "_arguments"];) Share this post Link to post Share on other sites
Harzach 2505 Posted March 11, 2020 2 hours ago, mrcurry said: Unfortunately that's only gonna return the comparison of the last marker in the list. Also _markerList is not defined in the condition scope. Thanks! I had a feeling something wasn't right. As usual, I probably should have stepped away from the keyboard... Share this post Link to post Share on other sites
Larrow 2779 Posted March 11, 2020 1 hour ago, pierremgi said: You can also use the 4th parameter for the scripr of action. (params ["_target", "_caller", "_actionId", "_arguments"];) Supplied arguments are not available in the condition though. Share this post Link to post Share on other sites