Jump to content
Freddywall

moveincargo problem

Recommended Posts

I'm trying to make a script to move a specific player to the vehicle but it only works on AI
FREDDY_FNC_GETINVEH =
{
private ["_unit"];
_unit = cursorTarget;
_nearestVehicle = nearestObjects[getPosATL player,["Car","Ship","Submarine","Air"],10] select 0;
if (isNil "_nearestVehicle") exitWith {};
_unit moveInCargo _nearestVehicle;

};


Calling the function via the GUI:
action = "remoteExecCall ['FREDDY_FNC_GETINVEH', 0, true];";

Share this post


Link to post
Share on other sites
17 hours ago, Freddywall said:

_unit = cursorTarget;

 

this is why it only works on AI as player cant target him self

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, gc8 said:

 

this is why it only works on AI as player cant target him self

But you can target another player. Not sure he agrees, but it's another point.

The problem here, is probably a locality issue as moveInCargo should run on target's PC.

So a:

[_unit, _nearestVehicle] remoteExec ["moveInCargo", _unit];

could work...

Not tested. I don't understand the: action = "remoteExecCall ['FREDDY_FNC_GETINVEH', 0, true]; 

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, pierremgi said:

But you can target another player. Not sure he agrees, but it's another point.

 The problem here, is probably a locality issue as moveInCargo should run on target's PC.

 So a:

[_unit, _nearestVehicle] remoteExec ["moveInCargo", _unit];

 could work...

Not tested. I don't understand the: action = "remoteExecCall ['FREDDY_FNC_GETINVEH', 0, true]; 

it works, ty

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

×