please can you help me with code? I'm trying to learning LUA.
I would like to do this:
- When an unit of Team 0 is in the rectangle, "U" unit will be destroy
I wrote this code:
Code: Select all
function gadget:GetInfo()
return {
name = "test minimission",
desc = "Minimission",
author = "molixx",
date = "September 19st, 2010",
license = "GPL, v.2, 2008",
layer = 1,
enabled = true,
}
end
local u
local CreateUnit = Spring.CreateUnit
local GetGaiaTeamID = Spring.GetGaiaTeamID
function GameStart()
u = CreateUnit("armcv",150,0,150,90,GetGaiaTeamID())
Spring.SetUnitNeutral (u, true)
Spring.SetUnitAlwaysVisible(u, true)
Spring.SetUnitNoMinimap(u, true)
if Spring.GetUnitsInRectangle(0,0,0,0,0) then
Spring.DestroyUnit("u",false,false)
end
But probably i Wrong something using GetUnitsInRectangle. Can y help me please??
Thx!