Quick question: TeamID in animation scripts
Posted: 13 Jan 2010, 17:53
I'm trying to write a Lua unit animation script such that a building is destroyed if the player who owns it runs out of energy. So far I've got
How do I get the teamID of the unit running the script?
Also: is there a separate GetPlayerResources? I couldn't find one on the wiki. Or will GetTeamResources work fine here, even if the player's allied to someone with plenty of energy?
Code: Select all
local function expire()
-- teamID = ???
while true do
if Spring.GetTeamResources(teamID, "energy") < 10 then
Spring.DestroyUnit(unitID)
end
Sleep(1750)
end
endAlso: is there a separate GetPlayerResources? I couldn't find one on the wiki. Or will GetTeamResources work fine here, even if the player's allied to someone with plenty of energy?