Author Topic: [Solved] What is the syntax for categories: in the items: section?  (Read 2471 times)

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Could someone please give me an example of the syntax for categories: for use with the items: section.

My understanding is that it is possible to allow one item to be in multiple categories, example:

A laser weapon could be in both the categories "Laser Weapons" and "Alien made Laser Weapons" to differentiate it from other weapons found in the category of "X-Com made Laser Weapons".

How do I phrase this on the item?

Is it done like the compatibleAmmo: variable?
Code: [Select]
items:
  - type: STR_EXAMPLE_LASER_RIFLE
    categories:
      - STR_CAT_LASER_WEAPONS
      - STR_CAT_ALIEN_LASER_WEAPONS

Or is it more like this?
Code: [Select]
items:
  - type: STR_EXAMPLE_LASER_RIFLE   
    categories: [ STR_CAT_LASER_WEAPONS, STR_CAT_ALIEN_LASER_WEAPONS ]



I'm assuming that the categories themselves are defined just like an item by placing them after the items: variable like this:
Code: [Select]
items:
# Category for all Laser Weapons
  - type: STR_CAT_LASER_WEAPONS   
    hidden: false

# category for only Alien Laser Weapons
  - type: STR_CAT_ALIEN_LASER_WEAPONS   
    hidden: true

Is that correct?
« Last Edit: February 12, 2023, 09:24:56 am by Meridian »

Offline vadracas

  • Colonel
  • ****
  • Posts: 285
  • Just another player/modder combo.
    • View Profile
Re: (OXCE) What is the syntax for categories: in the items: section?
« Reply #1 on: April 29, 2020, 01:50:18 pm »
items:
  - type: STR_EXAMPLE_LASER_RIFLE   
    categories: { STR_CAT_LASER_WEAPONS, STR_CAT_ALIEN_LASER_WEAPONS }

I believe that is the proper syntax.

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: (OXCE) What is the syntax for categories: in the items: section?
« Reply #2 on: April 29, 2020, 01:53:54 pm »
Is it done like the compatibleAmmo: variable?
Code: [Select]
items:
  - type: STR_EXAMPLE_LASER_RIFLE
    categories:
      - STR_CAT_LASER_WEAPONS
      - STR_CAT_ALIEN_LASER_WEAPONS

Or is it more like this?
Code: [Select]
items:
  - type: STR_EXAMPLE_LASER_RIFLE   
    categories: [ STR_CAT_LASER_WEAPONS, STR_CAT_ALIEN_LASER_WEAPONS ]

Both. It is the two ways to define sets in ruleset files.

Quote
I'm assuming that the categories themselves are defined just like an item by placing them after the items: variable like this:
Code: [Select]
items:
# Category for all Laser Weapons
  - type: STR_CAT_LASER_WEAPONS   
    hidden: false

# category for only Alien Laser Weapons
  - type: STR_CAT_ALIEN_LASER_WEAPONS   
    hidden: true

Is that correct?
No, you need another .rul file
Code: [Select]
itemCategories:
  - type: STR_CAT_LASER_WEAPONS   
    listOrder: 2
  - type: STR_CAT_ALIEN_LASER_WEAPONS   
    listOrder: 4

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: (OXCE) What is the syntax for categories: in the items: section?
« Reply #3 on: May 02, 2020, 08:51:28 am »
That makes things much easier.

Thank you for the help.