aliens

Author Topic: 1x1 size hwp unit with ammo: ok in battle but can't into craft  (Read 4435 times)

Offline robin

  • Commander
  • *****
  • Posts: 1057
  • ULTIMATE ROOKIE
    • View Profile
1x1 size hwp unit with ammo: ok in battle but can't into craft
« on: December 10, 2015, 12:19:42 am »
items:
  - type: STR_ROBOTURRET_XCOM_CANNON
    size: 3
    costBuy: 80000
    costSell: 60000
    transferTime: 96
    weight: 1
    bigSprite: 130
    floorSprite: 0
    handSprite: 0
    bulletSprite: 3
    fireSound: 520
    fixedWeapon: true  # true/false doesn't seem to change anything
    invWidth: 2
    invHeight: 3
  - type: AUX_TANK_CANNON
    weight: 1
    bigSprite: 130
    bulletSprite: 3
    fireSound: 520
    compatibleAmmo:
      - AUX_TANK_CANNON_ROUNDS
    accuracyAuto: 35
    tuAuto: 25
    battleType: 1
    fixedWeapon: true
    invWidth: 2
    invHeight: 3
    bulletSpeed: 2
    recover: false
    autoShots: 3
  - type: AUX_TANK_CANNON_ROUNDS
    size: 0.0
    costBuy: 30
    costSell: 20
    transferTime: 48
    weight: 8
    bigSprite: -1
    floorSprite: 12
    hitSound: 13
    hitAnimation: 26
    power: 50
    damageType: 1
    clipSize: 60
    battleType: 2
    invWidth: 2
    invHeight: 1

units:
  - type: STR_ROBOTURRET_XCOM_CANNON
    race: STR_ROBOTURRET_XCOM
    stats: &statsRoboturret
      tu: 50
      stamina: 5
      health: 75
      bravery: 110
      reactions: 50
      firing: 60
      throwing: 0
      strength: 50
      psiStrength: 100
      psiSkill: 0
      melee: 50
    armor: ROBOTURRET_XCOM_CANNON_ARMOR
    standHeight: 19
    value: 10
    deathSound: 23
    moveSound: 14
    intelligence: 2
    aggression: 0
    energyRecovery: 50
    #livingWeapon: true
    builtInWeapons:
      - AUX_TANK_CANNON
      - AUX_TANK_CANNON_ROUNDS

an 1x1 szie hwp unit
  • the unit works perfectly in quick battle;
  • (campaign) i can buy both the unit-item and the ammo-item, but the unit doesn't appear at all in the "equip craft" list of items, so i can't put it on crafts;
  • (campaign) the units is actually spawned an works correctly on base defense mission, which is super-cool! because it is intended to be defense-only unit (see screen);
still, i don't like thing happening randomly, i'd like to understand why it works correctly in some scenarios and not at all in others.

halp
« Last Edit: December 10, 2015, 12:22:31 am by robin »

Offline R1dO

  • Colonel
  • ****
  • Posts: 308
    • View Profile
Re: 1x1 size hwp unit with ammo: ok in battle but can't into craft
« Reply #1 on: December 10, 2015, 02:15:20 am »
I think you forgot to define:
Code: [Select]
item:
...
battleType: 1
...
For your HWP. When not defined it defaults to 0 (=BT_NONE).
The craftEquipment code hides all BT_NONE (and some others).

Hope it helps.

Offline robin

  • Commander
  • *****
  • Posts: 1057
  • ULTIMATE ROOKIE
    • View Profile
Re: 1x1 size hwp unit with ammo: ok in battle but can't into craft
« Reply #2 on: December 10, 2015, 10:37:27 am »
I think you forgot to define:
Code: [Select]
item:
...
battleType: 1
...
For your HWP. When not defined it defaults to 0 (=BT_NONE).
The craftEquipment code hides all BT_NONE (and some others).

Hope it helps.
that fixes the "not appearing on equip-craft list", bur rises a whole new deal of problems:

i'm using bultInWeapons for the unit because otherwise only ammo-less weapons are allowed on a unit (livingWeapon); unless the item for the unit has turretType, which can't be this case since it is not a turret of a tank, but a whole unit.
so "battleType: 1" adds a main weapon to the unit, which occupies the right slot, pushing the builtInWeapon into the left slot.
the right main weapon can, as said above, only work ammo-less (unless turret); if try to add ammo, in battle it only has 1 ammo (and also it freezes my game when i click to use it).

i'm starting to think 1x1 size hwps *with ammo* are impossible to do.

(btw i'm actually cool with it being a base-defense-only unit; just want to understand want can/can't be done).
« Last Edit: December 10, 2015, 10:45:21 am by robin »

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1350
    • View Profile
Re: 1x1 size hwp unit with ammo: ok in battle but can't into craft
« Reply #3 on: December 10, 2015, 11:36:45 am »
There are some mods out there with 1x1 HWPs apparently working, you might look to them for tips, compare with what you have and see what they did differently. I haven't tested any but I see decent ratings so I assume they work.

HWP Drones - Power suit HWPs:
https://www.openxcom.com/mod/hwp-drones-power-suit-hwps

Tanks, Drones, Sectopods? Oh My!:
https://www.openxcom.com/mod/tanks-drones-sectopods-oh-my

And if those don't work, someone made one using soldier code...
X-COM Enforcer:
https://www.openxcom.com/mod/x-com-enforcer

Offline robin

  • Commander
  • *****
  • Posts: 1057
  • ULTIMATE ROOKIE
    • View Profile
Re: 1x1 size hwp unit with ammo: ok in battle but can't into craft
« Reply #4 on: December 10, 2015, 04:05:39 pm »
thanks. will look into them when i have time, but reading the descriptions they seem to suffer the limitations i'm already experiencing (specifically: they use ammo-less weapons to work).

Offline XOps

  • Colonel
  • ****
  • Posts: 193
  • Guy who drowns first
    • View Profile
Re: 1x1 size hwp unit with ammo: ok in battle but can't into craft
« Reply #5 on: December 10, 2015, 05:35:11 pm »
i'm starting to think 1x1 size hwps *with ammo* are impossible to do.

I have a 1x1 HWP that uses an ammo based weapon

Code: [Select]
  - type: STR_UAV_ROCKET_LAUNCHER
    size: 5
    costSell: 350000
    bigSprite: 960
    floorSprite: 960
    handSprite: 0
    bulletSprite: 0
    fireSound: 1001
    compatibleAmmo:
      - STR_UAV_ROCKETS
    accuracySnap: 40
    accuracyAimed: 115
    tuSnap: 25
    tuAimed: 70
    battleType: 1
    fixedWeapon: true
    invWidth: 2
    invHeight: 3
    listOrder: 1510
  - type: STR_UAV_ROCKETS
    size: 0.6
    costSell: 2250
    weight: 1
    bigSprite: -1
    floorSprite: 16
    hitSound: 0
    hitAnimation: 0
    power: 70
    damageType: 3
    clipSize: 4
    battleType: 2
    invWidth: 2
    invHeight: 3
    listOrder: 1511
   
  - type: STR_UAV_ROCKET_LAUNCHER
    race: STR_UAV
    stats:
      tu: 140
      stamina: 110
      health: 20
      bravery: 110
      reactions: 20
      firing: 70
      throwing: 0
      strength: 10
      psiStrength: 110
      psiSkill: 0
      melee: 0
    armor: UAV_ARMOR2
    standHeight: 10
    kneelHeight: 10
    floatHeight: 15
    value: 15
    deathSound: 12
    energyRecovery: 50
    moveSound: 1000

However, I don't use any aux weapons, just the main weapon. Perhaps that's the problem? I've never tried giving an HWP more than one of weapon.

Edit: BTW, nice robot  :)

Offline robin

  • Commander
  • *****
  • Posts: 1057
  • ULTIMATE ROOKIE
    • View Profile
Re: 1x1 size hwp unit with ammo: ok in battle but can't into craft
« Reply #6 on: December 10, 2015, 05:59:26 pm »
interesting, will copypaste!

(on my end i also noticed that the weapon listed under builtInWeapons *with ammo*, has its ammo filled --in battle-- even if you don't have ammo for it in store.)
moar testing incoming i guess, when i can.

Offline robin

  • Commander
  • *****
  • Posts: 1057
  • ULTIMATE ROOKIE
    • View Profile
Re: 1x1 size hwp unit with ammo: ok in battle but can't into craft
« Reply #7 on: December 10, 2015, 09:38:54 pm »
so yeah, it appears that HWP builtInWeapon ammo are fully loaded regardless that you actually have the ammo-item or not in store. the clipSize set for the ammo-item will only work as a "limiter" for how many times you can shoot in a single battle.

this "limiter" behavior can be reproduced also for not-builtInWeapons (weapons that use fixedWeapon: true that is, like XOp's UAV), by removing the weapon ammo dependency and adding a finite "clipSize" to the weapon.
example XOps' UAV: if you remove the rocket ammo and add, say, "clipSize: 4" to the launcher item, it will work like that, meaning that ech time you go into battle, it will have 4 rocket.
in battle, once ammo are depleted (0 ammo), the weapon icon will disappear from the unit hand; but  the hwp itself won't be removed from your possessions and in the next battle everything will be restored.


XOps you should be aware (and you probably are, but better be sure) that your STR_UAV_ROCKETS item only counts as 1 rocket ingame, despite "clipSize: 4"; so you have to buy 4 of them to fully equip your uav launcher.

Offline R1dO

  • Colonel
  • ****
  • Posts: 308
    • View Profile
Re: 1x1 size hwp unit with ammo: ok in battle but can't into craft
« Reply #8 on: December 10, 2015, 09:58:45 pm »
Regarding clipsize and weapon ammo .. your statement is only true when the vehicle itself has no clipsize defined

If the vehicle has a defined clipsize .. the game will regard that as the amount of projectiles a vehicle can carry. The clipsize of the corresponding ammo in that case is seen as number of projectiles added per clip.

Offline robin

  • Commander
  • *****
  • Posts: 1057
  • ULTIMATE ROOKIE
    • View Profile
Re: 1x1 size hwp unit with ammo: ok in battle but can't into craft
« Reply #9 on: December 10, 2015, 10:08:51 pm »
Regarding clipsize and weapon ammo .. your statement is only true when the vehicle itself has no clipsize defined

If the vehicle has a defined clipsize .. the game will regard that as the amount of projectiles a vehicle can carry. The clipsize of the corresponding ammo in that case is seen as number of projectiles added per clip.
hum from my testing, the number of projectiles added per clip is always only 1, regardless of clipSize. even discussing it on irc with warboy and supsuper seemed to confirm this.
will check again...

Offline R1dO

  • Colonel
  • ****
  • Posts: 308
    • View Profile
Re: 1x1 size hwp unit with ammo: ok in battle but can't into craft
« Reply #10 on: December 10, 2015, 10:26:21 pm »
hum from my testing, the number of projectiles added per clip is always only 1, regardless of clipSize. even discussing it on irc with warboy and supsuper seemed to confirm this.
will check again...
I'm not sure when you had that discussion, but there were some changes in this part on 16-11 (commit a78d79).
So perhaps it has changed in your favor, or i might just be interpretate you wrong and you only want to define clipsize on one entity.

Offline XOps

  • Colonel
  • ****
  • Posts: 193
  • Guy who drowns first
    • View Profile
Re: 1x1 size hwp unit with ammo: ok in battle but can't into craft
« Reply #11 on: December 10, 2015, 11:54:11 pm »
XOps you should be aware (and you probably are, but better be sure) that your STR_UAV_ROCKETS item only counts as 1 rocket ingame, despite "clipSize: 4"; so you have to buy 4 of them to fully equip your uav launcher.

I am aware. It's just that none of you appreciate the haphazard and hastily thrown together genius of my naming systems. :)