Author Topic: OXCE, research: requires + cost ?  (Read 384 times)

Offline robin

  • Commander
  • *****
  • Posts: 1232
  • ULTIMATE ROOKIE
    • View Profile
OXCE, research: requires + cost ?
« on: December 28, 2024, 04:25:14 pm »
Defining both "requires" and "cost" (cost != 0) on a research topic is not allowed.

How should I define the Dimensional Probe research topic:

 - at least one UFO must be researched (each UFO "unlocks" STR_DIMENSIONAL_PROBE).
 - STR_ALIEN_CONTROL_SYSTEM, STR_ALIEN_POWER_SOURCE and STR_ALIEN_PROPULSION_SYSTEM must be all researched.
 - the research topic itself has a cost.

It the only way to split it in two research topics?

Current ruleset:

Code: [Select]
  - name: STR_DIMENSIONAL_PROBE # fake craft
    cost: 120
    points: 10
    requires:
      - STR_ALIEN_CONTROL_SYSTEM
      - STR_ALIEN_POWER_SOURCE
      - STR_ALIEN_PROPULSION_SYSTEM
    dependencies:
      - STR_UFO_ABDUCTOR
      - STR_UFO_AGGRESSOR
      - STR_UFO_ASSAULT_SHIP
      - STR_BATTLESHIP
      - STR_UFO_BOMBER
      - STR_UFO_CARRIER
      - STR_UFO_INCURSOR
      - STR_UFO_MOTHERSHIP
      - STR_UFO_PROBE
      - STR_UFO_SCOUT
      - STR_SUPPLY_SHIP
      - STR_TERROR_SHIP
    needItem: false

Thanks
« Last Edit: December 28, 2024, 04:27:26 pm by robin »

Online CrazedHarpooner

  • Colonel
  • ****
  • Posts: 143
    • View Profile
Re: OXCE, research: requires + cost ?
« Reply #1 on: December 28, 2024, 05:42:04 pm »
I have played around with research topics before. I think I remember a solution that might work for you here.
Let me know if this does the job:
Code: [Select]
  - name: STR_DIMENSIONAL_PROBE_PR # Pre-requisite topic that gets discovered by any UFO
    cost: 0
    points: 0
    dependencies: # Remember to set 'unlocks' to this topic in each of the following
      - STR_UFO_ABDUCTOR
      - STR_UFO_AGGRESSOR
      - STR_UFO_ASSAULT_SHIP
      - STR_BATTLESHIP
      - STR_UFO_BOMBER
      - STR_UFO_CARRIER
      - STR_UFO_INCURSOR
      - STR_UFO_MOTHERSHIP
      - STR_UFO_PROBE
      - STR_UFO_SCOUT
      - STR_SUPPLY_SHIP
      - STR_TERROR_SHIP
    needItem: false

  - name: STR_DIMENSIONAL_PROBE
    cost: 120
    points: 10
    dependencies:
      - STR_ALIEN_CONTROL_SYSTEM
      - STR_ALIEN_POWER_SOURCE
      - STR_ALIEN_PROPULSION_SYSTEM
      - STR_DIMENSIONAL_PROBE_PR # Extra dependancy to the Pre-Requisite topic
    needItem: false


Offline robin

  • Commander
  • *****
  • Posts: 1232
  • ULTIMATE ROOKIE
    • View Profile
Re: OXCE, research: requires + cost ?
« Reply #2 on: December 28, 2024, 06:20:13 pm »
Thanks!
Based on your suggestion I adopted the solution below.
With your code the PR research was visible in the research list, perhaps the cause is the "needItem: false" at the bottom.

Code: [Select]
  - name: STR_DIMENSIONAL_PROBE # fake craft
    cost: 120
    points: 10
    dependencies:
      - STR_DIMENSIONAL_PROBE_PR
    needItem: false

  - name: STR_DIMENSIONAL_PROBE_PR # Prerequisite needed because requires and cost cannot coexist.
    requires:
      - STR_ALIEN_CHITIN
      - STR_ALIEN_CONTROL_SYSTEM
      - STR_ALIEN_POWER_SOURCE
      - STR_ALIEN_PROPULSION_SYSTEM
    dependencies:
      - STR_UFO_ABDUCTOR
      - STR_UFO_AGGRESSOR
      - STR_UFO_ASSAULT_SHIP
      - STR_BATTLESHIP
      - STR_UFO_BOMBER
      - STR_UFO_CARRIER
      - STR_UFO_INCURSOR
      - STR_UFO_MOTHERSHIP
      - STR_UFO_PROBE
      - STR_UFO_SCOUT
      - STR_SUPPLY_SHIP
      - STR_TERROR_SHIP
    #needItem: false

Online CrazedHarpooner

  • Colonel
  • ****
  • Posts: 143
    • View Profile
Re: OXCE, research: requires + cost ?
« Reply #3 on: December 28, 2024, 06:48:56 pm »
I do recall getting 0 cost projects appear on the list when playing around with them. I believe this commonly happens when loading a save in between mod changes. AFAIK, 0 cost topics get instantly completed upon being unlocked from another research, but if that other research was already completed in the save and you make the change, it'll appear on the list of available topcis to be researched. I doubt that it's the needItem flag since its default is false when omitted (so it's still false in your example).

You might have a slight issue when using requires, I'll give an example and you hope you can test it out to make sure.
'requires' topics MUST be completed before dependencies are even considered. For dependencies that set the unlock property to the dependant research it means that they'll be ignored upon their completion and another dependency will have to trigger the unlock.
Let's say I start by an easy UFO, I complete the STR_UFO_PROBE but don't have any of the requirements. I later do start and complete each of the 4 required topics, but the PROBE_PR is not unlocked, now I study another dependency, UFO_SCOUT after all the requirements are met and that should finally unlock. Of course, if I make that research or any other of the dependencies with ANY requirement missing, I would then need another dependency.
I'm unsure what would happen if you exhaust all dependencies before all the requirements are done.

Offline robin

  • Commander
  • *****
  • Posts: 1232
  • ULTIMATE ROOKIE
    • View Profile
Re: OXCE, research: requires + cost ?
« Reply #4 on: December 28, 2024, 07:26:22 pm »
I do recall getting 0 cost projects appear on the list when playing around with them. I believe this commonly happens when loading a save in between mod changes. AFAIK, 0 cost topics get instantly completed upon being unlocked from another research, but if that other research was already completed in the save and you make the change, it'll appear on the list of available topcis to be researched. I doubt that it's the needItem flag since its default is false when omitted (so it's still false in your example).

You might have a slight issue when using requires, I'll give an example and you hope you can test it out to make sure.
'requires' topics MUST be completed before dependencies are even considered. For dependencies that set the unlock property to the dependant research it means that they'll be ignored upon their completion and another dependency will have to trigger the unlock.
Let's say I start by an easy UFO, I complete the STR_UFO_PROBE but don't have any of the requirements. I later do start and complete each of the 4 required topics, but the PROBE_PR is not unlocked, now I study another dependency, UFO_SCOUT after all the requirements are met and that should finally unlock. Of course, if I make that research or any other of the dependencies with ANY requirement missing, I would then need another dependency.
I'm unsure what would happen if you exhaust all dependencies before all the requirements are done.
I see, thank you.
I didn't know about that "requires" behavior, I need to take it account when defining research topics.