aliens

Author Topic: Trouble with "requires"  (Read 7414 times)

Offline Align

  • Colonel
  • ****
  • Posts: 196
    • View Profile
Trouble with "requires"
« on: January 27, 2015, 10:58:45 pm »
I'm trying to make researching the alien grenade prerequire researching Elerium. I've got a savegame where I researched Elerium and have a grenade stored, but it's not showing up as an option.
https://imgur.com/onylTRR,UreNdsG,3OX7lz9#0

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Trouble with "requires"
« Reply #1 on: January 27, 2015, 11:57:22 pm »
Use

Quote
    dependencies:
      - STR_ELERIUM_115

instead of requires: - from my experience it seems the game only checks the 'requires' if the dependencies are fulfilled. If there aren't any dependencies it will ignore if the 'requires' are fulfilled.
« Last Edit: January 28, 2015, 12:08:48 am by Hobbes »

Offline jackstraw2323

  • Colonel
  • ****
  • Posts: 206
    • View Profile
Re: Trouble with "requires"
« Reply #2 on: January 28, 2015, 12:13:52 am »
Yes not sure of exact logic, but if there's only one requirement you should use the dependency language instead.

Offline Align

  • Colonel
  • ****
  • Posts: 196
    • View Profile
Re: Trouble with "requires"
« Reply #3 on: January 28, 2015, 11:33:22 am »
Thanks, that did it. Although now I've got a different problem:
https://imgur.com/Mm82ZXb,OKv5aaQ,8Cc3laf#0
I wanted to make interrogation require autopsy, but there's something weird going on here...

Offline jackstraw2323

  • Colonel
  • ****
  • Posts: 206
    • View Profile
Re: Trouble with "requires"
« Reply #4 on: January 28, 2015, 04:03:56 pm »
Here are my notes about how it works. I don't remember the exact scenario, but I think get one free is the culprit for weird items showing up in your list that shouldn't be unlocked.

#1) Always have one and only one "requires:" for any UFOPAEDIA entry (cf. XCOMEnforcer below)
#2) Reciprocally, this "requires:" has to trigger one and only one UFOPAEDIA entry (cf. Alloy ammunition below)
#3) If necessary, create a new RESEARCH entry with cost 0 including as dependencies the corresponding "requires:"
#4) getOneFree: seems to need more than one entry, otherwise it unlocks the parent item prematurely it seems.
#5) unlocks can be used to chain several items provided you've got a 0 cost.

Offline Align

  • Colonel
  • ****
  • Posts: 196
    • View Profile
Re: Trouble with "requires"
« Reply #5 on: January 28, 2015, 04:54:38 pm »
I don't think that's it, I haven't used getOneFree so the only entries there would be what vanilla uses, which are all more than one entry.

EDIT: Ah, but the navigator and engineer have getOneFree lists, unlike the soldier which just unlocks. Hmm...

EDIT2: Confirmed, setting getOneFree: [] on the engineer made it unresearchable from start, while navigator (which did not get getOneFree: []) is still bugged. To the bugmobile!
« Last Edit: January 28, 2015, 05:02:07 pm by Align »

Offline jackstraw2323

  • Colonel
  • ****
  • Posts: 206
    • View Profile
Re: Trouble with "requires"
« Reply #6 on: January 28, 2015, 05:21:14 pm »
If you just want to chain one project to the next for free, I.e. Item A gets you item B, use unlocks and set the requirements for time etc on B to 0.

Offline Align

  • Colonel
  • ****
  • Posts: 196
    • View Profile
Re: Trouble with "requires"
« Reply #7 on: January 28, 2015, 05:41:50 pm »
I'd prefer not to touch the getOneFree lists, so I'll wait and see if it gets fixed.

Meanwhile, I've been trying to figure out when to use requires:
Code: [Select]
  - name: STR_TESTME1
    cost: 1
  - name: STR_TESTME2
    cost: 1
  - name: STR_TESTME_HASREQ
    cost: 1
    requires:
      - STR_TESTME1
  - name: STR_TESTME_HASDEP
    cost: 1
    dependencies:
      - STR_TESTME1
  - name: STR_TESTME_HASREQDEP
    cost: 1
    requires:
      - STR_TESTME1
    dependencies:
      - STR_TESTME2
After researching TESTME1, TESTME_HASDEP becomes available, but even after researching that and TESTME2, I can't research TESTME_HASREQ or _HASREQDEP. So is it only usable for cost 0 entries? Like STR_COMMANDER_PLUS in the vanilla ruleset.

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Trouble with "requires"
« Reply #8 on: February 08, 2015, 06:43:32 pm »
Try to use "unlocks" keyword.

Code: [Select]
- name: STR_TESTME1
    cost: 1
    unlocks:
        - STR_TESTME_HASREQ
        - STR_TESTME_HASREQDEP
  - name: STR_TESTME2
    cost: 1
  - name: STR_TESTME_HASREQ
    cost: 1
    requires:
      - STR_TESTME1
  - name: STR_TESTME_HASDEP
    cost: 1
    dependencies:
      - STR_TESTME1
  - name: STR_TESTME_HASREQDEP
    cost: 1
    requires:
      - STR_TESTME1
    dependencies:
      - STR_TESTME2

Offline hellrazor

  • Commander
  • *****
  • Posts: 2027
  • Deep Ruleset Digger & Bughunter
    • View Profile
    • Github Account
Re: Trouble with "requires"
« Reply #9 on: February 10, 2015, 08:07:22 pm »
Code: [Select]
  - name: STR_RESEARCH_PROJECT_1
    dependencies:
      - STR_DEPENDENCY_1
      - STR_DEPENDENCY_2
      - STR_DEPENDENCY_3
      - STR_RESEARCH_PROJECT_1_UNLOCK
  - name: STR_RESEARCH_PROJECT_1_UNLOCK
    requires:
      - STR_DEPENDENCY_1
      - STR_DEPENDENCY_2
      - STR_DEPENDENCY_3
    dependencies:
      - STR_ALIVE_ALIEN
  - name: STR_RESEARCH_PROJECT_2
    dependencies:
      - STR_RESEARCH_PROJECT_1
      - STR_RESEARCH_PROJECT_2_UNLOCK
  - name: STR_RESEARCH_PROJECT_2_UNLOCK
    requires:
      - STR_RESEARCH_PROJECT_1
    dependencies:
      - STR_ALIVE_ALIEN
  - name: STR_ALIVE_ALIEN
    unlocks:
      - STR_RESEARCH_PROJECT_1_UNLOCK
      - STR_RESEARCH_PROJECT_2_UNLOCK

This should work :)
Explanation:
RESEARCH_PROJECT_1 will show up in the Research popup, after DEPENDENCY 1-3 are fullfilled and STR_ALIVE_ALIEN is researched. STR_ALIVE_ALIEN unlocks the last DEPENDENCY -> STR_RESEARCH_PROJECT_1_UNLOCK. Which will only be considered for unlocking after DEPENDENCY 1-3 have been researched.
After this you will see the STR_RESEARCH_PROJECT_1 in the research popup.

STR_RESEARCH_PROJECT_2 will be avaible after another STR_ALIVE_ALIEN has been researched, STR_RESEARCH_PROJECT_2_UNLOCK will not even be considered to be unlocked until STR_RESEARCH_PROJECT_1 is researched and avaible.

Hope this helps :)
« Last Edit: February 10, 2015, 08:22:58 pm by hellrazor »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: Trouble with "requires"
« Reply #10 on: June 27, 2017, 10:26:52 am »
This should work :)

It didn't... but should work now in the latest nightly.