I'm having a problem creating crewed vehicles in MP. In one of my missions, some tanks are created as reinforcements. I create them like this:
(spawntank.sqs)
_spawnpos = _this select 0
_grp = _this select 1
_tank = "T80" createVehicle _spawnpos
"SoldierECrew" createUnit [_spawnpos, _grp]
"SoldierECrew" createUnit [_spawnpos, _grp]
"SoldierECrew" createUnit [_spawnpos, _grp]
_driver = units _grp select 0
_commander = units _grp select 1
_gunner = units _grp select 2
_driver moveindriver _tank
_commander moveincommander _tank
_gunner moveingunner _tank
When I start a multiplayer game and play by myself, it works fine. But when I have someone else playing with me, I get an error about _gunner = units _grp select 2, saying something about a zero divisor. What really confuses me is that I have some other tanks which are also created and crewed in the same manner, and they work fine regardless of if it's only me playing or if there are other players. I have a seperate group for every tank, so select 0, 1, and 2 should always pick the right people. Any help?
I noticed this error happens sometimes even when it doesn't display an error message. I'm guessing the moveindriver etc. commands don't work as I think they do in multiplayer, or I can't select the driver/pilot/whatever with this method?
Also, I create the "groups" by placing a unit in the editor and then writing something like this in the init field:
tankgroup = group this; deletevehicle this
Thanks!