Eufloria > Eufloria HD Mods

iPad Custom Level [HELP, Very Beginner]

(1/9) > >>

Tomfloria:
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.


--- Code: ---function LevelSetup()
if IsiOS() then
SetSpeedSwitchAvailable(false)
end

--- End code ---

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?


--- Code: ---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)

--- End code ---

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?


--- Code: --- 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)

--- End code ---

I can guess? But i'd rather be told the real thing.


--- Code: --- Globals():Get("Game"):Set("MinAsteroidSeparation",1500)
Globals():Get("Game"):Set("MaxAsteroidNeighbourDist",3500)
Globals():Get("Game"):Set("GreysProbability",0.15)

--- End code ---

Help. :/


--- Code: --- AddAsteroidRing(4, 0, 0, 1700, 6500)
--- End code ---

Is this something to do with position?


--- Code: --- -- 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
--- End code ---

I'll tell you first what I understand from this...

--- Code: --- -- 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?

--- End code ---


--- Code: ---asteroidID = GetRandomRange( 6, 8 )

--- End code ---

?


--- Code: ---stage = 0

function LevelLogic()
StartLevelLogic()

GetEmpire(1):UpdateAsteroidLists()
GetEmpire(0):UpdateAsteroidLists()
GetEmpire(2):UpdateAsteroidLists()

--- End code ---

No idea?

I don't really want to add text at the moment so is the following useful to me at the moment?


--- Code: --- --
-- 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


--- End code ---

Again to whoever has taken their precious time to help me, thank you, it won't be underappreciated.

Aino:
Oh wow, new functions :D

A lot of the codes are already covered by Annikk in the beginner guide, go check it out! :)
The other codes I guess you'll need to experiment with or wait for A||R to answer :)

Pilchard123:

--- Quote from: Aino on May 01, 2012, 08:25:20 PM ---The other codes I guess you'll need to experiment with or wait for A||R to answer :)

--- End quote ---

Bitwise, short-circuiting?

Tomfloria:
Hey Aino, firstly thanks for replying :)

And most of the code is kind of the same but a bit different from looking at Annikk.exe's guide, I've emailed an Admin/Mod, can't remember who, they posted something about iPad level testing, i'll see what happens.

Aino:

--- Quote from: Pilchard123 on May 02, 2012, 01:16:44 AM ---
--- Quote from: Aino on May 01, 2012, 08:25:20 PM ---The other codes I guess you'll need to experiment with or wait for A||R to answer :)

--- End quote ---

Bitwise, short-circuiting?

--- End quote ---

You mean the ||? That's or in java :P

Navigation

[0] Message Index

[#] Next page

Go to full version