aliens

Author Topic: Is it possible to create units with 2 fixed weapons?  (Read 6698 times)

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Is it possible to create units with 2 fixed weapons?
« on: November 22, 2017, 09:15:33 am »
I was reading the [HWP] Attack Dog forum thread and I noticed Dioxine mentioning that units cannot have 2 fixed weapons.
. . . YOU of all people should know you can't have 2 fix'd weapons... at least not until you code it :)

Is this inability still present as of the latest OpenXcom Nightlies release? (2017-11-09)


. . . but I'll be keeping its one "hand" empty despite the new ability to block it with an offhand fixed weapon (thanks, Warboy!)
This quote seems to imply that it was added, but I haven't located additional information on how to assign an offhand fixed weapon yet.
« Last Edit: November 22, 2017, 09:32:17 am by The Martian »

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Is it possible to create units with 2 fixed weapons?
« Reply #1 on: November 22, 2017, 09:29:40 am »
refer to triscenes and bio drones in the TFTD ruleset

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Is it possible to create units with 2 fixed weapons?
« Reply #2 on: November 22, 2017, 09:34:41 am »
Thank you! ^_^

I'll look them up immediately.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Is it possible to create units with 2 fixed weapons?
« Reply #3 on: January 16, 2018, 10:48:23 am »
refer to triscenes and bio drones in the TFTD ruleset
I've been trying to get the HWP with two ranged weapons to work using sections of the Bio Drone code.

So far the best I've managed to do is an HWP with 1 melee weapon and 1 ranged weapon... which is unloaded when playing in "New Battle" mode. (Not sure why.)

The unit is going to be a X-Com HWP not an alien one if that makes a difference.

I have a few questions but first I'll post the relevant code.
(I'll also attach an example .rul containing the code to this post for convenience.)


Items:
Code: [Select]
Items:
  - type: STR_TEST_ARMOR
    size: 6
    costSell: 8000
    transferTime: 48
    weight: 1
    bigSprite: 1
    floorSprite: 0
    handSprite: 0
    power: 10
    damageType: 7
    meleeSound: 93
    accuracyMelee: 95
    tuMelee: 10
    battleType: 3
    fixedWeapon: true
    clipSize: -1
    invWidth: 2
    invHeight: 3
    listOrder: 1075

Units:
Code: [Select]
Units:
  - type: STR_TEST_ARMOR
    race: STR_TEST_ARMOR
    rank: STR_LIVE_TERRORIST
    stats:
      tu: 80
      stamina: 120
      health: 140
      bravery: 100
      reactions: 40
      firing: 90
      throwing: 0
      strength: 120
      psiStrength: 90
      psiSkill: 0
      melee: 1
    armor: STR_TEST_ARMOR_UC
    standHeight: 17
    floatHeight: 2
    kneelHeight: 12
    value: 25
    deathSound: 57
    intelligence: 7
    aggression: 2
    specab: 3
    livingWeapon: true
    builtInWeapons:
      - STR_TANK_CANNON
      - STR_TANK_ROCKET_LAUNCHER
    moveSound: 66
    specab: 2
    allowInv: false

Armor:
Code: [Select]
Armor:
  - type: STR_TEST_ARMOR_UC
    spriteSheet: XCOM_1.PCK
    spriteInv: MAN_7
    corpseItem: STR_CORPSE_ARMOR
    storeItem: STR_TEST_ARMOR
    weight: 10
    stats:
#       tu: -4
       stamina: -20
       reactions: -20
       firing: -10
    frontArmor: 90
    sideArmor: 70
    rearArmor: 60
    underArmor: 100
    damageModifier:
      - 1.4
      - 1.0
      - 0.7
      - 0.0
      - 1.0
      - 1.0
      - 0.0
      - 1.0
      - 1.0
      - 0.0
    loftempsSet: [ 3 ]


(Question) Why is only one of the builtInWeapons: listed in Units: being equipped?

(Question) Do builtInWeapons: need the listed weapon to have fixedWeapon: true as a property or can normal X-Com soldier weapons also be equipped. (So far only the fixed ones seem to equip, although without loaded ammo.)

(Question) Why is the equipped ranged weapon not being loaded with ammo?

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Is it possible to create units with 2 fixed weapons?
« Reply #4 on: January 16, 2018, 12:07:57 pm »
for one thing you need to include the ammo in the list

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Is it possible to create units with 2 fixed weapons?
« Reply #5 on: January 17, 2018, 08:54:03 am »
I've got it so that the HWP equips with two weapons.

However now the HWP will not appear for selection in the "Equip Craft > Equipment" list.


The only reason I know it is functioning as desired on the battlescape is that the STR_TEST_ARMOR item was already loaded onto the craft from previous versions of the .rul file, so even though it doesn't show up to be equipped it is already on board the craft.

Oddly this also means the "Unload" button in the equipment menu doesn't remove the HWP either.

When I try re-adding any of the variables that seem to allow the HWP to be a selectable item in the equipment menu, one of the HWP's weapons is replaced by what appears to be a melee weapon instead of having the two assigned builtInWeapons:





Here is the code with the HWP working with both weapons, but unable to be selected as craft equipment.
Code: [Select]
units:
  - type: STR_TEST_ARMOR
    race: STR_TEST_ARMOR
    rank: STR_LIVE_TERRORIST
    stats:
      tu: 80
      stamina: 120
      health: 140
      bravery: 100
      reactions: 40
      firing: 90
      throwing: 0
      strength: 120
      psiStrength: 90
      psiSkill: 0
      melee: 1
    armor: STR_TEST_ARMOR_UC
    standHeight: 17
    floatHeight: 2
    kneelHeight: 12
    value: 25
    deathSound: 2
    intelligence: 7
    aggression: 2
    specab: 3
    livingWeapon: true
    builtInWeapons:
      - STR_TANK_CANNON
      - STR_HWP_CANNON_SHELLS
      - STR_TANK_ROCKET_LAUNCHER
      - STR_HWP_ROCKETS
    moveSound: 2
    specab: 2
# ========================================
items:
  - type: STR_TEST_ARMOR
    size: 6
    costSell: 8000
    transferTime: 48
    power: 10
    compatibleAmmo:
      - STR_HWP_CANNON_SHELLS
      - STR_HWP_ROCKETS
    invWidth: 2
    invHeight: 3
    listOrder: 1075
# ========================================
armors:
  - type: STR_TEST_ARMOR_UC
    spriteSheet: XCOM_1.PCK
    spriteInv: MAN_7
    corpseItem: STR_CORPSE_ARMOR
    storeItem: STR_TEST_ARMOR
    weight: 10
    stats:
#       tu: -4
       stamina: -20
       reactions: -20
       firing: -10
    frontArmor: 90
    sideArmor: 70
    rearArmor: 60
    underArmor: 100
    damageModifier:
      - 1.4
      - 1.0
      - 0.7
      - 0.0
      - 1.0
      - 1.0
      - 0.0
      - 1.0
      - 1.0
      - 0.0
    loftempsSet: [ 3 ]
    allowInv: false


Here is the code with the HWP having only one of the weapons and a melee weapon unfortunately appearing in place of the other.
Code: [Select]
units:
  - type: STR_TEST_ARMOR
    race: STR_TEST_ARMOR
    rank: STR_LIVE_TERRORIST
    stats:
      tu: 80
      stamina: 120
      health: 140
      bravery: 100
      reactions: 40
      firing: 90
      throwing: 0
      strength: 120
      psiStrength: 90
      psiSkill: 0
      melee: 1
    armor: STR_TEST_ARMOR_UC
    standHeight: 17
    floatHeight: 2
    kneelHeight: 12
    value: 25
    deathSound: 2
    intelligence: 7
    aggression: 2
    specab: 3
    livingWeapon: true
    builtInWeapons:
      - STR_TANK_CANNON
      - STR_HWP_CANNON_SHELLS
      - STR_TANK_ROCKET_LAUNCHER
      - STR_HWP_ROCKETS
    moveSound: 2
    specab: 2
# ========================================
items:
  - type: STR_TEST_ARMOR
    size: 6
    costSell: 8000
    transferTime: 48
    weight: 1
    bigSprite: 1
    floorSprite: 0
    handSprite: 0
    power: 10
    damageType: 7
    meleeSound: 2
    accuracyMelee: 95
    tuMelee: 10
    battleType: 3
    fixedWeapon: true
    compatibleAmmo:
      - STR_HWP_CANNON_SHELLS
      - STR_HWP_ROCKETS
    clipSize: -1
    invWidth: 2
    invHeight: 3
    listOrder: 1075
# ========================================
armors:
  - type: STR_TEST_ARMOR_UC
    spriteSheet: XCOM_1.PCK
    spriteInv: MAN_7
    corpseItem: STR_CORPSE_ARMOR
    storeItem: STR_TEST_ARMOR
    weight: 10
    stats:
#       tu: -4
       stamina: -20
       reactions: -20
       firing: -10
    frontArmor: 90
    sideArmor: 70
    rearArmor: 60
    underArmor: 100
    damageModifier:
      - 1.4
      - 1.0
      - 0.7
      - 0.0
      - 1.0
      - 1.0
      - 0.0
      - 1.0
      - 1.0
      - 0.0
    loftempsSet: [ 3 ]
    allowInv: false

I'll also attach .rul of both of the above code sections to this post.
« Last Edit: January 17, 2018, 08:57:12 am by The Martian »

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Is it possible to create units with 2 fixed weapons?
« Reply #6 on: January 19, 2018, 01:14:13 am »
I started from scratch and tried using the Bio Drone code to create a X-Com HWP with two ranged weapons.

Here is a step by step of what I did, the .rul of the final result is attached to this post as well.


I'm missing something as it is still not functioning correctly.

(Step 1)

Copy Bio Drone code from X-Com: TFTD's armor.rul (BIODRONE_ARMOR0), unit.rul (STR_BIODRONE_TERRORIST) & item.rul (STR_BIODRONE_TERRORIST).

Code: [Select]
armors:
  - type: BIODRONE_ARMOR0
    spriteSheet: BIODRON.PCK
    allowInv: false
    corpseItem: STR_BIODRONE_CORPSE
    frontArmor: 25
    sideArmor: 15
    rearArmor: 10
    underArmor: 5
    movementType: 1
    damageModifier:
      - 1.0
      - 1.0
      - 0.6
      - 0.6
      - 0.7
      - 0.9
      - 0.9
      - 1.45
      - 0.0
      - 0.9
    loftemps: 2
    drawingRoutine: 16
    constantAnimation: true
Code: [Select]
units:
  - type: STR_BIODRONE_TERRORIST
    race: STR_BIODRONE
    rank: STR_LIVE_TERRORIST
    stats:
      tu: 80
      stamina: 120
      health: 140
      bravery: 100
      reactions: 40
      firing: 90
      throwing: 0
      strength: 120
      psiStrength: 90
      psiSkill: 0
      melee: 1 # vanilla TFTD had this value as 0, but it would still have a 0.89999% chance to hit with an attack.
    armor: BIODRONE_ARMOR0
    standHeight: 17
    floatHeight: 2
    kneelHeight: 12
    value: 25
    deathSound: 57
    intelligence: 7
    aggression: 2
    specab: 3
    livingWeapon: true
    builtInWeapons:
      - STR_BIODRONE_MELEE_WEAPON
      - STR_TRIBIO_SONIC_WEAPON
    moveSound: 66
Code: [Select]
items:
  - type: STR_BIODRONE_TERRORIST
    size: 0.0
    recover: true
    liveAlien: true
    costSell: 60000


(Step 2)

Using the personal armor sprites as a place holder change armors: spriteSheet: to XCOM_1.PCK and spriteInv: to MAN_7.

Code: [Select]
armors:
  - type: BIODRONE_ARMOR0
    spriteSheet: XCOM_1.PCK
    spriteInv: MAN_7


(Step 3)

Change armor: corpseItem: to the personal armor corpse STR_CORPSE_ARMOR and assign the armor to an item in items: via storeItem: STR_TEST_ARMOR.

Code: [Select]
armors:
  - type: BIODRONE_ARMOR0
    corpseItem: STR_CORPSE_ARMOR
    storeItem: STR_TEST_ARMOR


(Step 4)

Added the compatibleAmmo: variables of STR_HWP_CANNON_SHELLS & STR_HWP_ROCKETS to the items: entry. This should cause the HWP to automatically remove ammo from the base store to arm itself when entering battle.

Code: [Select]
items:
  - type: STR_BIODRONE_TERRORIST
    compatibleAmmo:
      - STR_HWP_CANNON_SHELLS
      - STR_HWP_ROCKETS


(Step 5)

Added the two builtInWeapons: and both their ammo to the units: entry. (STR_TANK_CANNON, STR_HWP_CANNON_SHELLS, STR_TANK_ROCKET_LAUNCHER & STR_HWP_ROCKETS)

Code: [Select]
units:
  - type: STR_BIODRONE_TERRORIST
    builtInWeapons:
      - STR_TANK_CANNON
      - STR_HWP_CANNON_SHELLS
      - STR_TANK_ROCKET_LAUNCHER
      - STR_HWP_ROCKETS


(Step 6)

Add fixedWeapon: true to the items: entry so that the HWP weapons cannot be thrown or dropped.

Code: [Select]
items:
  - type: STR_BIODRONE_TERRORIST
    fixedWeapon: true


(Step 7)

Comment out (#) liveAlien: true from the items: entry to make it a X-Com HWP instead of an alien one. I think this "Should" make it able to be selected in the craft equipment screen.

Code: [Select]
items:
  - type: STR_BIODRONE_TERRORIST
#    liveAlien: true


(Step 8)

? ? ?

I'm not sure what to do next. The HWP does not appear as a selectable item in the craft equipment for "New Battle" mode. I'm assuming it also isn't functioning in the main game if it cannot be selected in the instant battle mode.
« Last Edit: January 19, 2018, 01:16:30 am by The Martian »

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1934
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: Is it possible to create units with 2 fixed weapons?
« Reply #7 on: January 19, 2018, 03:55:24 am »
Whew, there is quite a bit going on here, so lets try unpacking it.  I'll try to explain what is necessary to make a working HWP, and then at each step what you've done that works and what doesn't.

The first piece of the HWP puzzle is the item on which it is based.  This item serves two purposes: it counts as the HWP in your bases' stores, and is the first weapon that the HWP has.  Therefore, it needs to be able to be loaded as a weapon first before it'll work as a standalone unit.  This means it needs a battleType, invWidth, invHeight, and a bigSprite (there may be a few other tags) before it can become a 'real' battlescape item.  Then, to be loaded as a unit, the game checks whether it is has fixedWeapon: true.  So for your STR_BIODRONE_TERRORIST weapon, you need to determine whether it is going to be the melee or ranged weapon for your HWP.  I'd suggest making it the ranged weapon, so that you can load the ammunition from stores like normal tanks.  This means it needs the following:
Code: [Select]
items:
  - type: STR_BIODRONE_TERRORIST
    <snip>
    battleType: 1 # It'll be the ranged weapon
    invWidth: 1 # Or whatever matches your bigob
    invHeight: 3 # Or whatever matches your bigob
    bigSprite: 0 # Borrowing the laser rifle sprite for now
This will allow it to load as a unit onto the transport and function! I'll make the aside here, that you don't actually need this weapon to be a functional one in terms of shooting - the built-in weapons (since you have two) from the unit definition will replace this weapon and it won't ever be seen in the game.

Now, onto the unit that gets loaded.  In order to spawn a unit, one needs to exist in ruleset with the same name as the item you just defined... and that's it! The livingWeapon: true part is only to make the code search for weapons with the same name as the unit for spawning alien terrorists, and is thus not necessary for HWPs.  The main bit you'll want is the builtInWeapons to fill out the kit of your new HWP.  The main thing to note is that the items defined here will only fill up the hands of the unit if they're a weapon, or only get loaded in one of the weapons if they're ammo.  This means, as you've defined it, your STR_BIODRONE_TERRORIST will automatically be loaded with a Tank Cannon and a Tank Rocket Launcher, both fully loaded with ammo without needing any in your base's stores.  The STR_BIODRONE_TERRORIST weapon we defined above gets pushed out of the hands of the unit and is never seen.  So you can place any two weapons you want here in builtInWeapons, and have them both show up on the unit!  However, only the first one will ever take ammunition automatically from your base stores.  I recommend having the second item having one of the following:
  • A clip of ammo added to the builtInWeapons list, so it gets free ammo, but making the ammo clip recover: false.
  • Giving the second item a clipSize to use itself as ammo. Basically anything above 0, and you get free ammo at the beginning of the battlescape, or use -1 for infinite ammo.  Also recommend setting recover: false on this item.
  • Setting allowInventory: true on the armor for the unit, so you can load the gun like any other your soldiers might use!

Now, the armor. It's perfectly fine as you've defined it! Okay, it looks a bit weird with the drawing routine, but it functions.

Hope this helps!

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Is it possible to create units with 2 fixed weapons?
« Reply #8 on: January 30, 2018, 05:35:28 am »
Version of OpenXcom I'm using is: 1.0.803ca40a6 (2017-11-09 14:37) (Nightlies)


I've been trying to produce the results you describe, so far I've only managed to accomplish getting the HWP to use the weapon defined in its items: entry and one of the builtInWeapons: the second builtInWeapons: doesn't replace the default weapon for some reason.

Additionally I've noticed that for some reason this HWP can be equipped by regular X-Com soldiers as armor. I'm both unsure why that is occurring or how to prevent it.



If I understand what your saying the HWP should be structured to do, the weapon defined on the HWP's item itself should be used only to pull ammo out of the base store and not as a weapon. (The ammo item itself may be an unrelated item to the two builtInWeapons:, which is a very useful feature!)

The two builtInWeapons: are automatically granted 1 clip worth of their ammo without it being taken from the base inventory.


Here's the code I have so far, the first is a faulty attempt to use two builtInWeapons: that unfortunately doesn't overwrite the default weapon.

Code: [Select]
units:
  - type: STR_BIODRONE_TERRORIST
    race: STR_BIODRONE
    rank: STR_LIVE_TERRORIST
    stats:
      tu: 80
      stamina: 120
      health: 140
      bravery: 100
      reactions: 40
      firing: 90
      throwing: 0
      strength: 120
      psiStrength: 90
      psiSkill: 0
      melee: 1
    armor: BIODRONE_ARMOR0
    standHeight: 17
    floatHeight: 2
    kneelHeight: 12
    value: 25
    deathSound: 57
    intelligence: 7
    aggression: 2
    specab: 3
#    livingWeapon: true
    builtInWeapons:
      - STR_TANK_CANNON
      - STR_HWP_CANNON_SHELLS
      - STR_TANK_ROCKET_LAUNCHER
      - STR_HWP_ROCKETS
    moveSound: 2
# ========================================
items:
  - type: STR_BIODRONE_TERRORIST
    size: 0.0
    recover: true
#    liveAlien: true
    costSell: 60000
    compatibleAmmo:
      - STR_HWP_CANNON_SHELLS
      - STR_HWP_ROCKETS
    fixedWeapon: true
    battleType: 1
    invWidth: 1
    invHeight: 3
    bigSprite: 0
# ========================================
armors:
  - type: BIODRONE_ARMOR0
    spriteSheet: XCOM_1.PCK
    spriteInv: MAN_7
    allowInv: false
    corpseItem: STR_CORPSE_ARMOR
    storeItem: STR_TEST_ARMOR
    frontArmor: 25
    sideArmor: 15
    rearArmor: 10
    underArmor: 5
    movementType: 1
    damageModifier:
      - 1.0
      - 1.0
      - 0.6
      - 0.6
      - 0.7
      - 0.9
      - 0.9
      - 1.45
      - 0.0
      - 0.9
    loftemps: 2
    drawingRoutine: 16
    constantAnimation: true

The second version of this .rul only uses 1 builtInWeapons: to achieve the goal of 2 ranged weapons on an HWP. However strangely it can be equipped as armor by X-Com soldiers.

Code: [Select]
units:
  - type: STR_TEST_HWP
    race: STR_TEST_HWP
    rank: STR_LIVE_TERRORIST
    stats:
      tu: 80
      stamina: 120
      health: 140
      bravery: 160
      reactions: 40
      firing: 90
      throwing: 90
      strength: 70
      psiStrength: 90
      psiSkill: 0
      melee: 1
    armor: STR_TEST_HWP_ARMOR_UC
    standHeight: 21
    floatHeight: 2
    kneelHeight: 16
    value: 25
    deathSound: 2
    intelligence: 7
    aggression: 2
    specab: 2
#    livingWeapon: true
    builtInWeapons:
      - STR_TANK_CANNON
      - STR_HWP_CANNON_SHELLS
    moveSound: 3
# ========================================
items:
  - type: STR_TEST_HWP
    size: 3
    recover: true
#    liveAlien: true
    costSell: 60000
    compatibleAmmo:
      - STR_HWP_CANNON_SHELLS
      - STR_HWP_ROCKETS
    fixedWeapon: true
    battleType: 1
    invWidth: 1
    invHeight: 3
    bigSprite: 0
#    power: 90 # Lowered from 40
    transferTime: 48
#    damageType: 7
#    meleeSound: 93
#    accuracyMelee: 95
#    tuMelee: 10
    accuracySnap: 135
    accuracyAimed: 155
    tuSnap: 28
    tuAimed: 65
    aimRange: 14
    snapRange: 8
    dropoff: 6
    fireSound: 1
    listOrder: 1085
# ========================================
armors:
  - type: STR_TEST_HWP_ARMOR_UC
    spriteSheet: XCOM_1.PCK
    spriteInv: MAN_7
    allowInv: false
    corpseItem: STR_CORPSE_SUIT
    storeItem: STR_TEST_HWP
    frontArmor: 55
    sideArmor: 35
    rearArmor: 45
    underArmor: 50
    movementType: 0
    damageModifier:
      - 1.0
      - 1.0
      - 0.0
      - 0.6
      - 0.7
      - 0.9
      - 0.9
      - 1.45
      - 0.7
      - 0.9
    loftemps: 2
    drawingRoutine: 0
#    constantAnimation: true

(I've attached the above code as .rul files to this post as well for convenience.)

So far I've just been going in circles re-coding the same .rul from the Bio Drone code example without success, I'm hoping someone can spot what I'm doing wrong as this is rather frustrating.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1934
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: Is it possible to create units with 2 fixed weapons?
« Reply #9 on: January 30, 2018, 05:53:05 am »
To start off, I'm working with the second example ruleset you posted (STR_TEST_HWP).  To make it not equip-able by X-Com soldiers, remove the storeItem line from the armor ruleset; this is not necessary for HWPs, and since the armor doesn't restrict which units can wear it, the soldiers see this item in stores as an equip-able armor.

For the point about pulling ammo out of the base's stores - you can only do that for the item/weapon that defines the HWP.  The builtInWeapons cannot automatically pull from the base stores.  If you want builtInWeapons to use an item to load them that isn't also built-in, then you need to enable inventory for that unit/armor and load it like any weapon you'd load on a soldier.  I repeat, only the STR_TEST_HWP weapon can pull ammo directly out of a base's stores.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Is it possible to create units with 2 fixed weapons?
« Reply #10 on: January 30, 2018, 06:52:43 am »
To start off, I'm working with the second example ruleset you posted (STR_TEST_HWP).  To make it not equip-able by X-Com soldiers, remove the storeItem line from the armor ruleset; this is not necessary for HWPs, and since the armor doesn't restrict which units can wear it, the soldiers see this item in stores as an equip-able armor.
Thank you the X-Com soldiers are no longer able to wear tanks into battle.

For the point about pulling ammo out of the base's stores - you can only do that for the item/weapon that defines the HWP.  The builtInWeapons cannot automatically pull from the base stores.  If you want builtInWeapons to use an item to load them that isn't also built-in, then you need to enable inventory for that unit/armor and load it like any weapon you'd load on a soldier.  I repeat, only the STR_TEST_HWP weapon can pull ammo directly out of a base's stores.
What I meant is that because only the HWP item itself removes ammo from the base stores and the two builtInWeapons: automatically fill up without expending an item, the base HWP item can use an unrelated weapon ammo item which can theoretically be very useful in controlling tank deployment cost.

(Example)
Tank Requires 1 "Box of Tank Ammo" item to enter battle.
- Built-In-Weapon #1: Has a clip of 25. (It's ammo is built in and not taken from base stores)
- Built-In-Weapon #2: Has a clip of 5. (It's ammo is built in and not taken from base stores)

Both the builtInWeapons: ammo refilling is unrelated to the HWP item ammo, the "Box of Tank Ammo" item just controls how much of that item is spent from the base stores to launch the HWP into battle.


Which means that if I'm understanding what you're saying the method where a HWP uses 2 builtInWeapons: instead of the HWP's base item weapon and 1 builtInWeapons: is better as it grants more flexibility in controlling the cost of deploying the tank.