Jump to content
Sign in to follow this  
Coding_Camel

MoveInCargo, possibly locality?

Recommended Posts

So i'm trying to set it up so that if you have a player on the ground in the animation of hands behind head then you can put him in a vehicle.

private ["_vcl","_target","_cop"];
_cop = _this select 0;
_vcl = (nearestobjects [getpos _cop, ["Air", "Ship", "LandVehicle"], 3] select 0);
_target = objNull;


{
if((_x distance _vcl < 10) && (animationstate _x == "civillying01")) then
{
_target = _x;
};
} forEach civarray;


hint format ["%1",_target];

if (isNull _target) then 
{
_cop sideChat "No civilians close enough to your vehicle!";
} else {
_cop sideChat "Civilian has been put in your vehicle!";
_target moveInCargo _vcl;
};

Share this post


Link to post
Share on other sites

The MoveIn-Commands are global in effect, but local in arguments. So if _target isn't local to you, nothing will happen.

If this is a MP mission and the target isn't an AI which is local to your client, you have to execute the code below on the computer of the player you want to get into the vehicle.

I'm not used to other remote execution scripts but the RE-Command so I'll give you a snippet which should work:

private ["_vcl","_target","_cop"];
_cop = _this select 0;
_vcl = (nearestobjects [getpos _cop, ["Air", "Ship", "LandVehicle"], 3] select 0);
_target = objNull;


{
if((_x distance _vcl < 10) && (animationstate _x == "civillying01")) then
{
        _target = _x;
};
} forEach civarray;

if (isNull _target) then 
{
_cop sideChat "No civilians close enough to your vehicle!";
} else {
_cop sideChat "Civilian has been put in your vehicle!";

       getTargetInCar = {
           _car = _this;
           player assignAsCargo _car;
           player moveInCargo _car;
       };
[nil, _target, "loc", rSpawn, _vcl, getTargetInCar] call RE;
};

Share this post


Link to post
Share on other sites

You can put _target in cargo from anywhere by using action

_target action ["moveToCargo", _vcl, 0];

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  

×