Home   Help Search Login Register  

Author Topic: creating crewed vehicles in MP  (Read 1474 times)

0 Members and 2 Guests are viewing this topic.

Pravit

  • Guest
creating crewed vehicles in MP
« on: 14 Jul 2005, 01:59:18 »
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!
« Last Edit: 14 Jul 2005, 02:58:38 by Pravit »

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:creating crewed vehicles in MP
« Reply #1 on: 14 Jul 2005, 07:44:18 »
I've had problems in the past with trying to spawn units into a group and make them use the 'move' command. The problem turned out to be the code I was putting in their init field:

grpx = group this; deletevehicle this

Turned out the group would be defined on the server, but not on all of the clients (I guess it got deleted before the group was registered on everybody). I fixed it by making a script called "delete.sqs", which looked like this:

~1
deletevehicle _this

Then I'd put this in the unit's init fields:

grpx = group this; this exec "delete.sqs"

Once I did that, my scripts suddenly worked. I'd suggest trying to do the same thing.

HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:creating crewed vehicles in MP
« Reply #2 on: 14 Jul 2005, 14:52:41 »
had the same prtoblem too when referring to groupnames that were initialised in a units init field

I found the best solution was to initialise the group name in the init.sqs, solved lots of problems

eg

tx_mygroup = group W1

where W1 is a unit name
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Pravit

  • Guest
Re:creating crewed vehicles in MP
« Reply #3 on: 14 Jul 2005, 17:51:31 »
Yeah, setting a delay and then deleting them works! Thanks, guys.

Another question: Can I spawn a vehicle with its engines on? It's not so important for a tank or something, but helicopters take quite a while to power up their rotors and if I spawn them in the air, they may crash in the meantime...

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:creating crewed vehicles in MP
« Reply #4 on: 14 Jul 2005, 19:57:15 »
use the following line after you have placed a crew in the helo

vehiclename flyinheight 70
« Last Edit: 14 Jul 2005, 19:58:14 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Pravit

  • Guest
Re:creating crewed vehicles in MP
« Reply #5 on: 15 Jul 2005, 02:48:47 »
Neat, thanks!

One other quick question - do hints work in MP? I'm aware it needs to be run locally but it doesn't seem to be working. I was testing a mission with a friend who heard "dings" but didn't see any hints. My init.sqs looks like this:
[] exec "objectives.sqs"

and objectives.sqs just looks something like this:

@basedestroyed
hint "Base destroyed!"
« Last Edit: 15 Jul 2005, 02:49:01 by Pravit »