Jump to content
GreatKeeper

Issues with caller in addAction whilst in vehicle

Recommended Posts


TEST_Attach = {
      _object = _this select 0;
      _unit = _this select 1;
      _id = _this select 2;
      _object attachTo [_unit, [0,-5,0]];
      _unit removeAction _id;
      _unit setVariable ["object", _object];
      _unit addAction ["<t color=""#FF0000"">Release</t>",{call TEST_Release},"", 12, false, true,"",""];
};

TEST_Release = {
      _unit = _this select 1;
      _id = _this select 2;
      _object = _unit getVariable "object";
      _object attachTo [_unit, [0,-6,0]];
      detach _object;
      _unit removeAction _id;
};


 {_x addAction ["<t color=""#0000FF"">Tow</t>",{call TEST_attach}, "", 12, false, true, "", "_this distance cursorTarget < 5"];
 } forEach vehicles;

I'm new to SQF and I'm having problems. I can't see what I'm doing wrong however that script works perfectly on a player walking around and attaching vehicles and releasing. The problem is if the player or unit is in another car the option comes up however the car they are in instead of the target gets stuck back. I'm not really sure why this works when not in a car but stops working when they get in a car. Any help appreciated!

Share this post


Link to post
Share on other sites

It's just because you are too far (more than 5 meters), but you will have some other problems with that way to tow a vehicle. You have some nice addons for that.

Share this post


Link to post
Share on other sites
1 minute ago, pierremgi said:

It's just because you are too far (more than 5 meters), but you will have some other problems with that way to tow a vehicle. You have some nice addons for that.

Okay thanks I will try increasing distance, this is more of a script to help me learn than one to be released. Thanks!

Share this post


Link to post
Share on other sites

@pierremgi Hi, I'm still having the same problem, when I tow the vehicle my own vehicle gets stuck and 5 metres back. I increased the 

"_this distance cursorTarget < 5" to 20 but it still is having issues.

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

×