OpenXcom Forum

OpenXcom Forks => OpenXcom Extended (OXCE) => OXCE Support => Topic started by: The Martian on April 29, 2020, 12:54:21 pm

Title: [Solved] What is the syntax for categories: in the items: section?
Post by: The Martian on April 29, 2020, 12:54:21 pm
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?
Title: Re: (OXCE) What is the syntax for categories: in the items: section?
Post by: vadracas 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.
Title: Re: (OXCE) What is the syntax for categories: in the items: section?
Post by: Nord 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
Title: Re: (OXCE) What is the syntax for categories: in the items: section?
Post by: The Martian on May 02, 2020, 08:51:28 am
That makes things much easier.

Thank you for the help.