function LevelSetup()
if IsiOS() then
SetSpeedSwitchAvailable(false)
end
Globals():Get("Asteroids"):Set("RadiusPowerRule",1.2)
Globals():Get("Asteroids"):Set("SizeFromEnergy",120)
Globals():Get("Asteroids"):Set("SizeFromStrength",120)
Globals():Get("Asteroids"):Set("SizeFromSpeed",120)
Globals():Get("Asteroids"):Set("CoreHealthPowerRule",2.5)
Globals():Get("Asteroids"):Set("SendPowerRule",2.5)
Globals():Get("Structures"):Set("LevelDuration1",25)
Globals():Get("Structures"):Set("LevelDuration2",60)
Globals():Get("Structures"):Set("LevelDuration3",120)
Globals():Get("Structures"):Set("LevelDuration4",180)
Globals():Get("Structures"):Set("SpawnTime1",27)
Globals():Get("Structures"):Set("SpawnTime2",22)
Globals():Get("Structures"):Set("SpawnTime3",17)
Globals():Get("Structures"):Set("SpawnTime4",17)
Globals():Get("Game"):Set("MinAsteroidSeparation",1500)
Globals():Get("Game"):Set("MaxAsteroidNeighbourDist",3500)
Globals():Get("Game"):Set("GreysProbability",0.15)
AddAsteroidRing(4, 0, 0, 1700, 6500)
-- Asteroid 4
a = AddAsteroidWithAttribs(4000,-3500, 0.7,0.7,0.7)
a.Owner = 1
s = a:AddDysonTree()
s:LevelUp()
s:LevelUp()
s = a:AddDysonTree()
s:LevelUp()
s:LevelUp()
a:AddSeedlings(30)
a.Moveable = false
-- Asteroid 4 = Just a name? not that important?
a = AddAsteroidWithAttribs(4000,-3500, 0.7,0.7,0.7) = (X , Y, 0-1 energy, 0-1 strength, 0-1 speed)
a.Owner = 1 = 0 - Empty 1 - ME 2+ - other factions, depends on max factions I set with the globals():?
s = a:AddDysonTree() = s = a:AddDysonTree() simply adds a dysontree (I know the other add codes aswell, such as defence trees and that)
s:LevelUp() = Don't really understand this, does it automatically level up the dyson tree?
s:LevelUp()
s = a:AddDysonTree()
s:LevelUp()
s:LevelUp()
a:AddSeedlings(30) = Starts with 30 seedlings
a.Moveable = false = Don't know?
asteroidID = GetRandomRange( 6, 8 )
stage = 0
function LevelLogic()
StartLevelLogic()
GetEmpire(1):UpdateAsteroidLists()
GetEmpire(0):UpdateAsteroidLists()
GetEmpire(2):UpdateAsteroidLists()
--
-- Mission text
--
if IsiOS() then
WaitReal(1)
Message("04_01", true, 1.0, "Top")
WaitMessage(true)
SetSpeedSwitchAvailable(true)
Message("04_GOAL", true, 1.0, "Left")
else
MessageBox("04_01")
WaitDialog()
end
--
-- Artifact intro
--
if IsiOS() then
WaitMessage(true)
WaitReal(2)
Message("04_ARTIFACT", true, 1.0, "Top")
if GetLevelHasTimeRecorded() then
SetHelpAvailableStoryMode("res/iOS_ArtifactIntroduce.png",512, "iOS_ArtifactIntroduce")
end
WaitMessage(true)
WaitReal(1)
if not GetLevelHasTimeRecorded() then
ImageBox("res/iOS_ArtifactIntroduce.png",512, "iOS_ArtifactIntroduce")
WaitDialog()
SetHelpAvailableStoryMode("res/iOS_ArtifactIntroduce.png",512, "iOS_ArtifactIntroduce")
end
else
ImageBox("res/Artifact1.png",256,"ArtifactIntroduce")
WaitDialog()
end
-- stay here until stage is not zero - this is set when a certain asteroid is REVEALED (see below)
while stage == 0 do
CheckConditions()
coroutine.yield()
end
WaitGame(3)
--
-- Another seedling empire???
--
if IsiOS() then
Message("04_02", true, 1.0, "Top")
else
MessageBox("04_02")
WaitDialog()
end
while GameRunning() do
CheckConditions()
coroutine.yield()
end
end
function CheckConditions()
if gameFinished then
return
end
if GetEmpire(1):GetNumOwnedAsteroids() >= 9 and GetEmpire(0).Defeated and GetEmpire(2).Defeated then
if IsiOS() then
GameOver(true, "")
Message("04_win", true, 1.0, "Centre")
WaitMessage(false)
MessageBox("HintGoal")
WaitDialog()
Quit(true)
else
GameOver(true, "04")
end
end
if GetEmpire(1).NumDysonTrees == 0 and GetEmpire(1).NumSeedlings == 0 then
GameOver(false, "04")
end
end
function OnAsteroidRevealed(id, owner)
if id == 9 and owner == 1 and stage == 0 then
GetAsteroid(9):SetGraceTime(5)
stage = 1
end
end
The other codes I guess you'll need to experiment with or wait for A||R to answer :)
The other codes I guess you'll need to experiment with or wait for A||R to answer :)
Bitwise, short-circuiting?
function LevelSetup()
SetBackdropColour(240/255,221/255,163/255)
Globals():Get("Asteroids"):Set("MaxTrees",1)
Globals():Get("Asteroids"):Set("MinRadius",90)
Globals():Get("Asteroids"):Set("MaxRadius",100)
Globals():Get("Asteroids"):Set("RadiusPowerRule",1.1)
Globals():Get("Asteroids"):Set("SizeFromEnergy",120)
Globals():Get("Asteroids"):Set("SizeFromStrength",120)
Globals():Get("Asteroids"):Set("SizeFromSpeed",120)
Globals():Get("Asteroids"):Set("MinCoreHealth",50)
Globals():Get("Asteroids"):Set("MaxCoreHealth",175)
Globals():Get("Asteroids"):Set("CoreHealthPowerRule",2)
Globals():Get("Asteroids"):Set("MinSendDistance",2400)
Globals():Get("Asteroids"):Set("MaxSendDistance",6000)
Globals():Get("Asteroids"):Set("SendPowerRule",3.2)
Globals():Get("Structures"):Set("LevelDuration1",15)
Globals():Get("Structures"):Set("LevelDuration2",30)
Globals():Get("Structures"):Set("LevelDuration3",60)
Globals():Get("Structures"):Set("LevelDuration4",100)
Globals():Get("Structures"):Set("SpawnTime1",15)
Globals():Get("Structures"):Set("SpawnTime2",12)
Globals():Get("Structures"):Set("SpawnTime3",10)
Globals():Get("Structures"):Set("SpawnTime4",8)
Globals():Get("Flowers"):Set("Available",0)
Globals():Get("StructuresDefense"):Set("TreeCost",10000)
Globals():Get("StructuresDefense"):Set("LevelDuration1",100000)
Globals():Get("Game"):Set("EnemyFactionsMin",0)
Globals():Get("Game"):Set("EnemyFactionsMax",0)
Globals():Get("Game"):Set("MinAsteroidSeparation",1500)
Globals():Get("Game"):Set("MaxAsteroidNeighbourDist",6000)
Globals():Get("Game"):Set("GreysProbability",0)
-- Asteroid 1
a = AddAsteroidWithAttribs(2200,6000, 0.2,1.0,0.3)
a.Owner = 1
a:AddSeedlings(10)
a.Moveable = false
SetDefenseTreeButtonAvailable(false)
SetFlowerDefenseButtonAvailable(false)
SetFlowerSeederButtonAvailable(false)
SetTerraformingButtonAvailable(false)
SetBeaconButtonAvailable(false)
if IsiOS() then
SetEnemyInfoAvailable(false)
SetSpeedSwitchAvailable(false)
SetSendModeScoutAvailable(false)
SetSendModeUnitsSelectorAvailable(false)
else
SetEnemyInfoAvailable(false)
SetCoreInfoAvailable(false)
end
SetCameraPositionToAsteroidID(0)
SetCameraZoomNow(50)
end
SetCameraPositionToAsteroidID(0)
SetCameraZoomNow(50)
Is fine, Later i'd like to add some text (need to find where thats stored on iPad first). Back on to the zoom thing, I don't want the user to be able to zoom out from (50) yet? How would I go about doing that?
if (GetCameraZoom() > 50) then
SetCameraZoomNow(50)
end
if (GetCameraZoom() > 50) then
SetCameraZoomNow(50)
end
SetCameraPositionToAsteroidID(0)
SetCameraZoomNow(10)
if (GetCameraZoom() > 50) then
SetCameraZoomNow(50)
end
SetCameraPositionToAsteroidID(0)
SetCameraZoomNow(50)
end
function LevelLogic()
StartLevelLogic()
if (GetCameraZoom() > 50) then
SetCameraZoomNow(50)
end
if GetCameraZoom() > 50 and zoomRestricted then
SetCameraZoomNow(50)
end
SetCameraPositionToAsteroidID(0)
SetCameraZoomNow(50)
end
function LevelLogic()
StartLevelLogic()
zoomRestricted = true
while GameRunning() do
if GetCameraZoom() > 50 and zoomRestricted then
SetCameraZoomNow(50)
end
coroutine.yield() --if you need this one....
end
end
zoomRestricted = true
cameraRestricted = true
while GameRunning() do
if GetCameraZoom() > 3500 and GetCameraPosition() = (0,0) and zoomRestricted and cameraRestricted then
SetCameraPositionNow(0,0)
SetCameraZoomNow(3500)
end
zoomRestricted = true
cameraRestricted = true
while GameRunning() do
if GetCameraZoom() > 3500 and zoomRestricted then
SetCameraPositionNow(0,0)
SetCameraZoomNow(3500)
end
if not GetCameraPosition() = (0,0) and cameraRestricted then
SetCameraPositionNow(0,0)
SetCameraZoomNow(3500)
end
coroutine.yield()
end
function LevelLogic()
StartLevelLogic()
zoomRestricted = true
cameraRestricted = true
while GameRunning() do
if GetCameraZoom() > 3500 and zoomRestricted then
SetCameraPositionNow(0,0)
SetCameraZoomNow(3500)
end
if not GetCameraPosition() = (0,0) and cameraRestricted then
SetCameraPositionNow(0,0)
SetCameraZoomNow(3500)
end
coroutine.yield()
end
end
--Starting Asteroid
a = GetAsteroid(0)
a = GetEmpire(1)
a = AddAsteroidWithAttribs(0,0, 1.0,1.0,1.0)
a.Owner = 1
a:AddSeedlings(10)
a.TreeCap = 1
a.Moveable = false
a:SetRadius(1040)
a.SendDistance = 100
IMANASTEROID = AddAsteroid(0,0)
function LevelLogic()
IMANASTEROID.SendDistance = x
end
if GetAsteroid(a):GetNumSeedlings() = 60 and GetNumDysonTrees() = 4 then
Message("You now have 60 seedlings, lets expand this Empire.~Notice the Asteroid to the left - Take it.", true, 1.0, "Centre")
b = GetAsteroid(0)
b = GetEmpire(1)
b = AddAsteroidWithAttribs(1432,4523, 0.6,0.1,0.5)
b.Owner = 0
b.TreeCap = 2
b.Moveable = false
b:SetRadius(124)
WaitDialog()
if GetEmpire(1).NumDysonTrees == 4 and GetEmpire(1).NumSeedlings == 10 then
Message("This is going to take a while.~I will give you the ability to speed up time.", true, 1.0, "Top")
SetSpeedSwitchAvailable(true)
WaitDialog()
end
if GetAsteroid(0).NumDysonTrees + 4 and GetAsteroid(0).NumSeedlings + 4 then
WaitReal(2)
SetSpeedSwitchAvailable(true)
Message("This is going to take a while~Use the Speedometer on the top left of the screen to speed things up.", false, 1.0, "Left")
end
-- Wait for 4 seedlings to be made
while GetAsteroid(0).NumSeedlings < 4 do
coroutine.yield()
end
GetEmpire(1):UpdateAsteroidLists() is Updating the Asteroid List (i.e how many asteroid the empire has, which asteroids, if the empire is defeated and other stuff).
SetSpeedSwitchAvailable(true) is probably allowing to change the speed in-game, like the developers mode +/-.
WaitReal(1) is, I think, to stop everything. 1 should be 1 millisecond, not a second.
Message("04_01", true, 1.0, "Top") is probably Message(Text, Clickable???, Size, Position(Text Based))(I'm not certain about this, do some experiementation! :D)
IsiOS() doesn't need any explanation.
When asteroid 0 gets 4 seedlings and has 4 dyson trees i would like a message to be shown and the speed option available
if GetAsteroid(0).NumDysonTrees + 4 and GetAsteroid(0).NumSeedlings + 4 then
if GetAsteroid(0):GetNumDysonTrees() == 4 and GetAsteroid(0):GetNumSeedlings(1) >= 4 then
while GetAsteroid(0):GetNumDysonTrees() < 4 and GetAsteroid(0):GetNumSeedlings(1) < 4 then
coroutine.yield()
end
WaitReal(2)
SetSpeedSwitchAvailable(true)
Message("This is going to take a while~Use the Speedometer on the top left of the screen to speed things up.", false, 1.0, "Left")
latch = false
while GameRunning() do
if GetAsteroid(0):GetNumDysonTrees() == 4 and GetAsteroid(0):GetNumSeedlings(1) >= 4 and latch == false then
latch = true
WaitReal(2)
SetSpeedSwitchAvailable(true)
Message("This is going to take a while~Use the Speedometer on the top left of the screen to speed things up.", false, 1.0, "Left")
end
coroutine.yield()
end