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?
ned help with making mod
Re: ned help with making mod
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
ok here is the code I am using for each research in the game:
game.player.force.technologies["advanced-chemistry"].researched = true
game.player.force.technologies["advanced-chemistry"].researched = true
Re: ned help with making mod
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
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:
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.
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)
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
There is also this.
Code: Select all
game.player.force.researchalltechnologies()
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
Re: ned help with making mod
ok I will test this and let you know:
yeah it work just fine. So thanks for your help.
yeah it work just fine. So thanks for your help.