BC,
Can you clarify what you want to happen. Using words like "owner" is no good unless you also specify whether they are the owner before or after the asteroid is taken.
Remember that OnAsteroidTaken is run immedietely after the asteroid is taken, therefore it will return the asteroid's owner as being the aggressor, not the empire that lost the asteroid.
Depending on how you want this to work, try one of these:
function OnAsteroidTaken(id,owner)
if id == 7 then
Pause()
MessageBox("Asteroid 7 was taken by Empire" .. owner)
WaitDialog()
Unpause()
end
endThis code will display a message box anytime asteroid 7 gets a new owner.
function LevelLogic()
runonce = false
specificowner = 3 --change as you like, doesn't have to be empire 3
while GameRunning() do
if runonce == false and GetAsteroid(7).Owner == specificowner then
Pause()
MessageBox("Asteroid 7 was taken by Empire" .. specificowner)
WaitDialog()
Unpause()
runonce = true
end
if GetAsteroid(7).Owner ~= 3 then
runonce = false
end
coroutine.yield()
end
endThis code will display a message box anytime the empire mentioned in "specificowner" captures asteroid 7 - but it won't display a message if a different empire captures it.
Hope this halps. :>