Right, the reason it jumps back to the starting asteroid is because you need to tell the game the player is allowed to look at the asteroid at the start. Otherwise it will try to restrict the view.
To do that, make the asteroid to the far east belong to player 1 when you're creating it in LevelSetup().
Then, as soon as LevelLogic starts, change the owner to player 0.
This code works:
function LevelSetup()
-- Setting Global Values
Globals.G.Asteroids =(0)
Globals.G.EnemyFactionsMin=(0)
Globals.G.EnemyFactionsMax=(1)
Globals.Asteroids.MinSendDistance=60000
Globals.Asteroids.MaxSendDistance=60000
SetBackdropColour(13,110,26)
-- Asteroid 0
a = AddAsteroidWithAttribs(-25000,0, 0.3, 0.3, 0.9)
a.Owner = 1
a. TreeCap = 4
a:SetRadius(550)
a.SendDistance = 2500
a:AddSeedlings(10)
a.Moveable = False
s = a:AddDysonTree()
s:LevelUp()
s:Levelup()
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
s = a:AddDysonTree()
s:LevelUp()
s:LevelUp()
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
--Asteroid 1 - this is the one to the far east.
a = AddAsteroidWithAttribs(25000,0, 0.9, 0.3, 0.3)
a.Owner = 1
a.Treecap = 100
a:SetRadius(1000)
a.SendDistance = 2500
a.Moveable = False
a:Reveal(1)
--Asteroid 2
a = AddAsteroidWithAttribs(-23000,0, 0.7, 0.7, 0.4)
a.Owner=2
a:SetRadius(230)
a.SendDistance = 2500
end
function LevelLogic()
GetAsteroid(1).owner = 0
-- Your Mission
Timer = GetGameTime() + 3
while GetGameTime() < Timer do
coroutine.yield()
end
Pause()
MessageBox("We have a problem, to the far east is an asteroid.")
WaitDialog()
SetCameraPositionToAsteroidID(1)
MessageBox("This asteroid used to be used for harvesting. However our enemies have destroyed all the trees on it. Go forth and plant six trees to kick start its production. You have ten minutes to kickstart the regrowth or else the fertility of the asteroid will start to die. Good luck seedlings")
WaitDialog()
Unpause()
-- Win and loose dialogs
gamewon = 0
while gamewon == 0 do
coroutine.yield()
end
if gamewon == 1 then
Pause()
MessageBox("Congratulations you have restarted the growth on that planet. One day it will be a rich forest like it once was.")
WaitDialog()
Quit(True)
end
if gamewon == 2 then
Pause()
MessageBox("You have managed to loose one of the most fertile asteroids in the galaxy. Your failure is most dissapointing.")
WaitDialog()
Quit(False)
end
end