function LevelLogic()
-- create a "latch" variable, so that the seedlings are only sent once.
once = false
-- Run this loop continuously
while GameRunning() do
-- check if enough game time has passed yet
if GetGameTime() > 3 and once == false then
-- 3 seconds have passed - Asteroid 0 should now send 50 seedlings belonging to Empire 2 to Asteroid 1.
GetAsteroid(0):SendSeedlingsToTarget(50,2,GetAsteroid(1))
-- flip the latch
once = true
end
coroutine.yield()
end
end
function LevelLogic()
-- create an "incident" variable. This will be used to store a note of which event is due to happen next.
incident = 0
-- create a "next" variable, this will record what the Game Time should be when the next incident must be run
next = 0
-- Run this loop continuously
while GameRunning() do
-- check if it's time for the next event
if GetGameTime() > next then
-- It's time, so run the action function for the current incident
Action(incident)
-- increment the incident counter by 1
incident = incident + 1
end
coroutine.yield()
end
end
function Action(incident)
if incident == 0 then
GetAsteroid(0):AddSeedlings(10)
next = GetGameTime() + 10
elseif incident == 1 then
GetAsteroid(0):AddSeedlings(20)
next = GetGameTime() + 5
elseif incident == 2 then
GetAsteroid(0):PlantDysonTree(1)
next = GetGameTime() + 25
elseif incident == 3 then
GetAsteroid(0):SendSeedlingsToTarget(50,1,GetAsteroid(1))
next = GetGameTime() + 10
elseif incident == 4 then
SetBackdropColour(0,0,80)
next = GetGameTime() + 15
else
-- no further incidents defined
end
end
if integer % 2 == 0 then -- if the integer divided by 2 has a remainder of 0, then
--the integer is even
else
-- the integer is odd
end
function LevelLogic()
-- first lets assign the values to some variables
roid1X = GetAsteroid(1).position.X
roid1Y = GetAsteroid(1).position.Y
roid2X = GetAsteroid(2).position.X
roid2Y = GetAsteroid(2).position.Y
-- next, calculate the diffence between their X coordinates
dx = roid2X - roid1X
-- and their Y coordinates
dy = roid2Y - roid1Y
-- dx and dy are like 2 sides of a right angled triangle.
-- If you recall pythagoras, the 3rd side (hypotenuse) can be calculated with a^2 + b^2 = c^2
-- So dx^2 + dy^2 = DistanceBetweenAsteroids^2
distance = math.sqrt((dx * dx) + (dy * dy))
end
function LevelLogic()
-- first lets assign the values to some variables
roid1X = GetAsteroid(1).position.X
roid1Y = GetAsteroid(1).position.Y
roid2X = GetAsteroid(2).position.X
roid2Y = GetAsteroid(2).position.Y
-- next, calculate the diffence between their X coordinates
dx = roid2X - roid1X
-- and their Y coordinates
dy = roid2Y - roid1Y
-- dx and dx are like 2 sides of a right angled triangle.
-- If you recall pythagoras, the 3rd side (hypotenuse) can be calculated with a^2 + b^2 = c^2
-- So dx^2 + dy^2 = DistanceBetweenAsteroids^2
dist = math.sqrt((dx * dx) + (dy * dy))
-- dist is the distance between the asteroid centers. To get the actual distance between their surfaces, we must subtract both radii from dist
distance = dist - GetAsteroid(1).radius - GetAsteroid(2).radius
end
function LevelLogic()
-- first lets assign the values to some variables
roid1X = GetAsteroid(1).position.X
roid1Y = GetAsteroid(1).position.Y
roid2X = GetAsteroid(2).position.X
roid2Y = GetAsteroid(2).position.Y
-- next, calculate the diffence between their X coordinates
dx = roid2X - roid1X
-- and their Y coordinates
dy = roid2Y - roid1Y
-- dx and dx are like 2 sides of a right angled triangle.
-- If you recall pythagoras, the 3rd side (hypotenuse) can be calculated with a^2 + b^2 = c^2
-- So dx^2 + dy^2 = DistanceBetweenAsteroids^2
dist = math.sqrt((dx * dx) + (dy * dy))
-- dist is the distance between the asteroid centers. To get the minimum required SendDistance, we measure from the center of Asteroid 1 (startpoint) to the edge of Asteroid 2 (destination)
distance = dist - GetAsteroid(2).radius
end
-- calculate A, B and C for both lines (standard form)
A1 = Ly2-Ly1
B1 = Lx1-Lx2
C1 = A1*x1+B1*y1
A2 = Ly4-Ly3
B2 = Lx3-Lx4
C2 = A3*x3+B3*y3
-- detect if they will ever intersect..
det = A1*B2 - A2*B1
if det == 0
--Lines are parallel
else
-- intersection coordinates give as:
intersectX = ((B2*C1) - (B1*C2)) / det
intersectY = ((A1*C2) - (A2*C1)) / det
end
-- get 2 vectors along the plane
-- PV1x stands for Plane Vector #1, X-coordinate
PV1x = Px2 - Px1
PV1y = Py2 - Py1
PV1z = Pz2 - Pz1
PV2x = Px3 - Px1
PV2y = Py3 - Py1
PV2z = Pz3 - Pz1
-- now find the cross product, which is a line perpendicular to the plane
-- PV1 X PV2 = normal vector!
i = (PV1y * PV2z) - (PV1z * PV2y)
j = (PV1z * PV2x) - (PV1x * PV2z)
k = (PV1x * PV2y) - (PV1y * PV2x)
-- for the line, calculate tx, ty, tz
tx = Lx2 - Lx1
ty = Ly2 - Ly1
tz = Lz2 - Lz1
-- calculate t
num = ((i * (Px1 - Lx1)) + (j * (Py1 - Ly1)) + (k * (Pz1 - Lz1)))
denom = ((i * (Lx2 - Lx1)) + (j * (Ly2 - Ly1)) + (k * (Lz2 - Lz1)))
t = num / denom
-- calculate coordinates of the intersection point
intersectX = (t * tx) + Lx1
intersectY = (t * ty) + Ly1
intersectZ = (t * tz) + Lz1
-- where lvlX is the x-coordinate of the point in Leveldraw that must be converted, and lvlY is the y-coordinate.
screenX = (lvlX * GetCameraScale()) - (GetCameraX() * GetCameraScale()) + (GetScreenWidth() - (GetScreenWidth() / 2))
screenY = (lvly * GetCameraScale()) - (GetCameraY() * GetCameraScale()) + (GetScreenHeight() - (GetScreenHeight() / 2))
c1 = 5
d1 = 0
omg1 = "cats"
MessageBox(c1 .. d1)
-- "05"
MessageBox("Hello " .. omg1)
-- "Hello cats"
MessageBox("You have " .. c1 .. " " .. omg1 .. " and " .. d1 .. " dogs. Clearly you must prefer " .. omg1 .. ".")
-- "You have 5 cats and 0 dogs. Clearly you must prefer cats."
while GetEmpire(0).NumSeedlings > 0 do --Checks to see if Empire 0's Number of Seedlings is 0 or less, can't be less than 0 though.
CheckConditions() --THIS IS SOMETHING I USE PERSONALLY. YOU DON'T NEED IT.
coroutine.yield() -- Makes this statement check over and over until Empire 0's number of seedlings is at 0
end --To end this statement
if IsiOS() then -- Defence, Find your allies
SetCameraZoom(2000)
SetCameraPosition(0,0)
SelectionClear()
WaitReal(2)
SetLevelDim(true)
Message("-Hired Defence-~Find your lost brothers and sisters, don't forget what you've learnt~This is unknown territory", true, 1.0, "Top")
WaitMessage(true)
SetLevelDim(false)
else
MessageBox("01_01")
WaitDialog()
end
if IsiOS() then -- Be Prepared First
WaitReal(2)
Message("There should be enough seedlings to plant 4 Defence Trees, and maybe more,~Search the Asteroid Belt for seedlings.", true, 1.0, "Top")
WaitMessage(true)
else
MessageBox("01_02")
WaitDialog()
end
while GetEmpire(1).NumSeedlings < 42 do
CheckConditions()
coroutine.yield()
end
if IsiOS() then -- Asteroid Belts are everchanging
WaitReal(2)
Message("Now you have enough seedlings to create 4 Defence Trees~Find an Asteroid that supports planting.", true, 1.0, "Top")
WaitMessage(true)
else
MessageBox("01_02")
WaitDialog()
end
while GetEmpire(1).NumTrees < 1 do
CheckConditions()
coroutine.yield()
end
while GameRunning() do
CheckConditions()
coroutine.yield()
end
if x % 2 == 1 then
//is odd
else
//is even
end
function LevelSetup()
SetCameraZoom(2000)
SetCameraPosition(0,0)
if IsiOS() then
SelectionClear()
end
latch = {}
latch[0] = false
latch[1] = false
latch[2] = false
end
function IsiOS()
return false
-- i can't make it run without defining this function... it seems like IsiOS isn't recognised on my older PC version.
end
function CheckConditions()
-- presumably some code goes in here..
end
function LevelLogic()
while GameRunning() do -- Run this loop continuously
if GetGameTime() > 2 and latch[0] == false then
latch[0] = true
if IsiOS() then
SetLevelDim(true)
Message("-Hired Defence-~Find your lost brothers and sisters, don't forget what you've learnt~This is unknown territory", true, 1.0, "Top")
WaitMessage(true)
SetLevelDim(false)
else
SetVignetteAlpha(255)
MessageBox("-Hired Defence- Find your lost brothers and sisters, don't forget what you've learnt. This is unknown territory")
Pause()
WaitDialog()
Unpause()
SetVignetteAlpha(255)
end
end
if GetGameTime() > 4 and latch[1] == false then
latch[1] = true
if IsiOS() then
Message("There should be enough seedlings to plant 4 Defence Trees, and maybe more,~Search the Asteroid Belt for seedlings.", true, 1.0, "Top")
WaitMessage(true)
else
MessageBox("There should be enough seedlings to plant 4 Defence Trees, and maybe more. Search the Asteroid Belt for seedlings.")
Pause()
WaitDialog()
Unpause()
end
end
if GetEmpire(1).NumSeedlings < 42 or GetEmpire(1).NumTrees < 1 then
CheckConditions() -- No idea what this does but you included it, so I will too
end
if GetEmpire(1).NumSeedlings > 42 and latch[2] == false then
latch[2] = true
if IsiOS() then
Message("Now you have enough seedlings to create 4 Defence Trees~Find an Asteroid that supports planting.", true, 1.0, "Top")
else
MessageBox("Now you have enough seedlings to create 4 Defence Trees. Find an Asteroid that supports planting.")
end
end
coroutine.yield()
end
end
So ISiOS() crashes your game?
function IsThisiOS()
if GetScreenWidth() == 2048 or GetScreenWidth() == 1024 then
if GetScreenHeight() == 1536 or GetScreenHeight() == 768 then
return true
else
return false
end
else
return false
end
end
function LevelSetup()
Globals.G.Asteroids=1
end
function LevelLogic()
if IsThisiOS() then
Message("iPad detected", true, 1.0, "Top")
else
MessageBox("PC detected")
end
end
function IsThisiOS()
if GetScreenWidth() == 2048 or GetScreenWidth() == 1024 then
if GetScreenHeight() == 1536 or GetScreenHeight() == 768 then
return true
else
return false
end
else
return false
end
end
1 % 2 = 1
2 % 2 = 0
0 % 2 = 0
77 % 7 = 0
69 % 7 = 6
if x % 2 == 1 then
Message("iPad detected", true/false, 0 to 1.0, "Top/Bottom/Centre/Left/Right")
(http://i47.tinypic.com/2ni5nk5.png)
function LevelSetup()
--SetBackdropColour(8/255,8/255,20/255)
SetBackdropColour(225/255,225/255,225/255)
--Special thanks to Aino, Pilchard123, Alex and Annikk.exe's Guides and Helps, Without them I wouldn't have been inspired to create this custom iPad
--campaign, also obviously, without the Game, none of this would have been possible. The Creator of this level/story is Tomfloria.
--Remember this though when searching through this code, (Aino) :D I am a beginner, and the code might be messy
--But that isn't my concern, if you can clean it up, so that it works exactly the same, then go ahead, and send me
--a PM on the Eufloria Forums at http://www.dyson-game.com/smf/index.php?board=3.0
if IsThIsThisiOS() then
SetMessageDarkMode(true)
end
if IsThIsThisiOS() then
Globals():Get("Asteroids"):Set("RadiusPowerRule",2)
Globals():Get("Asteroids"):Set("SizeFromEnergy",230)
Globals():Get("Asteroids"):Set("SizeFromStrength",230)
Globals():Get("Asteroids"):Set("SizeFromSpeed",240)
Globals():Get("Asteroids"):Set("MinCoreHealth",75)
Globals():Get("Asteroids"):Set("MaxCoreHealth",350)
Globals():Get("Asteroids"):Set("CoreHealthPowerRule",2.5)
Globals():Get("Asteroids"):Set("MinSendDistance",3500)
Globals():Get("Asteroids"):Set("MaxSendDistance",5500)
Globals():Get("Asteroids"):Set("SendPowerRule",2.0)
Globals():Get("Asteroids"):Set("SpawnCap", 40)
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("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)
else
Globals.G.Asteroids=(0)
Globals.G.EnemyFactionsMin=(0)
Globals.G.EnemyFactionsMax=(0)
end
--0 Starting Asteroid
a = AddAsteroidWithAttribs(5000,2000, math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 1
a.TreeCap = 3
s = a:AddDysonTree()
s = a:AddDysonTree()
a:AddSeedlings(30)
a.Moveable = false
--1
a = AddAsteroidWithAttribs(math.random(-4000,9000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 3
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--2
a = AddAsteroidWithAttribs(math.random(-4000,9000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 2
a:SetGraceTime(1000)
s = a:AddDysonTree()
s = a:AddDefenseTree()
a:AddSeedlings(math.random(20,40))
a.Moveable = true
a:Hide(1)
--3
a = AddAsteroidWithAttribs(math.random(-4000,15000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 3
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--4
a = AddAsteroidWithAttribs(math.random(-4000,15000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 1
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--5
a = AddAsteroidWithAttribs(math.random(-4000,15000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 3
a.Moveable = true
a:SetGraceTime(0)
a:AddSeedlings(math.random(20,40))
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
s = a:AddDysonTree()
s:LevelUp()
s:LevelUp()
a:Hide(1)
--6
a = AddAsteroidWithAttribs(math.random(-10000,-3000),math.random(2000,8000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--7
a = AddAsteroidWithAttribs(math.random(-10000,-3000),math.random(2000,8000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--8
a = AddAsteroidWithAttribs(math.random(-10000,-3000),math.random(2000,8000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(2,4)
a.Moveable = true
a:SetGraceTime(4000)
a:AddSeedlings(math.random(20,40))
a:SetRadius(math.random(500,1000))
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
s = a:AddDysonTree()
s:LevelUp()
s:LevelUp()
a:Hide(1)
--9
a = AddAsteroidWithAttribs(math.random(-10000,-3000),math.random(2000,8000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--10
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:SetGraceTime(200)
s = a:AddDysonTree()
s = a:AddDysonTree()
s = a:AddDefenseTree()
a:AddSeedlings(math.random(20,40))
a:Hide(1)
--11
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 1
a.TreeCap = 0
a:SetProtected(true)
s = a:AddDefenseTree()
s = a:AddDefenseTree()
s = a:AddDefenseTree()
a.Moveable = true
a:Hide(1)
--12
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a:SetGraceTime(50)
s = a:AddDefenseTree()
s = a:AddDefenseTree()
s = a:AddDefenseTree()
a:AddSeedlings(math.random(20,40))
a.Moveable = true
a:Hide(1)
--13
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--14
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(3,4)
a.Moveable = true
a:SetGraceTime(200)
s = a:AddDysonTree()
s = a:AddDysonTree()
s = a:AddDefenseTree()
a:AddSeedlings(math.random(20,40))
a:Hide(1)
--15
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--16
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--17 Enemy Sprawl Asteroid
a = AddAsteroidWithAttribs(math.random(-30000,-25000),math.random(-20000,-10000), math.random(10,10) / 10,math.random(10,10) / 10,math.random(10,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 6
a.Moveable = true
a:Hide(1)
a:SetGraceTime(9999999)
a:AddSeedlings(math.random(40,60))
a:SetRadius(1500)
SetDysonTreeButtonAvailable(true)
SetDefenseTreeButtonAvailable(true)
SetFlowerDefenseButtonAvailable(false)
SetFlowerSeederButtonAvailable(false)
SetTerraformingButtonAvailable(false)
SetBeaconButtonAvailable(false)
if IsThIsThisiOS() then
SetEnemyInfoAvailable(true)
SetCoreInfoAvailable(true)
SetAttribsInfoAvailable(true)
SetSpeedSwitchAvailable(true)
SetSendModeScoutAvailable(true)
SetSendModeUnitsSelectorAvailable(true)
SetSendModeButtonAvailable(true)
SetSendModeHoldAvailable(true)
SetSendModeDragAvailable(true)
else
SetTreeInfoAvailable(true)
SetEnemyInfoAvailable(true)
SetCoreInfoAvailable(true)
SetAttribsInfoAvailable(true)
end
SetCameraPosition(5000,2000)
end
function LevelLogic()
StartLevelLogic()
foundAsteroidbarron11 = 0
GetAsteroid(17):AddDysonTree()
GetAsteroid(17):AddDysonTree()
GetAsteroid(17):AddDysonTree()
GetAsteroid(17):AddDefenseTree()
GetAsteroid(17):AddDefenseTree()
GetAsteroid(17):AddDefenseTree()
CheckConditions()
WaitReal(4)
SetBackdropColour(8/255,8/255,20/255)
if IsThIsThisiOS() then -- Offerings
SelectionClear()
WaitReal(2)
SetLevelDim(true)
Message("-Ordered Strike-", true, 1.0, "Top")
WaitMessage(true)
SetLevelDim(false)
else
MessageBox("-Ordered Strike-")
WaitDialog()
end
if IsThIsThisiOS() then -- Use The Seedlings
WaitReal(1)
Message("Use the seedlings I have given you to conquer this belt.", true, 1.0, "Top")
WaitMessage(true)
else
MessageBox("Use the seedlings I have given you to conquer this belt.")
WaitDialog()
end
while foundAsteroidbarron11 == 0 do
CheckConditions()
coroutine.yield()
end
if IsThisiOS() then -- Beacon
WaitReal(1)
Message("You have found an Unstable Asteroid,~Click on any asteroid you own, and press the {u57345} Beacon Button", true, 1.0, "Top")
SetBeaconButtonAvailable(true)
WaitMessage(true)
else
MessageBox("You have found an Unstable Asteroid,~Click on any asteroid you own, and press the {u57345} Beacon Button")
WaitDialog()
end
if IsThisiOS() then -- Beacon Explination
WaitReal(1)
Message("Then Select the Unstable Asteroid~This will send any newly created seedlings to this Asteroid automatically.", true, 1.0, "Top")
SetBeaconButtonAvailable(true)
WaitMessage(true)
else
MessageBox("Then Select the Unstable Asteroid~This will send any newly created seedlings to this Asteroid automatically.")
WaitDialog()
end
while GameRunning() do
CheckConditions()
coroutine.yield()
end
end
function CheckConditions()
if gameFinished then
return
end
if GetEmpire(1):GetNumOwnedAsteroids() == GetNumAsteroids() then
if IsThisiOS() then
GameOver(true, "")
Message("You successfully taken this belt.~Well Done", true, 1.0, "Centre")
WaitMessage(false)
WaitDialog()
Quit(true)
else
MessageBox("You successfully taken this belt.~Well Done")
GameOver(true, "")
Quit(true)
end
end
if GetEmpire(1).NumDysonTrees == 0 and GetEmpire(1).NumSeedlings == 0 then
if IsThisiOS() then
GameOver(false, "")
Message("You have failed to complete the tasks.", true, 1.0, "Centre")
WaitMessage(false)
WaitDialog()
Quit(false)
else
MessageBox("You have failed to complete the tasks.")
GameOver(false, "")
Quit(false)
end
end
end
function OnAsteroidRevealed(id, owner)
if id == 11 then
foundAsteroidbarron11 = 1
end
end
function IsThIsThisiOS()
if GetScreenWidth() == 2048 or GetScreenWidth() == 1024 then
if GetScreenHeight() == 1536 or GetScreenHeight() == 768 then
return true
else
return false
end
else
return false
end
end
if IsThisiOS() and stage == 1 then --20 Seedlings, 2 Asteroids, All At Once
WaitReal(25)
GetAsteroid(7):SetGraceTime(0)
GetAsteroid(7):SendSeedlingsToTarget(0,10,GetAsteroid(3))
GetAsteroid(8):SetGraceTime(0)
GetAsteroid(8):SendSeedlingsToTarget(0,10,GetAsteroid(4))
GetAsteroid(7):SetGraceTime(99999999)
GetAsteroid(8):SetGraceTime(99999999)
WaitReal(1)
stage = 2
else
--NEEDS EDITING FOR PC VERSION, NEED TO CREATE DELAY WHICH MATCHES WaitReal(25)
end
function WaitReal(t)
t = t + GetRealTime()
while GetRealTime() < t do
CheckConditions()
coroutine.yield()
end
end
Sir, could you test this out?Code: [Select]function LevelSetup()
--SetBackdropColour(8/255,8/255,20/255)
SetBackdropColour(225/255,225/255,225/255)
--Special thanks to Aino, Pilchard123, Alex and Annikk.exe's Guides and Helps, Without them I wouldn't have been inspired to create this custom iPad
--campaign, also obviously, without the Game, none of this would have been possible. The Creator of this level/story is Tomfloria.
--Remember this though when searching through this code, (Aino) :D I am a beginner, and the code might be messy
--But that isn't my concern, if you can clean it up, so that it works exactly the same, then go ahead, and send me
--a PM on the Eufloria Forums at http://www.dyson-game.com/smf/index.php?board=3.0
if IsThIsThisiOS() then
SetMessageDarkMode(true)
end
if IsThIsThisiOS() then
Globals():Get("Asteroids"):Set("RadiusPowerRule",2)
Globals():Get("Asteroids"):Set("SizeFromEnergy",230)
Globals():Get("Asteroids"):Set("SizeFromStrength",230)
Globals():Get("Asteroids"):Set("SizeFromSpeed",240)
Globals():Get("Asteroids"):Set("MinCoreHealth",75)
Globals():Get("Asteroids"):Set("MaxCoreHealth",350)
Globals():Get("Asteroids"):Set("CoreHealthPowerRule",2.5)
Globals():Get("Asteroids"):Set("MinSendDistance",3500)
Globals():Get("Asteroids"):Set("MaxSendDistance",5500)
Globals():Get("Asteroids"):Set("SendPowerRule",2.0)
Globals():Get("Asteroids"):Set("SpawnCap", 40)
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("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)
else
Globals.G.Asteroids=(0)
Globals.G.EnemyFactionsMin=(0)
Globals.G.EnemyFactionsMax=(0)
end
--0 Starting Asteroid
a = AddAsteroidWithAttribs(5000,2000, math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 1
a.TreeCap = 3
s = a:AddDysonTree()
s = a:AddDysonTree()
a:AddSeedlings(30)
a.Moveable = false
--1
a = AddAsteroidWithAttribs(math.random(-4000,9000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 3
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--2
a = AddAsteroidWithAttribs(math.random(-4000,9000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 2
a:SetGraceTime(1000)
s = a:AddDysonTree()
s = a:AddDefenseTree()
a:AddSeedlings(math.random(20,40))
a.Moveable = true
a:Hide(1)
--3
a = AddAsteroidWithAttribs(math.random(-4000,15000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 3
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--4
a = AddAsteroidWithAttribs(math.random(-4000,15000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 1
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--5
a = AddAsteroidWithAttribs(math.random(-4000,15000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 3
a.Moveable = true
a:SetGraceTime(0)
a:AddSeedlings(math.random(20,40))
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
s = a:AddDysonTree()
s:LevelUp()
s:LevelUp()
a:Hide(1)
--6
a = AddAsteroidWithAttribs(math.random(-10000,-3000),math.random(2000,8000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--7
a = AddAsteroidWithAttribs(math.random(-10000,-3000),math.random(2000,8000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--8
a = AddAsteroidWithAttribs(math.random(-10000,-3000),math.random(2000,8000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(2,4)
a.Moveable = true
a:SetGraceTime(4000)
a:AddSeedlings(math.random(20,40))
a:SetRadius(math.random(500,1000))
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
s = a:AddDysonTree()
s:LevelUp()
s:LevelUp()
a:Hide(1)
--9
a = AddAsteroidWithAttribs(math.random(-10000,-3000),math.random(2000,8000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--10
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:SetGraceTime(200)
s = a:AddDysonTree()
s = a:AddDysonTree()
s = a:AddDefenseTree()
a:AddSeedlings(math.random(20,40))
a:Hide(1)
--11
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 1
a.TreeCap = 0
a:SetProtected(true)
s = a:AddDefenseTree()
s = a:AddDefenseTree()
s = a:AddDefenseTree()
a.Moveable = true
a:Hide(1)
--12
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a:SetGraceTime(50)
s = a:AddDefenseTree()
s = a:AddDefenseTree()
s = a:AddDefenseTree()
a:AddSeedlings(math.random(20,40))
a.Moveable = true
a:Hide(1)
--13
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--14
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(3,4)
a.Moveable = true
a:SetGraceTime(200)
s = a:AddDysonTree()
s = a:AddDysonTree()
s = a:AddDefenseTree()
a:AddSeedlings(math.random(20,40))
a:Hide(1)
--15
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--16
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--17 Enemy Sprawl Asteroid
a = AddAsteroidWithAttribs(math.random(-30000,-25000),math.random(-20000,-10000), math.random(10,10) / 10,math.random(10,10) / 10,math.random(10,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 6
a.Moveable = true
a:Hide(1)
a:SetGraceTime(9999999)
a:AddSeedlings(math.random(40,60))
a:SetRadius(1500)
SetDysonTreeButtonAvailable(true)
SetDefenseTreeButtonAvailable(true)
SetFlowerDefenseButtonAvailable(false)
SetFlowerSeederButtonAvailable(false)
SetTerraformingButtonAvailable(false)
SetBeaconButtonAvailable(false)
if IsThIsThisiOS() then
SetEnemyInfoAvailable(true)
SetCoreInfoAvailable(true)
SetAttribsInfoAvailable(true)
SetSpeedSwitchAvailable(true)
SetSendModeScoutAvailable(true)
SetSendModeUnitsSelectorAvailable(true)
SetSendModeButtonAvailable(true)
SetSendModeHoldAvailable(true)
SetSendModeDragAvailable(true)
else
SetTreeInfoAvailable(true)
SetEnemyInfoAvailable(true)
SetCoreInfoAvailable(true)
SetAttribsInfoAvailable(true)
end
SetCameraPosition(5000,2000)
end
function LevelLogic()
StartLevelLogic()
foundAsteroidbarron11 = 0
GetAsteroid(17):AddDysonTree()
GetAsteroid(17):AddDysonTree()
GetAsteroid(17):AddDysonTree()
GetAsteroid(17):AddDefenseTree()
GetAsteroid(17):AddDefenseTree()
GetAsteroid(17):AddDefenseTree()
CheckConditions()
WaitReal(4)
SetBackdropColour(8/255,8/255,20/255)
if IsThIsThisiOS() then -- Offerings
SelectionClear()
WaitReal(2)
SetLevelDim(true)
Message("-Ordered Strike-", true, 1.0, "Top")
WaitMessage(true)
SetLevelDim(false)
else
MessageBox("-Ordered Strike-")
WaitDialog()
end
if IsThIsThisiOS() then -- Use The Seedlings
WaitReal(1)
Message("Use the seedlings I have given you to conquer this belt.", true, 1.0, "Top")
WaitMessage(true)
else
MessageBox("Use the seedlings I have given you to conquer this belt.")
WaitDialog()
end
while foundAsteroidbarron11 == 0 do
CheckConditions()
coroutine.yield()
end
if IsThisiOS() then -- Beacon
WaitReal(1)
Message("You have found an Unstable Asteroid,~Click on any asteroid you own, and press the {u57345} Beacon Button", true, 1.0, "Top")
SetBeaconButtonAvailable(true)
WaitMessage(true)
else
MessageBox("You have found an Unstable Asteroid,~Click on any asteroid you own, and press the {u57345} Beacon Button")
WaitDialog()
end
if IsThisiOS() then -- Beacon Explination
WaitReal(1)
Message("Then Select the Unstable Asteroid~This will send any newly created seedlings to this Asteroid automatically.", true, 1.0, "Top")
SetBeaconButtonAvailable(true)
WaitMessage(true)
else
MessageBox("Then Select the Unstable Asteroid~This will send any newly created seedlings to this Asteroid automatically.")
WaitDialog()
end
while GameRunning() do
CheckConditions()
coroutine.yield()
end
end
function CheckConditions()
if gameFinished then
return
end
if GetEmpire(1):GetNumOwnedAsteroids() == GetNumAsteroids() then
if IsThisiOS() then
GameOver(true, "")
Message("You successfully taken this belt.~Well Done", true, 1.0, "Centre")
WaitMessage(false)
WaitDialog()
Quit(true)
else
MessageBox("You successfully taken this belt.~Well Done")
GameOver(true, "")
Quit(true)
end
end
if GetEmpire(1).NumDysonTrees == 0 and GetEmpire(1).NumSeedlings == 0 then
if IsThisiOS() then
GameOver(false, "")
Message("You have failed to complete the tasks.", true, 1.0, "Centre")
WaitMessage(false)
WaitDialog()
Quit(false)
else
MessageBox("You have failed to complete the tasks.")
GameOver(false, "")
Quit(false)
end
end
end
function OnAsteroidRevealed(id, owner)
if id == 11 then
foundAsteroidbarron11 = 1
end
end
function IsThIsThisiOS()
if GetScreenWidth() == 2048 or GetScreenWidth() == 1024 then
if GetScreenHeight() == 1536 or GetScreenHeight() == 768 then
return true
else
return false
end
else
return false
end
end
It works fine on my iPad
--11
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 1
a.TreeCap = 0
a:SetProtected(true)
s = a:AddDefenseTree()
s = a:AddDefenseTree()
s = a:AddDefenseTree()
a.Moveable = true
a:Hide(1)
function LevelSetup()
--SetBackdropColour(8/255,8/255,20/255)
SetBackdropColour(225/255,225/255,225/255)
--Special thanks to Aino, Pilchard123, Alex and Annikk.exe's Guides and Helps, Without them I wouldn't have been inspired to create this custom iPad
--campaign, also obviously, without the Game, none of this would have been possible. The Creator of this level/story is Tomfloria.
--Remember this though when searching through this code, (Aino) :D I am a beginner, and the code might be messy
--But that isn't my concern, if you can clean it up, so that it works exactly the same, then go ahead, and send me
--a PM on the Eufloria Forums at http://www.dyson-game.com/smf/index.php?board=3.0
if IsThIsThisiOS() then
SetMessageDarkMode(true)
end
if IsThIsThisiOS() then
Globals():Get("Asteroids"):Set("RadiusPowerRule",2)
Globals():Get("Asteroids"):Set("SizeFromEnergy",230)
Globals():Get("Asteroids"):Set("SizeFromStrength",230)
Globals():Get("Asteroids"):Set("SizeFromSpeed",240)
Globals():Get("Asteroids"):Set("MinCoreHealth",75)
Globals():Get("Asteroids"):Set("MaxCoreHealth",350)
Globals():Get("Asteroids"):Set("CoreHealthPowerRule",2.5)
Globals():Get("Asteroids"):Set("MinSendDistance",3500)
Globals():Get("Asteroids"):Set("MaxSendDistance",5500)
Globals():Get("Asteroids"):Set("SendPowerRule",2.0)
Globals():Get("Asteroids"):Set("SpawnCap", 40)
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("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)
else
Globals.G.Asteroids=(0)
Globals.G.EnemyFactionsMin=(0)
Globals.G.EnemyFactionsMax=(0)
end
--0 Starting Asteroid
a = AddAsteroidWithAttribs(5000,2000, math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 1
a.TreeCap = 3
s = a:AddDysonTree()
s = a:AddDysonTree()
a:AddSeedlings(30)
a.Moveable = false
--1
a = AddAsteroidWithAttribs(math.random(-4000,9000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 3
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--2
a = AddAsteroidWithAttribs(math.random(-4000,9000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 2
a:SetGraceTime(1000)
s = a:AddDysonTree()
s = a:AddDefenseTree()
a:AddSeedlings(math.random(20,40))
a.Moveable = true
a:Hide(1)
--3
a = AddAsteroidWithAttribs(math.random(-4000,15000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 3
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--4
a = AddAsteroidWithAttribs(math.random(-4000,15000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 1
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--5
a = AddAsteroidWithAttribs(math.random(-4000,15000),math.random(1000,3000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 3
a.Moveable = true
a:SetGraceTime(0)
a:AddSeedlings(math.random(20,40))
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
s = a:AddDysonTree()
s:LevelUp()
s:LevelUp()
a:Hide(1)
--6
a = AddAsteroidWithAttribs(math.random(-10000,-3000),math.random(2000,8000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--7
a = AddAsteroidWithAttribs(math.random(-10000,-3000),math.random(2000,8000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--8
a = AddAsteroidWithAttribs(math.random(-10000,-3000),math.random(2000,8000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(2,4)
a.Moveable = true
a:SetGraceTime(4000)
a:AddSeedlings(math.random(20,40))
a:SetRadius(math.random(500,1000))
s = a:AddDefenseTree()
s:LevelUp()
s:LevelUp()
s = a:AddDysonTree()
s:LevelUp()
s:LevelUp()
a:Hide(1)
--9
a = AddAsteroidWithAttribs(math.random(-10000,-3000),math.random(2000,8000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--10
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:SetGraceTime(200)
s = a:AddDysonTree()
s = a:AddDysonTree()
s = a:AddDefenseTree()
a:AddSeedlings(math.random(20,40))
a:Hide(1)
--11
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 1
a.TreeCap = 0
a:SetProtected(true)
s = a:AddDefenseTree()
s = a:AddDefenseTree()
s = a:AddDefenseTree()
a.Moveable = true
a:Hide(1)
--12
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a:SetGraceTime(50)
s = a:AddDefenseTree()
s = a:AddDefenseTree()
s = a:AddDefenseTree()
a:AddSeedlings(math.random(20,40))
a.Moveable = true
a:Hide(1)
--13
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--14
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(3,4)
a.Moveable = true
a:SetGraceTime(200)
s = a:AddDysonTree()
s = a:AddDysonTree()
s = a:AddDefenseTree()
a:AddSeedlings(math.random(20,40))
a:Hide(1)
--15
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--16
a = AddAsteroidWithAttribs(math.random(-30000,-10000),math.random(-20000,-10000), math.random(1,10) / 10,math.random(1,10) / 10,math.random(1,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = math.random(1,4)
a.Moveable = true
a:Hide(1)
a:SetRadius(math.random(500,1000))
--17 Enemy Sprawl Asteroid
a = AddAsteroidWithAttribs(math.random(-30000,-25000),math.random(-20000,-10000), math.random(10,10) / 10,math.random(10,10) / 10,math.random(10,10) / 10) --BARRENROID
a.Owner = 0
a.TreeCap = 6
a.Moveable = true
a:Hide(1)
a:SetGraceTime(9999999)
a:AddSeedlings(math.random(40,60))
a:SetRadius(1500)
SetDysonTreeButtonAvailable(true)
SetDefenseTreeButtonAvailable(true)
SetFlowerDefenseButtonAvailable(false)
SetFlowerSeederButtonAvailable(false)
SetTerraformingButtonAvailable(false)
SetBeaconButtonAvailable(false)
if IsThIsThisiOS() then
SetEnemyInfoAvailable(true)
SetCoreInfoAvailable(true)
SetAttribsInfoAvailable(true)
SetSpeedSwitchAvailable(true)
SetSendModeScoutAvailable(true)
SetSendModeUnitsSelectorAvailable(true)
SetSendModeButtonAvailable(true)
SetSendModeHoldAvailable(true)
SetSendModeDragAvailable(true)
else
SetTreeInfoAvailable(true)
SetEnemyInfoAvailable(true)
SetCoreInfoAvailable(true)
SetAttribsInfoAvailable(true)
end
SetCameraPosition(5000,2000)
end
function LevelLogic()
StartLevelLogic()
foundAsteroidbarron11 = 0
GetAsteroid(17):AddDysonTree()
GetAsteroid(17):AddDysonTree()
GetAsteroid(17):AddDysonTree()
GetAsteroid(17):AddDefenseTree()
GetAsteroid(17):AddDefenseTree()
GetAsteroid(17):AddDefenseTree()
CheckConditions()
WaitReal(4)
SetBackdropColour(8/255,8/255,20/255)
if IsThIsThisiOS() then -- Offerings
SelectionClear()
WaitReal(2)
SetLevelDim(true)
Message("-Ordered Strike-", true, 1.0, "Top")
WaitMessage(true)
SetLevelDim(false)
else
MessageBox("-Ordered Strike-")
WaitDialog()
end
if IsThIsThisiOS() then -- Use The Seedlings
WaitReal(1)
Message("Use the seedlings I have given you to conquer this belt.", true, 1.0, "Top")
WaitMessage(true)
else
MessageBox("Use the seedlings I have given you to conquer this belt.")
WaitDialog()
end
while foundAsteroidbarron11 == 0 do
CheckConditions()
coroutine.yield()
end
if IsThisiOS() then -- Beacon
WaitReal(1)
Message("You have found an Unstable Asteroid,~Click on any asteroid you own, and press the {u57345} Beacon Button", true, 1.0, "Top")
SetBeaconButtonAvailable(true)
WaitMessage(true)
else
MessageBox("You have found an Unstable Asteroid,~Click on any asteroid you own, and press the {u57345} Beacon Button")
WaitDialog()
end
if IsThisiOS() then -- Beacon Explination
WaitReal(1)
Message("Then Select the Unstable Asteroid~This will send any newly created seedlings to this Asteroid automatically.", true, 1.0, "Top")
SetBeaconButtonAvailable(true)
WaitMessage(true)
else
MessageBox("Then Select the Unstable Asteroid~This will send any newly created seedlings to this Asteroid automatically.")
WaitDialog()
end
while GameRunning() do
CheckConditions()
coroutine.yield()
end
end
function CheckConditions()
if gameFinished then
return
end
if GetEmpire(1):GetNumOwnedAsteroids() == GetNumAsteroids() then
if IsThisiOS() then
GameOver(true, "")
Message("You successfully taken this belt.~Well Done", true, 1.0, "Centre")
WaitMessage(false)
WaitDialog()
Quit(true)
else
MessageBox("You successfully taken this belt.~Well Done")
GameOver(true, "")
Quit(true)
end
end
if GetEmpire(1).NumDysonTrees == 0 and GetEmpire(1).NumSeedlings == 0 then
if IsThisiOS() then
GameOver(false, "")
Message("You have failed to complete the tasks.", true, 1.0, "Centre")
WaitMessage(false)
WaitDialog()
Quit(false)
else
MessageBox("You have failed to complete the tasks.")
GameOver(false, "")
Quit(false)
end
end
end
function OnAsteroidRevealed(id, owner)
if id == 11 then
foundAsteroidbarron11 = 1
end
end
function IsThIsThisiOS()
if GetScreenWidth() == 2048 or GetScreenWidth() == 1024 then
if GetScreenHeight() == 1536 or GetScreenHeight() == 768 then
return true
else
return false
end
else
return false
end
end
SetBackdropColour(225/255,225/255,225/255)
SetBackdropColour(0,0,0)
I don't know why the backdrop is like that, but Alex used it, but I don't know, I'll try single ones because it doesn't divide the colours :P
SetProtected(true) means no matter what the grace time is, that asteroid will never be attacked
My bad, it does divide the colours, just done singles.