aliens

Author Topic: Craft suddenly only has 2 weapons?  (Read 2603 times)

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Craft suddenly only has 2 weapons?
« on: January 18, 2022, 08:51:53 am »
OXCE version: OpenXcom Extended 7.2 (v2021-12-24)

I've encountered something a bit odd.

I was using this code to make the Barracuda carry 4 different weapons:

Code: [Select]
crafts:

# [=] Barracuda [=] <1st Fighter>
  - type: STR_BARRACUDA
    sprite: 3
    fuelMax: 800
    damageMax: 120
    speedMax: 2400
    accel: 3
    weapons: 2
    costRent: 600000
    forceShowInMonthlyCosts: true
    costBuy: 600000
    refuelRate: 50
    transferTime: 96
    score: 250
    maxAltitude: 3
    weapons: 4
    weaponTypes:
      - [1, 3]
      - [3]
      - [2]
      - [2]


But now it is only displaying a choice for weapon slot 1 & 2.
Spoiler:



I don't think that I've changed anything that would effect crafts since it was working so this is unexpected, what am I doing wrong?

For convenience I've attached an example mod with this code to this post:
Test Craft Mod V0-1.zip

Offline Buscher

  • Colonel
  • ****
  • Posts: 168
    • View Profile
Re: Craft suddenly only has 2 weapons?
« Reply #1 on: January 18, 2022, 09:55:47 am »
You should probably use a ruleset validator that looks for duplicates. Pedro's at IDT is pretty good if the normal ruleset validator doesn't find them.

Code: [Select]
crafts:
...
  - type: STR_BARRACUDA
    # sprite: 3 # Side remark: That one usually doesn't work for sub mods so well. Especially once you use indices that are higher than the standard xcom1/xcom2 set.
...
    weapons: 2 # duplicate
...
    weapons: 4
    weaponTypes:
      - [1, 3]
      - [3]
      - [2]
      - [2]

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Craft suddenly only has 2 weapons?
« Reply #2 on: January 21, 2022, 12:39:10 pm »
That fixed it.

Copying and pasting led to an embarrassing mistake, thank you for catching it.

Could you elaborate on:
Code: [Select]
    # sprite: 3 # Side remark: That one usually doesn't work for sub mods so well. Especially once you use indices that are higher than the standard xcom1/xcom2 set.

My next step was to add images for at least 12 new craft equipment I'd setup. Can the number of new sprites not exceed the original set and must instead overwrite them?

I'm creating a stand-alone mod for TFTD, is that a sub mod? Or is it a sub mod only when it is a mod for another mod?

Example:
Solarius Scorch's 'The X-Com Files' (Base Mod)
8mono's 'XCom Files Arsenal Additions' (Sub Mod)


You should probably use a ruleset validator that looks for duplicates. Pedro's at IDT is pretty good if the normal ruleset validator doesn't find them.

Unfortunately the ruleset validator is for Visual Studio Code and I'm using Xed so I don't believe that is currently an option for me.

I couldn't find Pedro's ruleset validator on the IDT Modding Hub, could you provide a link? (Or do you mean Pedroterzero himself?)

Offline Buscher

  • Colonel
  • ****
  • Posts: 168
    • View Profile
Re: Craft suddenly only has 2 weapons?
« Reply #3 on: January 21, 2022, 02:11:20 pm »
Could you elaborate on:
My next step was to add images for at least 12 new craft equipment I'd setup. Can the number of new sprites not exceed the original set and must instead overwrite them?

I'm creating a stand-alone mod for TFTD, is that a sub mod? Or is it a sub mod only when it is a mod for another mod?

Example:
Solarius Scorch's 'The X-Com Files' (Base Mod)
8mono's 'XCom Files Arsenal Additions' (Sub Mod)

Technically your mod is a submod to the master xcom2 (TFTD), so it's also a submod. But there is a difference if you make a mod like XCom Files Arsenal Additions for The X-Com Files. There is a batch of IDs for xcom1 and xcom2 that always exist. That's also a reason why your bigobs start at index 100 or so, so you do not disturb the 0..65 range.

Your Barracuda is using the vanilla ID 3, so a reference for it works fine. If XCF had a craft STR_SOME_CRAFT using a sprite: 50 and a submod for XCF copied the entry for STR_SOME_CRAFT, the game wouldn't know where to look. If I recall correctly even
Code: [Select]
sprite: {mod: XCF, index: 50}

wouldn't work. If you want to modify the STR_SOME_CRAFT in a submod you are better off just leaving the sprite info completely out and only modify whatever you wanted (f. ex. damageMax). That's what the comment referred to.

Quote
Unfortunately the ruleset validator is for Visual Studio Code and I'm using Xed so I don't believe that is currently an option for me.

I couldn't find Pedro's ruleset validator on the IDT Modding Hub, could you provide a link? (Or do you mean Pedroterzero himself?)
VS Code works really good for Linux, I use it almost all the time. Sometimes I use mousepad and bash to do specific things.
And yes, I talk about the oxce-yaml-helper written by pedroterzero. The validator found a ton of issues and it is really a great tool. You can checkout the pins of the #vscode-ruleset-tools channel in the IDT discord.

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Craft suddenly only has 2 weapons?
« Reply #4 on: January 22, 2022, 01:48:28 am »
Technically your mod is a submod to the master xcom2 (TFTD), so it's also a submod. But there is a difference if you make a mod like XCom Files Arsenal Additions for The X-Com Files. There is a batch of IDs for xcom1 and xcom2 that always exist. That's also a reason why your bigobs start at index 100 or so, so you do not disturb the 0..65 range.

Your Barracuda is using the vanilla ID 3, so a reference for it works fine. If XCF had a craft STR_SOME_CRAFT using a sprite: 50 and a submod for XCF copied the entry for STR_SOME_CRAFT, the game wouldn't know where to look. If I recall correctly even
Code: [Select]
sprite: {mod: XCF, index: 50}

wouldn't work. If you want to modify the STR_SOME_CRAFT in a submod you are better off just leaving the sprite info completely out and only modify whatever you wanted (f. ex. damageMax). That's what the comment referred to.

That makes sense, thank you for explaining it.

So in the worst case I would have to import the image directly into my own mod's resource folder and link it in the .rul file's extraSprites: section. But as it is already assigned in the main mod if not given a value it will just retain its original image from the other mod.

VS Code works really good for Linux, I use it almost all the time. Sometimes I use mousepad and bash to do specific things.

Microsoft makes very functional software, however 'Embrace, extend, and extinguish'.

I don't enjoy the game they play, so I try to limit my reliance on their products when possible.

And yes, I talk about the oxce-yaml-helper written by pedroterzero. The validator found a ton of issues and it is really a great tool. You can checkout the pins of the #vscode-ruleset-tools channel in the IDT discord.

Thank you for the link I will check it out next time I'm on discord.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: Craft suddenly only has 2 weapons?
« Reply #5 on: January 23, 2022, 02:51:39 am »
Microsoft makes very functional software,
I lol'd. :D

Microsoft makes very functional software, however 'Embrace, extend, and extinguish'.

I don't enjoy the game they play, so I try to limit my reliance on their products when possible.
I feel like using any Microsoft product on any Unix system is the ultimate insult to EEE policy.