Page 1 of 1
ned help with making mod
Posted: Wed Aug 20, 2014 8:25 pm
by speedy45
I am trying make a mod by editing mod I download. So I am trying to make a mod that research all research in the game, So I try that and get the following error:
Error while running the oninit...n\Application Data\Factorio\mods\quick-start\control.lua:34:attempt to index field "advanced-chemistry" (a nil value)
So my question I get this error with any of the research that is in the game, so why I am getting this error?
Re: ned help with making mod
Posted: Wed Aug 20, 2014 8:47 pm
by Devcod
If you would share code that you are using, then someone could help you. Right now we don't know anything.
Re: ned help with making mod
Posted: Thu Aug 21, 2014 4:43 am
by speedy45
ok here is the code I am using for each research in the game:
game.player.force.technologies["advanced-chemistry"].researched = true
Re: ned help with making mod
Posted: Thu Aug 21, 2014 5:26 am
by Turtle
You don't really need a mod for this. Just run this command:
Code: Select all
for _, tech in pairs(game.player.force.technologies) do tech.researched = true end
Re: ned help with making mod
Posted: Thu Aug 21, 2014 6:52 am
by Devcod
You are right Turtle, there is no need to use a mod, unless if he want it for every game / future mod techs, then mod would be ok.
Speedy45, if you want to have all technologies researched every time with modification turned on, you should do it like this:
Code: Select all
require "defines"
game.oninit(function()
for _, tech in pairs(game.player.force.technologies) do tech.researched = true end
end)
I am not sure if defines is needed but I will leave it. It should work without any modification.
If you want to unlock technologies only for single game/map then you should use console and code that Turtle gave you.
You can open console with ` (or ~) button. You just need to write it there and it will work.
Re: ned help with making mod
Posted: Thu Aug 21, 2014 11:23 am
by rk84
There is also this.
Code: Select all
game.player.force.researchalltechnologies()
Re: ned help with making mod
Posted: Thu Aug 21, 2014 11:39 am
by speedy45
ok I will test this and let you know:
yeah it work just fine. So thanks for your help.