Jump to content
JB47394

Moving vehicle turrets local

Recommended Posts

Is there a way to force ownership of a turret onto a particular machine?  I know that turretOwner is available, but I don't see a setOwnerTurret or setTurretOwner, and setOwner doesn't seem to include the turrets.

My scenario:

Zeus spawns an empty vehicle.  At the appropriate time, a server script takes the vehicle and puts crew into it and sends it on its way.  To do this, the script ensures that the vehicle is first local to the server, then spawns the crew up and issues the appropriate assignAs and moveIn commands.  The driver goes in just fine.  Unfortunately, the turrets on the vehicle are still local to the Zeus client and the moveIn commands for the gunner and commander fail.  As a result, those two have to go through the process of moving to the entry locations on the vehicle and then mounting up.  Sometimes the driver starts off without them.  None of that is desirable.

Note that after the AI have mounted up, the turrets are indeed local to the server.  Repeating the process with that vehicle works just fine, as it does if the vehicle is spawned on the server.

Share this post


Link to post
Share on other sites

I don't have this problem when respawning vehicles with crew. I'm using assignAs and moveIn like you, remoteExecuted on concerned unit.

For Zeus, you can setOwer the vehicle to server before creating crew, I guess.

Share this post


Link to post
Share on other sites

afaik turrets are first located where the vehicle is located. if the first unit embarks then the complete vehicle is located where that unit is located.

if a unit which is located on another machine embarks a turret then this specific turret moves to the machine where it's unit is located.

  • Thanks 1

Share this post


Link to post
Share on other sites
3 hours ago, sarogahtyp said:

if the first unit embarks then the complete vehicle is located where that unit is located.

This is what I ended up with to bring the turrets local.

_vehicle setOwner clientOwner;
waitUntil { local _vehicle }; // Completes in 0.1s
waitUntil { allTurrets _vehicle findIf { (_vehicle turretOwner _x) != clientOwner } == -1 }; // Completes in 2-4s

The turrets will go local if they're just left to do so.  There's no need to add anyone to the driver's seat, nor does that appear to accelerate things.

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

×