Author Topic: [Solved] Random Manufacturing not working?  (Read 4417 times)

wcho035

  • Guest
[Solved] Random Manufacturing not working?
« on: November 21, 2019, 12:07:44 am »
Hi Meridian, I believe this is a valid question for you.

I am trying to implement Manufacturing and I come across some frustrating errors. Maybe it is a bug or two, one sure act as one.

This is my code
For items
items:
  - type: STR_RAIDERCOMMANDER
    size: 0.0
    recover: true
    liveAlien: true
    costSell: 10000
    battleType: 0
  - type: STR_RAIDERLEADER
    size: 0.0
    recover: true
    liveAlien: true
    costSell: 10000
    battleType: 0
  - type: STR_RAIDEROFFICER
    size: 0.0
    recover: true
    liveAlien: true
    costSell: 10000
    battleType: 0
  - type: STR_RAIDERSARGENT
    size: 0.0
    recover: true
    liveAlien: true
    costSell: 10000
    battleType: 0
  - type: STR_RAIDERSOLDIER
    size: 0.0
    recover: true
    liveAlien: true
    costSell: 10000
    battleType: 0

For manufacturing.
manufacture:
  - name: STR_RAIDERCOMMANDER
    category: STR_INTERROGATION
    requiredItems:
      STR_RAIDERCOMMANDER: 1
    randomProducedItems:
      #- [70, {}]                   
      - [34, {STR_MERCSOLDIER_TRAINING: 1}]
      - [33, {STR_ENGINEERITEM: 1}]
      - [33, {STR_SCIENTISTITEM: 1}]
  - name: STR_RAIDERLEADER
    category: STR_INTERROGATION
    requiredItems:
      STR_RAIDERLEADER: 1
    randomProducedItems:
      #- [70, {}]                   
      - [34, {STR_MERCSOLDIER_TRAINING: 1}]
      - [33, {STR_ENGINEERITEM: 1}]
      - [33, {STR_SCIENTISTITEM: 1}]
  - name: STR_RAIDEROFFICER
    category: STR_INTERROGATION
    requiredItems:
      STR_RAIDEROFFICER: 1
    randomProducedItems:
      #- [70, {}]                   
      - [34, {STR_MERCSOLDIER_TRAINING: 1}]
      - [33, {STR_ENGINEERITEM: 1}]
      - [33, {STR_SCIENTISTITEM: 1}]
  - name: STR_RAIDERSARGENT
    category: STR_INTERROGATION
    requiredItems:
      STR_RAIDERSARGENT: 1
    randomProducedItems:
      #- [70, {}]
      - [34, {STR_MERCSOLDIER_TRAINING: 1}]
      - [33, {STR_ENGINEERITEM: 1}]
      - [33, {STR_SCIENTISTITEM: 1}] 
  - name: STR_RAIDERSOLDIER
    category: STR_INTERROGATION
    requiredItems:
      STR_RAIDERSOLDIER: 1
    randomProducedItems:
      #- [70, {}]
      - [34, {STR_MERCSOLDIER_TRAINING: 1}]
      - [33, {STR_ENGINEERITEM: 1}]
      - [33, {STR_SCIENTISTITEM: 1}]       

Short story is, I have capture some soldiers. Trying to interrogate them. Interrogation via the manufacturing method using randomProducedItems.

I follow the syntax from the forum and from XComfiles to double check. The manufacturing outcome, instead of one of three item produced.

Scientist, Engineer and soldier.

I got nothing. I believe this is Bug No 2

For Bug no 1, when I try to produce or interrogate the unit, commander for example. The decrease button, instead of decrease the count, it INCREASE the count by 2. If I make a mistake of increasing the counter by 3, I want to decrease it, instead, it add 2 to be come 5! This increase by a factor of 2.

Please check the screen shot below.
« Last Edit: February 11, 2023, 07:32:04 pm by Meridian »

wcho035

  • Guest
Re: Random Manufacturing not working as intended. Maybe a bug or 2
« Reply #1 on: November 21, 2019, 10:40:44 am »
The rest of the item script I did not include but straight forward.

items:
  - type: STR_ENGINEERITEM
    size: 0.0
    #recover: false
    #liveAlien: false
    costSell: 10000
    #battleType: 0
    #transferTime: 1
  - type: STR_SCIENTISTITEM
    size: 0.0
    #recover: false
    #liveAlien: false
    costSell: 10000
    #battleType: 0
    #transferTime: 1
  - type: STR_MERCSOLDIER_TRAINING
    transferTime: 1
    size: 0.0
    #recover: false
    #liveAlien: false
    costSell: 2000
    #battleType: 0

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: Random Manufacturing not working as intended. Maybe a bug or 2
« Reply #2 on: November 21, 2019, 11:16:37 am »
Just define all manufacture attributes, you're missing space, time, cost, etc.

wcho035

  • Guest
Re: Random Manufacturing not working as intended. Maybe a bug or 2
« Reply #3 on: November 21, 2019, 02:08:07 pm »
Thanks Meridian, adding the cost, space and time solve the bug problem.

Now I have another one, the resources produce by the randomitems.  They are not consumed by requiredItems: from another manufacturing order, which code am I missing here?

Thanks.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: Random Manufacturing not working as intended. Maybe a bug or 2
« Reply #4 on: November 21, 2019, 02:14:21 pm »
They are consumed.

Specify producedItems explicitly.

wcho035

  • Guest
Re: Random Manufacturing not working as intended. Maybe a bug or 2
« Reply #5 on: November 21, 2019, 02:47:00 pm »
I believe I found the fault of this now.

This is my code

  - name: STR_RAIDERCOMMANDER
    category: STR_INTERROGATION
    requiredItems:
      STR_RAIDERCOMMANDER: 1
    randomProducedItems:
      - [60, {}]                   
      - [13, {STR_MERCSOLDIER_TRAINING: 1}]
      - [13, {STR_ENGINEERITEM: 1}]
      - [14, {STR_SCIENTISTITEM: 1}]
    space: 1
    time: 1
    cost: 1

In essence, I am consuming 1 STR_RAIDERCOMMANDER and also producing 1 STR_RAIDERCOMMANDER.

With Manufacturing, the   - name: of the manufacturing item, has to match the ID of the item being manufactured in Items:

Is there a generic header for - name I can use for manufacturing randomProducedItems?

for example

  - name: STR_RAIDERCOMMANDER_INTERROGATION
    category: STR_INTERROGATION
    requiredItems:
      STR_RAIDERCOMMANDER: 1
    randomProducedItems:
      - [60, {}]                   
      - [13, {STR_MERCSOLDIER_TRAINING: 1}]
      - [13, {STR_ENGINEERITEM: 1}]
      - [14, {STR_SCIENTISTITEM: 1}]
    space: 1
    time: 1
    cost: 1

something for the -name without the game crashing at start up saying it can't find something in the items list?

wcho035

  • Guest
Re: Random Manufacturing not working as intended. Maybe a bug or 2
« Reply #6 on: November 21, 2019, 02:58:01 pm »
Don't worry, I solved it. I forgot to input a null item produce after studying your code again.

I think I have this feature lock down and solved.

Thank you Meridian as always.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9101
    • View Profile
Re: Random Manufacturing not working as intended. Maybe a bug or 2
« Reply #7 on: November 21, 2019, 03:03:17 pm »
In essence, I am consuming 1 STR_RAIDERCOMMANDER and also producing 1 STR_RAIDERCOMMANDER.

You said you are checking how other mods do it, why don't you just copy it from there?

There is no magic, just specify explicitly that the project should not produce 1 STR_RAIDERCOMMANDER.

Code: [Select]
producedItems: {}

wcho035

  • Guest
Re: Random Manufacturing not working as intended. Maybe a bug or 2
« Reply #8 on: November 21, 2019, 03:15:51 pm »
Initially, I thought having a producedItems: {} doesn't make sense if you are using  randomProducedItems:.

However, I would like to also understand how the logic behind the coding works instead of plain copying. Now after thinking about it, it make sense. The more time I have tinkering with it.

I have to admit, the Logic behind of this is beautiful, once you come to appreciate of how it works.

Thank you again Meridian.

This is probably the last of the features I am trying to nail down in the prototyping for my mod. The other one is random mission generation, I doubt I have much problem on that area. Again, the old saying, don't count the chicken before they hatch...