Author Topic: [Solved] Incomplete Deployment Data Causes Hang  (Read 2681 times)

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
[Solved] Incomplete Deployment Data Causes Hang
« on: September 17, 2018, 10:19:45 am »
In a mod I made a change to the itemSets on one particular rank on one deployment, and the mod ran fine but attempting to get into a mission with that UFO caused the game to hang. With some trial and error I discovered that if I provide data for the itemSets without providing data for the rank quantity, the game hangs.

This code will cause the game to hang:
Code: [Select]
alienDeployments:
  - type: STR_MEDIUM_SCOUT
    data:
      - alienRank: 4
        itemSets:
          -
            - STR_PLASMA_PISTOL
            - STR_PLASMA_PISTOL_CLIP
            - STR_MIND_PROBE
          -
            - STR_PLASMA_RIFLE
            - STR_PLASMA_RIFLE_CLIP
            - STR_MIND_PROBE
          -
            - STR_HEAVY_PLASMA
            - STR_HEAVY_PLASMA_CLIP
            - STR_MIND_PROBE


This code will not cause the game to hang:
Code: [Select]
alienDeployments:
  - type: STR_MEDIUM_SCOUT
    data:
      - alienRank: 4
        lowQty: 1
        highQty: 2
        dQty: 1
        itemSets:
          -
            - STR_PLASMA_PISTOL
            - STR_PLASMA_PISTOL_CLIP
            - STR_MIND_PROBE
          -
            - STR_PLASMA_RIFLE
            - STR_PLASMA_RIFLE_CLIP
            - STR_MIND_PROBE
          -
            - STR_HEAVY_PLASMA
            - STR_HEAVY_PLASMA_CLIP
            - STR_MIND_PROBE


Am I just supposed to include all of the data that I'm not making changes to? How much do I need to include to avoid resetting values to defaults?

I'm not sure if this relates to OXCE+ or OXC.
« Last Edit: February 11, 2023, 05:43:34 pm by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9099
    • View Profile
Re: Bug? Incomplete Deployment Data Causes Hang
« Reply #1 on: September 17, 2018, 10:51:39 am »
Difficult question, because there are exceptions for everything.

But in general:

1. Top-level single-value attributes get inherited from parent

Example: you don't have to redefine a cost of a research topic

2. Going deeper than top-level (e.g. by specifying an array of values) usually removes all old values before new values are loaded by a mod

Example: when you want to add a research dependency, you cannot just add the one missing... you need to specify all of them in the mod... because they get deleted and reloaded...

... same for your deployment question... the "data" attribute is an array that gets deleted and reloaded

PS: same in OXC and OXCE+
« Last Edit: September 17, 2018, 10:53:31 am by Meridian »

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: Bug? Incomplete Deployment Data Causes Hang
« Reply #2 on: September 18, 2018, 12:01:18 am »
Okay I get it, thanks!