This issue is related to both direct script commands and corresponding action commands related to interaction with vehicle. I have tried this with M4 Scorcher and M2A1 Slammer vehicles. Result are consistent to a degree and 100% reproducible. There is some serious underlying issue that affects this MP functionality, but luckily not all commands exhibit failure so hopefully someone can just compare source code and see where it fails.
I spawned both vehicles on the server and they had server ownership during testing. When however I changed vehicle locality and transferred ownership to my PC with "setOwner" command before or even while inside for the first time, everything worked without problem. So the issue is with server owned vehicles.
Commands that fail:
player moveInGunner tank
player moveInCommander tank
player moveInTurret [tank, [0]] (gunner)
player moveInTurret [tank, [0,0]] (commander)
player action ["GetInGunner", tank]
player action ["GetInCommander", tank];
If I use these commands on a server owned vehicle for the first time, the player gets in fine. If I get out and try again to use them, commands fail persistently for any consecutive tries. If I log out, log in, commands work again but only for the 1st time and then they fail as usual.
Range of fail:
- Nothing happens as if command ignored
- Unit fails to enter designated seat yet camera switches to the vehicle's "external" view
- Unit does enter but the camera still switches to "external" view
(2 and 3 are more common with use of xxxTurret commands)
Depending on if the command was executed on the server (action commands) where vehicle is local or on the client, the failure manifestation could vary as per above list.
Commands that work (if executed on server they still work but with noticeable delay):
player action ["GetInTurret", tank, [0]] (gunner)
player action ["GetInTurret", tank, [0,0]] (commander)
moveInDriver command and "GetInDriver" action transfer ownership of the vehicle to the client by default so they work every time all the time. Now before you say haha you noob, these commands are all meant to work with both vehicles and units being local to pc that executes command, moveInCargo command and "getInCargo" action both work even though the ownership of the vehicle doesnt transfer to client.
Basically the failure seem to follow this logic:
Is vehicle local to the server? YES -> Has player been inside already? YES -> Start failing all subsequent scripted attempts. The bug seem to be related to the unit leaving it's "footprint" inside the vehicle. Using default scroll user actions to get in/out of a seat work flawlessly, trying to use scripted interaction after that results in immediate fail (when one of the listed above fail commands used). The fail seem to also be connected to the position. So if I use scroll action get in/out of gunner seat, trying to move unit to gunner seat with script will fail but might work with moving unit in commander (only for the first time).
Sorry for the long report, I spent good part of the morning trying to make sense of this bug. Hope you find what is causing it.