First off I'm new here (Hello) and just dipping my toes in to see how it goes.
I've created a unit (a construction yard) and i can see it on the map.
Now i want to write a script for it. In example posted around here we declare local pieces at the start of these scripts. like so.
Code: Select all
local garage = piece "garage"
local door = piece "door"
Code: Select all
[f=0000000] Error: LuaRules::RunCallIn: error = 2, UnitCreated, [string "scripts/cyardscript.lua"]:1: piece not found: garage
stack traceback:
[C]: in function 'sp_CallAsUnit'
[string "LuaGadgets/Gadgets/unit_script.lua"]:307: in function 'CallAsUnitNoReturn'
[string "LuaGadgets/Gadgets/unit_script.lua"]:703: in function 'UnitCreated'
[string "LuaGadgets/gadgets.lua"]:1309: in function <[string "LuaGadgets/gadgets.lua"]:1307>
(tail call): ?
[C]: in function 'CreateUnit'
[string "LuaRules/Gadgets/game_spawn.lua"]:68: in function 'SpawnStartUnit'
[string "LuaRules/Gadgets/game_spawn.lua"]:110: in function 'GameStart'
[string "LuaGadgets/gadgets.lua"]:927: in function <[string "LuaGadgets/gadgets.lua"]:925>
(tail call): ?
My question.
How do i define my pieces for this script to work? (Somewhere else?)
I read most guides and i can't seem to find anything that seems to explain this.
Let me know if you need a further explanation.
Thanks in advance.
Smeg.