Working version, with the changes listed above.
function LevelSetup()
Globals.G.Asteroids=0
Globals.G.EnemyFactionsMin=(0)
Globals.G.EnemyFactionsMax=(0)
-- Asteroid 0
a = AddAsteroidWithAttribs(0,0,1,1,1)
a.Owner = 1
a.TreeCap = 2
a:SetRadius(50)
a:AddSeedlings(50)
s = a:AddDysonTree()
s:LevelUp()
-- Asteroid 1
a = AddAsteroidWithAttribs(400,0,1,1,1)
a.Owner = 0
a.TreeCap = 5
a:SetRadius(50)
end
function LevelLogic()
gamewon = 0
roidnumber = 2
while gamewon == 0 do
if GetEmpire(1):GetNumOwnedAsteroids() == 0 then
gamewon = 1
elseif GetEmpire(1):GetNumOwnedAsteroids() == roidnumber then
gamewon = 2
end
coroutine.yield()
end
if gamewon == 1 then
Pause()
MessageBox('You have lost.')
WaitDialog()
Unpause()
Quit(false)
end
if gamewon == 2 then
Pause()
MessageBox('You have won.')
WaitDialog()
Unpause()
Quit(true)
end
end
Don't click the button though. :> You'll wind up a better coder if you take 10 minutes to apply the changes listed above on your own. Plus, it's way more satisfying. :>
But yea, it's there if you really get stuck.