Author Topic: Editing Research Tree in OpenXCom: "dependencies" with "getOneFree"  (Read 22492 times)

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Editing Research Tree in OpenXCom: "dependencies" with "getOneFree"
« Reply #15 on: April 27, 2016, 09:20:30 pm »
What problems this can lead?

Other mods that you might use, for instance: they might depend on the vanilla settings for research in order to properly work. Or the developers might release a new nightly with ruleset changes and then you'll need to edit the new ruleset. Or you might change something that will cause the ruleset to crash upon loading, and then you won't be able to start xcom2 at all unless you figure out what the error was.

Your method works for small ruleset edits but it's usually better just to create a separate mod the more you're developing it

Offline hellrazor

  • Commander
  • *****
  • Posts: 2027
  • Deep Ruleset Digger & Bughunter
    • View Profile
    • Github Account
Re: Editing Research Tree in OpenXCom: "dependencies" with "getOneFree"
« Reply #16 on: April 27, 2016, 09:25:58 pm »
Other mods that you might use, for instance: they might depend on the vanilla settings for research in order to properly work. Or the developers might release a new nightly with ruleset changes and then you'll need to edit the new ruleset. Or you might change something that will cause the ruleset to crash upon loading, and then you won't be able to start xcom2 at all unless you figure out what the error was.

Your method works for small ruleset edits but it's usually better just to create a separate mod the more you're developing it

Jeah in essence it is better to leave the xcom1 / xcom2 ruleset untouched. You can simply copy over the files you wanna modify into a new directory which you create in your "mods" user directory and edit stuff there.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11702
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Editing Research Tree in OpenXCom: "dependencies" with "getOneFree"
« Reply #17 on: April 27, 2016, 10:53:04 pm »
Not to mention you'll have to do the same every time there's a ruleset update.

Offline Hedron

  • Sergeant
  • **
  • Posts: 16
    • View Profile
Re: Editing Research Tree in OpenXCom: "dependencies" with "getOneFree"
« Reply #18 on: April 27, 2016, 11:31:32 pm »
Other mods that you might use, for instance: they might depend on the vanilla settings for research in order to properly work. Or the developers might release a new nightly with ruleset changes and then you'll need to edit the new ruleset. Or you might change something that will cause the ruleset to crash upon loading, and then you won't be able to start xcom2 at all unless you figure out what the error was.
Your method works for small ruleset edits but it's usually better just to create a separate mod the more you're developing it
With my approach it is much easier to localize errors that occur. No need to guess what is causing the error, this mod or discrepancy of this mod with the master rulesets (like those "old settings").
And when all will work correctly – then it will be possible to do it as a mod.

Jeah in essence it is better to leave the xcom1 / xcom2 ruleset untouched. You can simply copy over the files you wanna modify into a new directory which you create in your "mods" user directory and edit stuff there.
And you can just create a backup and do whatever you want ;)

So don't worry about it.
As he sang once in one of our cartoon cat Leopold: "the Trouble that we will survive:D
« Last Edit: April 28, 2016, 03:03:21 am by Hedron »

Offline hellrazor

  • Commander
  • *****
  • Posts: 2027
  • Deep Ruleset Digger & Bughunter
    • View Profile
    • Github Account
Re: Editing Research Tree in OpenXCom: "dependencies" with "getOneFree"
« Reply #19 on: April 28, 2016, 09:30:17 pm »
With my approach it is much easier to localize errors that occur. No need to guess what is causing the error, this mod or discrepancy of this mod with the master rulesets (like those "old settings").

Once you start working on a bigger Modpack or a total conversion mod, it is really helpful to built stuff as small modular mods, especially newly added content for sake of finding and eliminating errors.
I myself do this everytime once i implement new stuff into my mod, it makes debugging much much easier.

And when all will work correctly – then it will be possible to do it as a mod.
And you can just create a backup and do whatever you want ;)

So don't worry about it.
As he sang once in one of our cartoon cat Leopold: "the Trouble that we will survive:D

Editing the standard master mods rulesets like xcom1 xcom2 is in general a bad idea, as i told you before. Upgrades will most likely reset your changes and working directly in it also has some disadvantages since the files are mostly uncommented and in a specific order (->itemListorder).

It's better to approach stuff with small Mods merge them together so you have in the end what you want or need.

Offline Hedron

  • Sergeant
  • **
  • Posts: 16
    • View Profile
Re: Editing Research Tree in OpenXCom: "dependencies" with "getOneFree"
« Reply #20 on: April 28, 2016, 11:37:57 pm »
I'm not going to argue about the methods of creating mods.
I'm aware of all of the difficulties expressed by you, but I'll deal with them myself.

We digress from the main question:
How can I implement this block of Research-tree:



knowing about this troubles:
• "dependency" don't working with "getOneFree"
• "requires" triggered ONLY in 0-cost researches
• "getOneFree" don't working with "requires"
?

Is there still any ideas?

« Last Edit: April 28, 2016, 11:46:05 pm by Hedron »

Offline Kjotleik

  • Colonel
  • ****
  • Posts: 100
  • I am Kjotleik
    • View Profile
Re: Editing Research Tree in OpenXCom: "dependencies" with "getOneFree"
« Reply #21 on: April 29, 2016, 02:19:11 am »
We digress from the main question:
How can I implement this block of Research-tree:

knowing about this troubles:
• "dependency" don't working with "getOneFree"
• "requires" triggered ONLY in 0-cost researches
• "getOneFree" don't working with "requires"
?

Is there still any ideas?



What happens if you insert a dummy-tech between the Soldier and the Medic?
Something like... (ignore the formating-issues, please)
Code: [Select]
- name: STR_DUMMY_MEDIC
  unlocks:
    - STR_AQUATOID_MEDIC
  requires:
    - STR_AQUATOID_SOLDIER

- name: STR_AQUATOID_MEDIC
  needItem: true
  getOneFree:
    - STR_.......(fill in the list)
  dependencies:
    - STR_DUMMY_MEDIC

Would this have the desired effect of the Medic showing up only after researching the Soldier?
(I'm not a programmer, but this sounds logical to me, at least)

EDIT: And, of course, have no other techs unlocking the Medic!


Sincerely
Kjotleik
« Last Edit: April 29, 2016, 02:24:22 am by Kjotleik »

Offline Hedron

  • Sergeant
  • **
  • Posts: 16
    • View Profile
Re: Editing Research Tree in OpenXCom: "dependencies" with "getOneFree"
« Reply #22 on: April 29, 2016, 02:42:53 am »
What happens if you insert a dummy-tech between the Soldier and the Medic?
Something like... (ignore the formating-issues, please)
Code: [Select]
- name: STR_DUMMY_MEDIC
  unlocks:
    - STR_AQUATOID_MEDIC
  requires:
    - STR_AQUATOID_SOLDIER

- name: STR_AQUATOID_MEDIC
  needItem: true
  getOneFree:
    - STR_.......(fill in the list)
  dependencies:
    - STR_DUMMY_MEDIC
Would this have the desired effect of the Medic showing up only after researching the Soldier?
No. If parameter "getOneFree" present in STR_AQUATOID_MEDIC then parameter "dependencies" will be ignored.
So Aquatoid Medic will be available for researching immediately after his arrival in Alien Containment, even if Aquatoid Soldier (and, of course, STR_DUMMY_MEDIC ) is not researched.
IMHO it's wrong, but it works that way.
« Last Edit: April 29, 2016, 03:04:47 am by Hedron »

Offline Kjotleik

  • Colonel
  • ****
  • Posts: 100
  • I am Kjotleik
    • View Profile
Re: Editing Research Tree in OpenXCom: "dependencies" with "getOneFree"
« Reply #23 on: April 29, 2016, 02:56:45 am »
No. If parameter "getOneFree" present in STR_AQUATOID_MEDIC then parameter "dependencies" will be ignored.
So Aquatoid Medic will be available for researching immediately after his arrival in Alien Containment (even if Aquatoid Soldier is not researched).
IMHO it's wrong, but it works that way.

Hmm...  ???

So, what is needed is a dummy-tech AFTER the Medic (Medic has no getOneFree) like...

Code: [Select]
- name: STR_AQUATOID_MEDIC
  needItem: true
  unlocks: STR_DUMMY_GETONEFREE
  requires: STR_AQUATOID_SOLDIER

- name: STR_DUMMY_GETONEFREE
  cost: 0
  getOneFree:
    - STR_....(fill in the list)


The Medic should now require the Soldier, and the unlocked dummy-tech should give you one for free...?
(It has to work...somehow... right?)


Sincerely
Kjotleik

Offline Hedron

  • Sergeant
  • **
  • Posts: 16
    • View Profile
Re: Editing Research Tree in OpenXCom: "dependencies" with "getOneFree"
« Reply #24 on: April 29, 2016, 03:25:21 am »
So, what is needed is a dummy-tech AFTER the Medic (Medic has no getOneFree) like...
Code: [Select]
- name: STR_AQUATOID_MEDIC
  needItem: true
  unlocks: STR_DUMMY_GETONEFREE
  requires: STR_AQUATOID_SOLDIER

- name: STR_DUMMY_GETONEFREE
  cost: 0
  getOneFree:
    - STR_....(fill in the list)
The Medic should now require the Soldier, and the unlocked dummy-tech should give you one for free...?
(It has to work...somehow... right?)
In this case STR_DUMMY_GETONEFREE will be available for researching right at the beginning of the game.
If add "requires" to STR_DUMMY_GETONEFREE then stops working parameter "getOneFree" :(
« Last Edit: April 29, 2016, 03:35:43 am by Hedron »

Offline Kjotleik

  • Colonel
  • ****
  • Posts: 100
  • I am Kjotleik
    • View Profile
Re: Editing Research Tree in OpenXCom: "dependencies" with "getOneFree"
« Reply #25 on: April 29, 2016, 03:54:01 am »
In this case STR_DUMMY_GETONEFREE will be available for researching right at the beginning of the game.
If add "requires" to STR_DUMMY_GETONEFREE then stops working parameter "getOneFree" :(


Hm. So, basically, the parameter "getOneFree" is hard-coded to ignore "dependencies" and "requires."

That's kind of weird.   :(

Unfortunately, I'm busy all weekend. I'll check back to see if someone else has found the answer in about two weeks. If not, I might try to experiment a little myself...


Sincerely
Kjotleik

Offline Hedron

  • Sergeant
  • **
  • Posts: 16
    • View Profile
Re: Editing Research Tree in OpenXCom: "dependencies" with "getOneFree"
« Reply #26 on: April 29, 2016, 01:21:32 pm »
Hm. So, basically, the parameter "getOneFree" is hard-coded to ignore "dependencies" and "requires."
Not quite so:
• "getOneFree" is hard-coded to ignore "dependencies"
• "requires" is hard-coded to ignore "getOneFree" and "unlocks"
Quote
That's kind of weird.
Just in the original version, such cases were not envisaged, therefore, was not tested in such conditions.

Offline hellrazor

  • Commander
  • *****
  • Posts: 2027
  • Deep Ruleset Digger & Bughunter
    • View Profile
    • Github Account
Re: Editing Research Tree in OpenXCom: "dependencies" with "getOneFree"
« Reply #27 on: April 29, 2016, 02:03:03 pm »
To be even more brief:

What you are trying to achieve is not possible.
Every Alien which is marked as STR_ALIVE_ALIEN and has a appropriate Rank will be sent into the Alien Containment, and units in the Alien Containment are automatically made avaible in the Research Options.

This behaviour is as far as my knowledge goes hardcoded and for good reason.

However you could make the Alien Containment unit require some depenencies to get unlocked, move it further back into the research tree prolonging access to some tech's you usually wanna have quick, like Hyperwave Decoder for example.

It is also better to give the interrogations more meaning, for example you can add a getOneFree list towards any Soldier Rank, automatically unlocking a weapon or ammo type by random, which also would mean they would be avaible for research mutiple times.

The example i posted before mentioning the YAML anchors will help with this to a great deal, since in the end you only have 1 place to change your lists and it would be automatically applied to all the other places the list is called. Also removes redundencies.

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: Editing Research Tree in OpenXCom: "dependencies" with "getOneFree"
« Reply #28 on: April 29, 2016, 03:02:42 pm »
To be even more brief:

What you are trying to achieve is not possible.
Every Alien which is marked as STR_ALIVE_ALIEN and has a appropriate Rank will be sent into the Alien Containment, and units in the Alien Containment are automatically made avaible in the Research Options.

Okay.  Good explanation of the problem.

Let me suggest a third alternative.  You desire to obscure some knowledge that the medic reveals from the player.
Piratez handles this by creating a "manufacturing" job called interrogation.  The prisoner is run through a process in the workshop that returns a "broken prisoner".  This item is presented back to the Research list, and after being researched can provide those techs that you want to delay.
In this situation, you may want to couch it as a "probe implantation" process, or maybe a "thought reader" or even a "universal translator." 

I'm not sure, but this ability to process live prisoners may only reside in the OpenXcom Extended branch.


Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9055
    • View Profile
Re: Editing Research Tree in OpenXCom: "dependencies" with "getOneFree"
« Reply #29 on: April 29, 2016, 03:11:05 pm »
To be even more brief:
What you are trying to achieve is not possible.

I would normally not participate in such discussion, but proving hellrazor wrong is too good to pass... I think it is doable (not sure!) and I will try it in the evening :-) Fingers crossed...

EDIT: it's really not possible :( and the source code for this part is a total mess... I think the author should have taken a bit more sleep before writing it... you know something is wrong, when the variable name is called "ohBoy", not even joking. I hope SupSuper or Warboy can refactor this after 2.0 ... OXC definitely deserves it
« Last Edit: April 29, 2016, 06:00:58 pm by Meridian »