" attemt to call field 'DestrotUnit'(a nil value) "
Please suggest me the easiest way to do it?
Code: Select all
function widget:GetInfo()
return {
name = "Hello Widget",
desc = "Simple Widget Test",
author = "You",
date = "Jan 1, 2008",
license = "GNU GPL, v2 or later",
layer = 0,
enabled = false
}
end
-- We define one local variable and one local function.
-- These cannot be accessed from outside this file but are fast to access.
-- The 'Spring' module was automatically included for us.
local hello = "Hello Spring"
local Echo = Spring.Echo
-- Now we create two call-ins.
-- The first will execute when the widget is loaded,
-- the second executes each time a unit is built.
function widget:Initialize()
Echo( hello )
Spring.SendCommands("cheat")
end
function widget:UnitCreated(unitID, unitDefID, unitTeam)
Echo( "Hello Unit " .. unitID )
Spring.DestroyUnit(unitID, false, true)
end
function widget:GameFrame( frameNumber )
if frameNumber % 100 == 0 then
Spring.SendCommands("give 1 armpw 0")
end
end