Since I don't have the PC version of this game, I only have the iPad version, and would love to start creating my custom levels, I would like to create a full 25 level story which replaces the original story, but suprise suprise, I don't know much about scripting.
There is hope though, from looking through the .lua file of say level 4, I have been playing around with the attributes and seedlings of the asteroids and i'd say I understand that, but from the level_4.lua file I'll upload some code I don't understand, and hopefully someone will be kind enough to help me.
function LevelSetup()
if IsiOS() then
SetSpeedSwitchAvailable(false)
end
Some of you may laugh, because this is the start of the scripting, but is this just the speed setting at the top left? and because it says false it means it's not visible/usabe?
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)
I just don't get these lines of codes, I know it's to do with the Asteroids, but i'm not understanding the PowerRule?
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)
I can guess? But i'd rather be told the real thing.
Globals():Get("Game"):Set("MinAsteroidSeparation",1500)
Globals():Get("Game"):Set("MaxAsteroidNeighbourDist",3500)
Globals():Get("Game"):Set("GreysProbability",0.15)
Help. :/
AddAsteroidRing(4, 0, 0, 1700, 6500)
Is this something to do with position?
-- 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
I'll tell you first what I understand from this...
-- 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()
No idea?
I don't really want to add text at the moment so is the following useful to me at the moment?
--
-- 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
Again to whoever has taken their precious time to help me, thank you, it won't be underappreciated.