Author Topic: iPad Custom Level [HELP, Very Beginner]  (Read 15793 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 #15 on: May 04, 2012, 01:08:34 AM »
That's because he missed out a few lines at the start. Ignore the first three lines of Aino's code.

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #16 on: May 04, 2012, 01:23:21 AM »
Thanks Pilchard, but now I have the problem of the camera being able to move off screen.

Code: [Select]
zoomRestricted  = true
cameraRestricted  = true
while GameRunning() do
if GetCameraZoom() > 3500 and GetCameraPosition() = (0,0) and zoomRestricted and cameraRestricted then
SetCameraPositionNow(0,0)
SetCameraZoomNow(3500)
end

See this is the annoying thing for a beginner.

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 23
  • Posts: 930
  • Eufloria: Yes
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #17 on: May 04, 2012, 01:37:49 AM »
I see the problem. You will only lock the camera if it is zoomed out, and will only lock the zoom if the camera has not moved. Change the code to check each thing individually, like this

Code: [Select]
zoomRestricted  = true
cameraRestricted  = true

while GameRunning() do
if GetCameraZoom() > 3500 and zoomRestricted then
SetCameraPositionNow(0,0)
SetCameraZoomNow(3500)
end
                if not GetCameraPosition() = (0,0) and cameraRestricted then
SetCameraPositionNow(0,0)
SetCameraZoomNow(3500)
end

                coroutine.yield()
end

That NOT will basically check if the camera has moved - if it is NOT at (0,0). Sorry that's such a quick explanation, if you need more help just ask.

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #18 on: May 04, 2012, 01:41:22 AM »
I will be needling a lot of help, but thank you for replying, I will add this and get back to you :)

I have this for function LevelLogic() but it crashes my game still :/
Code: [Select]

function LevelLogic()
StartLevelLogic()

zoomRestricted  = true
cameraRestricted  = true

while GameRunning() do
if GetCameraZoom() > 3500 and zoomRestricted then
SetCameraPositionNow(0,0)
SetCameraZoomNow(3500)
end

if not GetCameraPosition() = (0,0) and cameraRestricted then
SetCameraPositionNow(0,0)
SetCameraZoomNow(3500)
end

                coroutine.yield()

end
end
« Last Edit: May 04, 2012, 01:45:44 AM by Tomfloria »

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 23
  • Posts: 930
  • Eufloria: Yes
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #19 on: May 04, 2012, 01:43:31 AM »
Oh, one thing that I will ask - could you post any error messages that come up when you test a level?

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #20 on: May 04, 2012, 01:46:13 AM »
I'm using the iPad, I no idea how to find the error messages?


Also, how would I state the senddistance to be exaclty 250 per say? I want to create asteroids to 'pop up' into the world when I've gone over some text, could I just place the asteroids in LevelSetup() then make them hidden? then put some code up in LevelLogic()?

Code: [Select]
--Starting Asteroid
a = GetAsteroid(0)
a = GetEmpire(1)
a = AddAsteroidWithAttribs(0,0, 1.0,1.0,1.0)
a.Owner = 1
a:AddSeedlings(10)
a.TreeCap = 1
a.Moveable = false
a:SetRadius(1040)
a.SendDistance = 100

This is the starting asteroid, but I know for a fact the senddistance isn't 100
« Last Edit: May 04, 2012, 02:10:23 AM by Tomfloria »

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 23
  • Posts: 930
  • Eufloria: Yes
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #21 on: May 04, 2012, 02:13:40 AM »
Ah, so you are. On the PC version if a map fails to load there will be a message that reads something like

Unable to load level "A_PATH_HERE" due to the following error: A_PATH_HERE: NUMBER : Unexpected token near 'i'

Does that happen on the iPad?

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 #22 on: May 04, 2012, 02:20:17 AM »
The last thing I remember in coding is that == is equal to and = is set to... I might've been mistaken :o

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #23 on: May 04, 2012, 02:32:45 AM »
No, nothing happens with the ipad, if you want I can paste my current whole level code?

Is it possible to do something like

Camera movement only allowed from top left (-1000,1000) to bottom right (1000,-1000) so the user can move it, but only between that box/region so it's still restricted but I have defined the space

Also Aino, putting a.SendDistance == 100 crashes the game

Also guys, How would I change the colour of the message text?
« Last Edit: May 04, 2012, 02:42:12 AM by Tomfloria »

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 #24 on: May 04, 2012, 03:53:07 AM »
a.SendDistance == 100 should be used in an if statement.
a.SendDistance = 100 is correct when you want to change the senddistance.

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #25 on: May 04, 2012, 03:58:16 AM »
It still doesn't work Aino, it's like the game automatically changes it so all asteroids are reachable

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 #26 on: May 04, 2012, 04:59:39 AM »
You said it crashed the game, to fix that you'll need to either change a to a unique name for each asteroid and us that as a in the LevelLogic function. Like this:
Code: [Select]
IMANASTEROID = AddAsteroid(0,0)

function LevelLogic()
IMANASTEROID.SendDistance = x
end

Or you can use GetAsteroid(ID) and change the senddistance in LevelLogic.

THE POINT IS: do it in LevelLogic as I believe it has a greater chance of success.

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #27 on: May 04, 2012, 05:10:34 AM »
Okay I will try this, Thank you for the help I am currently having throuble with something I experimented on...

Code: [Select]
if GetAsteroid(a):GetNumSeedlings() = 60 and GetNumDysonTrees() = 4 then
Message("You now have 60 seedlings, lets expand this Empire.~Notice the Asteroid to the left - Take it.", true, 1.0, "Centre")
b = GetAsteroid(0)
b = GetEmpire(1)
b = AddAsteroidWithAttribs(1432,4523, 0.6,0.1,0.5)
b.Owner = 0
b.TreeCap = 2
b.Moveable = false
b:SetRadius(124)
WaitDialog()

I want to spawn an asteroid if the number of seedlings on asteroid a is 60 and the number of dyson trees is 4


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 #28 on: May 04, 2012, 05:30:29 AM »
That is in the LevelLogic, this is wrong :P

The only thing you should be doing in LevelLogic is to change the senddistance, creating asteroids still belongs in LevelSetup :)

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: iPad Custom Level [HELP, Very Beginner]
« Reply #29 on: May 04, 2012, 05:36:01 AM »
Yes, but what if I didn't want the asteroid at the start? So i wanted it to magically pop up after the seedlings and dyson trees are met on asteroid a?