luks7n 12 Posted October 17, 2016 Hi, I'm trying to create an addaction code that works only for two specified players (engineer1 and engineer2). I was able to find how does it works for 1 player using: this addAction ["Install radar" , "logistics.sqf",[],1,true,true,"","_this == engineer1 && _this distance container < 5"]; But my mission is going to have more than 1 engineer, so I would like this code to work for engineer1, 2, 3 and so on. I tried this, but didn't work: this addAction ["Install radar" , "logistics.sqf",[],1,true,true,"","((_this == engineer1) or (_this == engineer2)) && _this distance container < 5"]; Any help? Thanks! Share this post Link to post Share on other sites
riten 153 Posted October 17, 2016 You can use array and then check if unit is in array: enginers = ["engineer1", "engineer2"]; // put this in init or trigger (true condition) this addAction ["Install radar" , "logistics.sqf",[],1,true,true,"","(_this in enginers) && _this distance container < 5"]; Share this post Link to post Share on other sites
luks7n 12 Posted October 17, 2016 You can use array and then check if unit is in array: enginers = ["engineer1", "engineer2"]; // put this in init or trigger (true condition) this addAction ["Install radar" , "logistics.sqf",[],1,true,true,"","(_this in enginers) && _this distance container < 5"]; Thanks for the help riten, I tried this but didn't work :/ Share this post Link to post Share on other sites
R3vo 2654 Posted October 17, 2016 [OBJECT,"Install Radar","logistics.sqf",nil,nil,nil,nil,nil,nil,5] remoteExec ["addAction",[engineer1,engineer2]]; replace object with the var name of the object which should have the action. The 5 in the parameters is the radius, same is (_this distance < 5) 2 Share this post Link to post Share on other sites
Larrow 2822 Posted October 17, 2016 Are the actual units engineers? Do you actually only need it for two units or as per your post may be for 1,2,3 ...any number?Instead of having long blah OR blah OR blah, or long arrays of unit names, you could use getUnitTrait for either "engineer" or make one up of your own liking that is applied to the specific units. this addAction [ "Install radar", "logistics.sqf", [], 1, true, true, "", "(_this getUnitTrait 'engineer') && { _this distance container < 5 }" ]; 2 Share this post Link to post Share on other sites
luks7n 12 Posted October 17, 2016 Are the actual units engineers? Do you actually only need it for two units or as per your post may be for 1,2,3 ...any number? Instead of having long blah OR blah OR blah, or long arrays of unit names, you could use getUnitTrait for either "engineer" or make one up of your own liking that is applied to the specific units. this addAction [ "Install radar", "logistics.sqf", [], 1, true, true, "", "(_this getUnitTrait 'engineer') && { _this distance container < 5 }" ]; Sorry for the ambiguity, it is actually for as much units as the mission needs. Thanks for that simple solution Larrow, I just had to setUnitTrait for those units I was interested. :) Share this post Link to post Share on other sites
Exxor 2 Posted October 19, 2016 Thanks lol i was wondering how to do this as well Share this post Link to post Share on other sites