Page 1 of 1

Set tech status in Editor

Posted: Sat Jun 14, 2014 11:17 am
by Ca_Putt
Hello fellow Factorio fans,

Two questions regarding the Scenario Editor:
1. How do I Set a tech as "researched" in the Editor.
2. How do I modify the availible techs for a scenario in the Editor.

I hope I posted this in the right spot.

thanks in advance!

Re: Set tech status in Editor

Posted: Sat Jun 14, 2014 12:14 pm
by FreeER
As far as I know this is not possible with the editor, you'd need to add a control.lua file like the devs did in the campaigns
quick example code taken from data\base\campaigns\beta\level-01\control.lua

Code: Select all

game.oninit(function() -- when the game is started
  game.player.force.disableallprototypes() -- disable all of the tech and recipes, etc.
  local recipelist = game.player.force.recipes -- set a variable to save some typing :)
  recipelist["iron-plate"].enabled = true -- enable iron-plate recipe, this is the name in the prototypes

  local technologies = game.player.force.technologies -- see above, but this time for technologies
  technologies["steel-processing"].enabled = true
end)
I'd give a bit more info but I've got to go in just a second sorry, if you need more information I'm sure someone else will be able to help :)

Re: Set tech status in Editor

Posted: Sat Jun 14, 2014 4:27 pm
by FreeER
Hm, not sure if you found this helpful, I should also mention that you can make a technology researched by using

Code: Select all

  local technologies = game.player.force.technologies -- variable to save typing
  technologies["name-of-tech-in-prototype-file"].researched = true
If you want more specific information then let me know :)

Re: Set tech status in Editor

Posted: Sun Jun 15, 2014 11:46 am
by Ca_Putt
oh, it helps as now I don't have to press randoms keys in the editor :D

Ha, It worked, this was easier than I had thought, many thanks!

Is it always necessary to deactivate all Techs/recipes, or is it just far more convenient when doing "lowtech" games? I made a quick run with

Code: Select all

  local recipelist = game.player.force.recipes
  recipelist["repair-pack"].enabled = false
and it worked out sofar.

Re: Set tech status in Editor

Posted: Sun Jun 15, 2014 11:55 am
by Rahjital
There is no need to disable the techs and recipes if that's not what you want to do, it just makes it easier to restrict what the player can do (and makes sure players can't cheat their way through with mods.)