OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: LurchiDerLurch on 15 Sep 2009, 14:59:43

Title: config entry -> difference to arma 1?
Post by: LurchiDerLurch 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
Title: Re: config entry -> difference to arma 1?
Post by: mikey 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 (http://community.bistudio.com/wiki/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 (http://community.bistudio.com/wiki/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.
Title: Re: config entry -> difference to arma 1?
Post by: LurchiDerLurch on 15 Sep 2009, 15:52:48
Many thanks this sounds helpful  :clap: