Page 1 of 1

seperate lua-scripts for mods

Posted: Sat Mar 09, 2013 10:43 am
by drs9999
Hello, just a quick question:
Is it possible to execute a lua script in a freeplay without editing the freeplay.lua?

For example the unlimited ammo mod from the mod-manager thread has its own lua file:

Code: Select all

InfiniteAmmoMod = {}
function InfiniteAmmoMod.onTick()
	if game.getplayer().getitemcount("basic-bullet-magazine") < 2 then
		game.getplayer().insert{name="basic-bullet-magazine", count=1}
	end
end
only way i made it working is adding
InfiniteAmmoMod.onTick() in the freeplay.lua

Reason why i ask is that i dont want to change the vanilla files. also if you want to add more than one mod that both changing the freeplay.lua, you have to edit the file by hand so both mods will work correctly.

A solution so far to bypass the vanilla- editing problem i can see is to start a new freeplay, save it and then overwrite the control.lua in the save with the mod script, but that doesnt solve the more then one mod problem.

Re: seperate lua-scripts for mods

Posted: Sat Mar 09, 2013 11:08 am
by kovarex
It is not possible to do it now, but having special lua file for mod that could react to events seems to be natural, so we will add it sooner or later.

Re: seperate lua-scripts for mods

Posted: Sat Mar 09, 2013 11:50 am
by drs9999
Thanks for the quick answer, i thought that, but nice to hear that you will change that in the future.