OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: Mandoble on 21 Oct 2009, 13:10:22

Title: Weapon Index
Post by: Mandoble on 21 Oct 2009, 13:10:22
Any idea about the logic behind weapon index (used for UseWeapon action)? How can this number be figured out automaticllay?
Title: Re: Weapon Index
Post by: Rommel92 on 21 Oct 2009, 13:41:38
I believe it is the muzzles on the vehicle you are using it on (that includes 'man'). It all varies on the fire modes.
This is based off my experience with using it on ROMM_AI back in the day.
Title: Re: Weapon Index
Post by: Mandoble on 21 Oct 2009, 14:23:24
It might be mix of defined muzzles and defined modes per present weapon, but again I dont see a clear rule there.
Title: Re: Weapon Index
Post by: DeanosBeano on 21 Oct 2009, 18:39:01
 surely the index will match the number at which the weapon is added to the unit ?
 or in the case of a tank plane , it should match the Proxyindex of the turret (turrets canhave more than one weapon tho huh ? hmm) in the cfg file ?

 so far unit should be =
weapons[] = {
        "M4A1_Aim_camo",
        "M9",
        "ItemGPS",
        "Throw",
        "Put",
        "ItemMap",
        "ItemCompass",
        "ItemWatch",
        "ItemRadio",
        "Binocular"
      };

 and vehicle =

 class RightDoorGun : MainTurret
        {
          body = "Turret_2";
          gun = "Gun_2";
          animationSourceBody = "Turret_2";
          animationSourceGun = "Gun_2";
          animationSourceHatch = "";
          selectionFireAnim = "zasleh_1";
          proxyIndex = 2;           <<<<<<<<<<<<<<<<<
          gunnerName = "door gunner";
          commanding = -2;
          minTurn = -150;
          maxTurn = -30;
          initTurn = -90;
          weapons[] = {
            "M240_veh_2"
          };      <<<<<<<<<<<<<<     

 just a guess but if i know BIS , it wont be that straight forward ;).
Title: Re: Weapon Index
Post by: Mandoble on 21 Oct 2009, 19:16:58
Well, for vehicles it seems to match a number which is related to the weapon position in the weapons unit array and the (modes of each weapon read from cfgweapons max 1).
For example, weapons = [A,B,C], A has two modes, B has none (so it counts as 1) and C has none, the weapon index for C is 2 + 1 = 3. But this becomes false for soldiers, with soldiers I've tried to add not only modes but also muzzles, and again the resulting number doesnt match the real index. And soldiers might have the unlisted weapons Throw and Put, so it becomes even more tricky. Anyway there should be a logic behind that, it cannot be a so chaotic number as it seems at first sight.
Title: Re: Weapon Index
Post by: defunkt on 22 Oct 2009, 12:09:38
Didn't we establish that it is logical but without a function to query if the unit is carrying Throw (or Put) weapons we cannot determine it?
Title: Re: Weapon Index
Post by: Mandoble on 22 Oct 2009, 12:18:26
Yes, we can (checking for magazines), but then we should find a rule for the extra indexes derived of having Put magazines or/and Throw magazines. The current rule which works for vehicles count (weapon modes max 1) for each weapon in the order they are returned with "unit weapons" command, doesnt work for soldiers, for soldiers muzzles per each weapon seems to be in the formula too. Also there are "item" weapons that I dont know if should be counted or not (map, gps, etc).
Title: Re: Weapon Index
Post by: defunkt on 22 Oct 2009, 20:11:35
Good (check for magazines) then I suppose it is a matter of dropping everything (you said this will make the first weapon mode/muzzle '0') and trialling one by one items not in the weapons array to try and ascertain how they influence the indexing.