Home   Help Search Login Register  

Author Topic: config entry -> difference to arma 1?  (Read 2434 times)

0 Members and 1 Guest are viewing this topic.

Offline LurchiDerLurch

  • Members
  • *
config entry -> difference to arma 1?
« on: 15 Sep 2009, 14:59:43 »
Hello!

I want to find out if a vehicle has a seat for driver/gunner/commander.

in Arma1 this worked fine:

Code: [Select]
getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "hasDriver")
But in the config of arma2 I can't find an entry "hasGunner" or "hasCommander"

How can i figure out that problem then in arma 2 ?  :dry:

thank you

Offline mikey

  • Former Staff
  • ****
  • Whitespace Whore
Re: config entry -> difference to arma 1?
« Reply #1 on: 15 Sep 2009, 15:41:45 »
I'm struggling with the exact same problem for my addon atm, and when I looked at the code of SPON Status last night I saw that spooner used !isNull gunner and vehicle emptyPositions "gunner".

Basically when there is a gunner, the gunner command returns a non-null value (it returns the object in the gunner seat), but when there is no gunner in the vehicle or when the vehicle does not have a gunner slot it returns null. To detect if there is a gunner slot when no one is in a gunner slot, you use " someVehicle emptyPositions "gunner" ", which will return 0 if there are no gunner seats left (or there weren't any to start with), or a value above 0 (could be a multi-turreted vehicle).

I'll try to make some code examples later, because  I haven't really had the time yet to study his code to detail.

Offline LurchiDerLurch

  • Members
  • *
Re: config entry -> difference to arma 1?
« Reply #2 on: 15 Sep 2009, 15:52:48 »
Many thanks this sounds helpful  :clap: