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!