maps gadget calling mods gadget functions
Posted: 26 Oct 2010, 00:07
Is that possible? How?
for example I want a map to use functions for spawning resources that are defined in the mod.
maplayout.lua in map:
GameStart()
SpawnResource (800,1200)
end
resource.lua in mod:
local resource_unit = "goldnugget"
function SpawnResource (x,y)
--lots of fancy stuff to spawn the unit in correct way
--doing changes here updates all maps, ie if the name of the resource_unit is changed
end
At the moment I basically do
CreateUnit (x,y, "goldnugget")
in the maps lua and of course that is a bit fail.
Just passing over all the resources positions in some global variable thing would be ok too, so hints on this are welcome too.
for example I want a map to use functions for spawning resources that are defined in the mod.
maplayout.lua in map:
GameStart()
SpawnResource (800,1200)
end
resource.lua in mod:
local resource_unit = "goldnugget"
function SpawnResource (x,y)
--lots of fancy stuff to spawn the unit in correct way
--doing changes here updates all maps, ie if the name of the resource_unit is changed
end
At the moment I basically do
CreateUnit (x,y, "goldnugget")
in the maps lua and of course that is a bit fail.
Just passing over all the resources positions in some global variable thing would be ok too, so hints on this are welcome too.