Jump to content

Photo
- - - - -

Detect artillery capable vehicles


  • Please log in to reply
5 replies to this topic
gc8
gc8

    Sergeant

  • Members
  • 185 posts

#1

Posted 02 May 2012 - 19:58

hi
Is there a way to detect if vehicle is artillery vehicle? (other than using lists of vehicle types with isKindOf command.)

blakeace
blakeace

    Staff Sergeant

  • Members
  • 353 posts

#2

Posted 03 May 2012 - 02:05

This is the function I created for my AI FO addon. If the result is 1 it is an artillery piece. I haven't found an instance "yet" where it didn't yield the correct result.

_Fnc_Is_Vehicle_Arty =

{

	_Veh = _this select 0;

	_result = 0;

	if (isNumber (configFile >> "CfgVehicles" >> _Veh >> "artilleryScanner")) then

	{

		_result = getNumber (configFile >> "CfgVehicles" >> _Veh >> "artilleryScanner");

	};

	_result

};

Hope this helps
Blake
Posted Image

gc8
gc8

    Sergeant

  • Members
  • 185 posts

#3

Posted 03 May 2012 - 17:36

that seems great thx. now if it were possible to detect between transport helos/planes and attack helos/planes that would be perfect. isKindOf isn't very usefull for this.

Orcinus
Orcinus

    Sergeant Major

  • Members
  • 1571 posts

#4

Posted 03 May 2012 - 20:29

that seems great thx. now if it were possible to detect between transport helos/planes and attack helos/planes that would be perfect. isKindOf isn't very usefull for this.


CfgVehicles has for all air vehicles cargoCompartment entries. For several cargo-capable machines (UH-1, Mi-24, C-130)

driverCompartments="Compartment1";
cargoCompartments[]={"Compartment2"};

You'll need to check, but if the presence of "Compartment2" is restricted to cargo-capable aircraft you could modify blakeace's code appropriately.

Another possibility would be to use "transportSoldier" - returns the number of cargo seats. If 0, it's an attack machine.

edit - should have said

Another possibility would be to look for "transportSoldier" - contains the number of cargo seats. If 0, it's an attack machine.

Edited by Orcinus, 03 May 2012 - 22:10.


gc8
gc8

    Sergeant

  • Members
  • 185 posts

#5

Posted 04 May 2012 - 23:30

thx I found out that this works as well:
getNumber (configFile >> "CfgVehicles" >> _veh >> "transportSoldier")


Orcinus
Orcinus

    Sergeant Major

  • Members
  • 1571 posts

#6

Posted 05 May 2012 - 09:21

Fine :)

Ofc some aircraft will be both cargo-capable & attack capable - for example, an Mi-24V or an Mi-8 (rockets) can do a lot of damage as well as carry troops. Depends what you want to do with your script. If you want to try somehow directing AA fire at attack machines, cargo capacity would be a very poor discriminator.