Author Topic: iPad Custom Level [HELP, Very Beginner]  (Read 15791 times)

0 Members and 1 Guest are viewing this topic.

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 23
  • Posts: 930
  • Eufloria: Yes
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #30 on: May 04, 2012, 05:49:17 AM »
I thought you could add asteroids during LevelLogic()...

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #31 on: May 04, 2012, 06:01:57 AM »
Well hopefully, because even if I used a:Hide(1) it's only hiding the attributes and stuff, wish it actually hid the asteroid.

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 23
  • Posts: 930
  • Eufloria: Yes
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #32 on: May 04, 2012, 06:11:37 AM »
You could make it very, very small with a sendDistance that is also small.

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #33 on: May 04, 2012, 06:30:40 AM »
I'll figure that out in a bit, can you tell me what is wrong with this?

Code: [Select]
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

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 27
  • Posts: 1,523
  • They'll eat you next!
  • Eufloria: Yes
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #34 on: May 04, 2012, 06:36:07 AM »
Doesn't work that way. The game can't make asteroid in the middle of the game, atleast not in LevelLogic...

You must make it in the beginning, hide it and show it up when it's needed. I have to go now and I'm really tired so I'm not much of help at this moment, sry :(

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #35 on: May 04, 2012, 06:57:59 AM »
Can anyone help me on this please?

I would like the code to do this...

When asteroid 0 gets 4 seedlings and has 4 dyson trees i would like a message to be shown and the speed option available

Code: [Select]
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
« Last Edit: May 04, 2012, 09:09:23 PM by Tomfloria »

sillytuna

  • Eufloria lacky
  • Administrator
  • Arboreal Being
  • *****
  • Thank You
  • -Given: 58
  • -Receive: 92
  • Posts: 446
    • TunaHQ
  • Eufloria: Yes
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #36 on: May 25, 2012, 05:34:12 PM »
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.

SetSpeedSwitchAvailable: This just disables or enables the top left speed control. Levels disable it for the first few seconds during opening message displays for one reason - some levels have AI on both switches and timers which are only affected after the text has finished. Having a speed control at the start can thus give a player a head start. It's perhaps not the ideal fix but that's why you'll see this in levels (disabled in set up, enabled after the intro message).

There are many other availability messages too - note that these tend to match game settings although you could be evil and prevent the player planting flowers by disabling the button even though they could grow them according to the rules!

WaitReal(t) - waits t seconds of real time. This is not game time, i.e. it is unaffected by the speed control. It's mainly used for message delays. WaitGame(t) is game time. Parameters are seconds. Nothing actually stops by the way, it just pauses further execution of that function. The game can still end as normal as long as scripting has been done correctly (i.e. the CheckConditions function is valid).

Message(<ID>, <AUTO DISPLAY TIME true/false>, <SIZE>, <LOCATION ["Top", "Left", "Center", possibly right and bottom]>) - you can add text to lang.csv. See my iOS scripting post.

Also, someone was setting zoom to 50. I have no idea if this is ok or not but it looks like a really low number to me. Crashing may be possible if the zoom is set beyond a sensible range (zooms tend to be in the high 100s or 1000s from memory). The camera code was reworked heavily a couple of times to suit the iPad and is probably not hugely flexible.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #37 on: May 25, 2012, 06:02:08 PM »
Thanks for the info about camera zoom...  the iPad version of the command expects different ranges than the PC, I think..?

All very informative.. :>

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #38 on: May 25, 2012, 07:44:39 PM »
It's cleared a few things up, definitely thought WaitReal(1) was wait 1 second in game time, and the camera zoom, you'll have definitely seen me do this, but the player can zoom out whenever they want :P, the camera zoom was only for scripted events, e.g say an explanation of the level and functions where dramatic poses of the asteroids adds to the drama :p I could show you what I mean, but I don't want to use your time :D

sillytuna

  • Eufloria lacky
  • Administrator
  • Arboreal Being
  • *****
  • Thank You
  • -Given: 58
  • -Receive: 92
  • Posts: 446
    • TunaHQ
  • Eufloria: Yes
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #39 on: May 25, 2012, 08:30:01 PM »
I think level 2 does a pan and back at some point?

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #40 on: May 25, 2012, 08:34:46 PM »
I'm not sure, levels 1 - 8 are currently my own at the moment :P, but I've definately seen movement of camera positions during the story mode.

sillytuna

  • Eufloria lacky
  • Administrator
  • Arboreal Being
  • *****
  • Thank You
  • -Given: 58
  • -Receive: 92
  • Posts: 446
    • TunaHQ
  • Eufloria: Yes
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #41 on: May 26, 2012, 06:45:36 AM »
To pan the camera:

SelectionClear() -- Clear current selection
SetCameraFocusToAsteroidID(2, 90000) -- Zoom to asteroid 2, set zoom to 90000

I don't know if setting the camera position itself will work on iOS, but either way you definitely need to have unhidden an asteroid in the area around where you're going or the camera won't be allowed there.

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #42 on: May 26, 2012, 09:16:44 AM »
Well 3 camera positions which are the first three change to different positions of the home asteroid, so the area is fine, it just doesn't go we're I want if the user moves the screen.

It would have been nice if you made a movecameraavalablebutton haha.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #43 on: May 26, 2012, 08:13:23 PM »
Tom,

You asked for some code help a few posts back.

Quote
When asteroid 0 gets 4 seedlings and has 4 dyson trees i would like a message to be shown and the speed option available



I spotted this:

Code: [Select]
if GetAsteroid(0).NumDysonTrees + 4 and GetAsteroid(0).NumSeedlings + 4 then
Should be:

Code: [Select]
if GetAsteroid(0):GetNumDysonTrees() == 4 and GetAsteroid(0):GetNumSeedlings(1) >= 4 then

http://www.dyson-game.com/smf/index.php?topic=212.msg1913#msg1913
For info on getting asteroid infos like this :>


By the way, if you're running this code inside a loop, once the conditions are met, they'll be met on EVERY run through the loop.
So you might want to add a latch variable, so that it only triggers once..

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #44 on: May 26, 2012, 08:20:09 PM »
You could do it with while loops..


Code: [Select]
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")


Or you could do it the pro way (heh) with conditionals..


Code: [Select]
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