[Solved] Pre-Requisite Researchs

Place to get help with not working mods / modding interface.
Post Reply
ClayC
Inserter
Inserter
Posts: 24
Joined: Fri Nov 21, 2014 8:01 am
Contact:

[Solved] Pre-Requisite Researchs

Post by ClayC »

Hey guys, yet another problem I did add a few technologies dependent on each other so i added prerequisites = {"other-tech"} to make them unlock when the other technology was researched/

The issue is when you have let's say a series of tech1 to tech3 and you add each with the previous as prerequisite. Shouldn't this hide the tech2 and tech3 from the research list until tech1 is researched and then shows tech2 and after that is researched it shows tech3?

code example:

Code: Select all

data:extend({
  {
      type = "technology",
      name = "tech1",
      icon = "__MOD__/graphics/research1.png",
      effects =
      {
        {
            type = "unlock-recipe",
            recipe = "item1"
        }
      },
      prerequisites = {},
      unit =
      {
        count = 75,
        ingredients =
        {
          {"science-pack-1", 2},
          {"science-pack-2", 1},
          {"science-pack-3", 1}
        },
        time = 30
      }
  },
{
      type = "technology",
      name = "tech2",
      icon = "__MOD__/graphics/research2.png",
      effects =
      {
        {
            type = "unlock-recipe",
            recipe = "item2"
        }
      },
      prerequisites = {"tech1"},
      unit =
      {
        count = 75,
        ingredients =
        {
          {"science-pack-1", 2},
          {"science-pack-2", 1},
          {"science-pack-3", 1}
        },
        time = 30
      }
  },{
      type = "technology",
      name = "tech3",
      icon = "__MOD__/graphics/research3.png",
      effects =
      {
        {
            type = "unlock-recipe",
            recipe = "item3"
        }
      },
      prerequisites = {"tech3"},
      unit =
      {
        count = 75,
        ingredients =
        {
          {"science-pack-1", 2},
          {"science-pack-2", 1},
          {"science-pack-3", 1}
        },
        time = 30
      }
  }
})
Thanks in advance
Last edited by ClayC on Mon Aug 03, 2015 7:05 am, edited 1 time in total.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Pre-Requisite Researchs

Post by orzelek »

Take a look at original game techs - you are missing upgrade property.

Add this:

Code: Select all

upgrade = true,
to all the techs including 1st one.

ClayC
Inserter
Inserter
Posts: 24
Joined: Fri Nov 21, 2014 8:01 am
Contact:

Re: Pre-Requisite Researchs

Post by ClayC »

orzelek wrote:Take a look at original game techs - you are missing upgrade property.

Add this:

Code: Select all

upgrade = true,
to all the techs including 1st one.
snap how did I miss that! lol thanks alot man, you saved me a couple of hours for sure :)

EDIT: After adding it to all the researches they still appear without researching the one before

ClayC
Inserter
Inserter
Posts: 24
Joined: Fri Nov 21, 2014 8:01 am
Contact:

Re: [Solved] Pre-Requisite Researchs

Post by ClayC »

The fix was not only to add the upgrade = true but also to execute a command on my test save to reset recipes

Code: Select all

/c game.player.force.reset_recipes()

Post Reply

Return to “Modding help”