Eufloria > Eufloria HD Mods

iPad Custom Level [HELP, Very Beginner]

<< < (2/9) > >>

Aino:
It's time to break this thing down:

This is the most complicated one:
(click to show/hide)I'm using one, since the rest follow the exact same as this one:

--- Code: ---Globals():Get("Asteroids"):Set("RadiusPowerRule",1.2)
--- End code ---

Globals() is a getter for the Global variables we use to change everything in the game with. The Globals is here a HashTable/List/Map/etc... which means you can use Strings(text) to reach what you want, in this example:
:Get("Asteroids") which is the get function and it returns yet another HashTable/List/whatever and you can use
:Set("RadiusPowerRule",1.2) which needs two parameters, a String to locate the variable to change and a number which is what you want to change it to.

You can use this informations to change the globals, for example:

--- Code: ---Globals():Get("Game"):Set("EnemyFactionsMin", 0)
--- End code ---
which is:

--- Code: ---Globals.G.EnemyFactionsMin = 0
--- End code ---

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.

The rest is very well known code.
I also bet this is how it will look after the update :)

Tomfloria:
Well here we go, this is the basic level isn't it.


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

--- End code ---

It doesn't complete yet, as in, theres no code to say if all enemies are defeated then I have completed the level, but I don't want that in yet. I want to play around with a few things, but I do have a question.

I had a look at the lua reference and I can't find help on the Zoom function, The...


--- Code: --- SetCameraPositionToAsteroidID(0)
SetCameraZoomNow(50)
--- End code ---

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?

The help is appreciated?
   
EDIT:: Found were the text is stored, it's a land.csv file that is easily opened with excel.

Aino:

--- Quote from: Tomfloria on May 03, 2012, 02:59:56 AM ---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?

--- End quote ---

To do this:


--- Code: ---if (GetCameraZoom() > 50) then
SetCameraZoomNow(50)
end
--- End code ---

BTW, those () brackets in the if condition isn't needed in Lua. It's just a java habit :P

Tomfloria:
Thank you Aino! Trying to get some text working now, hopefully get the first level done tonight, If I need any help i'll reply here or message you, since you're the helper.

Thank you! :)

EDIT::

You're code


--- Code: ---if (GetCameraZoom() > 50) then
SetCameraZoomNow(50)
end
--- End code ---

Seems to crash my level, is it supposed to look like this?

EDIT::

Also remember this is for the iPad, so it might need to be wrote differently?


--- Code: --- SetCameraPositionToAsteroidID(0)
SetCameraZoomNow(10)
if (GetCameraZoom() > 50) then
SetCameraZoomNow(50)
end
--- End code ---

Aino:
Geee, how can I forget:
It's supposed to be in a while loop in levellogic, or the logic function that exists.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version