Search found 106 matches

by IngoKnieto
Wed Oct 05, 2016 8:16 pm
Forum: Modding help
Topic: how to events.on_load in MP without desync?
Replies: 19
Views: 4307

Re: how to events.on_load in MP without desync?

Huuray it works :) Thank you very much for your detailed explanations Aubergine! I ended up with this code in my control.lua, which very nicely updates recipes or technologies from base game, which I changed in my mod: local trigger_on_load = false local events = {} script.on_load( function() trigge...
by IngoKnieto
Wed Oct 05, 2016 6:56 pm
Forum: Modding help
Topic: how to events.on_load in MP without desync?
Replies: 19
Views: 4307

Re: how to events.on_load in MP without desync?

Thank you for all your replies, but I can't get this to work. This is the complete code from my control.lua: events={} --previous snip pasted here function events.on_load(event) trigger_on_load = true end function events.on_tick() if trigger_on_load then init.initialize() trigger_on_load = nil end e...
by IngoKnieto
Mon Oct 03, 2016 2:05 pm
Forum: Modding help
Topic: how to events.on_load in MP without desync?
Replies: 19
Views: 4307

Re: how to events.on_load in MP without desync?

... So i got a workaround here to make it update on the first tick instead. function events.on_load(event) trigger_on_load = true end function events.on_tick() if trigger_on_load then init.initialize() trigger_on_load = nil end end function init.initialize() step_check_config_changed() end How exac...
by IngoKnieto
Mon Oct 03, 2016 1:00 pm
Forum: Modding help
Topic: Need help with error in game.oninit
Replies: 8
Views: 2068

Re: Need help with error in game.oninit

Your code example works when I run it in-game from the console. That definitely helped me a lot for testing my mod, thank you! However you are right, on_init is not called if I load a game where the mod was already enabled. I was going through the LUA API, but it seems like there is no "on_load...
by IngoKnieto
Mon Oct 03, 2016 10:21 am
Forum: Modding help
Topic: Need help with error in game.oninit
Replies: 8
Views: 2068

Re: Need help with error in game.oninit

Nevermind, I found it, somehow the END to the for-loops got deleted when I copied the two comands :oops: However now the script is now throwing the error: attempt to index global 'game' (a nil value) Is this related to the changes in version 0.12.11? But script.oninit doesn't work either. I am a lit...
by IngoKnieto
Mon Oct 03, 2016 9:53 am
Forum: Modding help
Topic: Need help with error in game.oninit
Replies: 8
Views: 2068

Need help with error in game.oninit

Hi everybody, I am quite new to LUA and I am having trouble with a simple (?) starting script. So far I have successfully created a mod which adds a few new items and recipes and also modifies existing ones. The existing recipes I modified work in a new game, but not in a loaded game, and the Moddin...

Go to advanced search