How to define 'pieces' in scripts/
Posted: 18 Aug 2012, 15:08
Hi all,
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.
I have done this and written/copied some code that should allow the construction yard to build a factory. But it does not, and when i check the infolog.txt i find this faulty line.
I'm guessing it doesn't know what the garage is in relation to my construction yard.
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.
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.