Jump to content
Sign in to follow this  
GreatKeeper

Help with addaction using cursor targets

Recommended Posts

  {
        if (vehicle player == player) && (typeOf cursorTarget) == vehicle;
         then {
        _x addAction ["<t color=""#0000FF"">Tow</t>", {hint "test"};, "", 6, false, false, "", "_this distance cursorTarget < 3"];
    };
  } forEach vehicles;

^^^^

Trying to get the above to do my hint "test" when the player is in any vehicle and looking at another vehicle that happens to be less that 3m away. I am execVM'ing the script.

Unfortunately I can't seem to get it to work so does anyone mind showing me a working way or pointing out any errors, much appreciated!

Of course I will replace the hint "test" with an attachTo script but that's not what I need help with :)

Share this post


Link to post
Share on other sites

For one thing, you have an erroneous semicolon after your addAction codeblock

{hint "test"}

Try the following to see if it works for you

{
	_x addAction ["<t color=""0000FF"">Tow</t>", {hint "test"}, "", 6, false, false, "", "_this distance _target < 10 && vehicle _this != _this && _target isKindOf ""LandVehicle"""];
} forEach vehicles

 

Edited by Nikander
addAction distance

Share this post


Link to post
Share on other sites

after if and before then, only it will still not work as typeof cursortarget will never == vehicle and you cannot compare string with object and vehicle needs an argument. I suggest you  check other peoples code or use some examples from wiki

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×