Author Topic: Small problem with SendSeedlingsToTarget in waves.  (Read 8668 times)

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
Small problem with SendSeedlingsToTarget in waves.
« on: May 17, 2012, 02:26:10 AM »
So one of my levels is to protect some seedlings. I wanted to keep Pictures secret until a later date for a teaser. But pictures might explain better than words, Maybe...

(click to show/hide)

So there are the asteroids and what I want is a few waves of seedlings sent from asteroid 7 and 8 in a pattern I choose.

So guys, Whadup with this code?

Code: [Select]
function LevelLogic()
StartLevelLogic()

waveonedone = false

GetAsteroid(1).SendDistance = 2500
GetAsteroid(2).SendDistance = 2500
GetAsteroid(3).SendDistance = 2500
GetAsteroid(4).SendDistance = 2500
GetAsteroid(5).SendDistance = 2500
GetAsteroid(6).SendDistance = 2500
GetAsteroid(7).SendDistance = 14000
GetAsteroid(8).SendDistance = 14000

if IsiOS() then
WaitReal(1)
GetAsteroid(8):SendSeedlingsToTarget(3,20,GetAsteroid(3))
waveonedone = true
end

if waveonedone == true then
if IsiOS() then
WaitReal(1)
GetAsteroid(7):SendSeedlingsToTarget(3,40,GetAsteroid(4))
wavetwodone = true
end
end


while GameRunning() do
CheckConditions()
coroutine.yield()
end

end

It completely misses out

Code: [Select]
[code][code] if IsiOS() then
WaitReal(1)
GetAsteroid(8):SendSeedlingsToTarget(3,20,GetAsteroid(3))
waveonedone = true
end
[/code][/code]

And goes to the second bit? :S
« Last Edit: May 17, 2012, 02:41:53 AM by Tomfloria »

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Small problem with SendSeedlingsToTarget in waves.
« Reply #1 on: May 17, 2012, 03:34:19 AM »
Try a fish messagebox?

(point 9)
« Last Edit: May 17, 2012, 03:37:39 AM by annikk.exe »

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
Re: Small problem with SendSeedlingsToTarget in waves.
« Reply #2 on: May 17, 2012, 04:12:56 AM »
Code: [Select]
MessageBox("1")

if IsiOS() then
WaitReal(1)
GetAsteroid(8):SendSeedlingsToTarget(3,20,GetAsteroid(3))
WaitReal(10)
waveonedone = true
end

MessageBox("2")

if waveonedone == true then
if IsiOS() then
WaitReal(1)
GetAsteroid(7):SendSeedlingsToTarget(3,40,GetAsteroid(4))
wavetwodone = true
end
end

MessageBox("3")

Right, this is what happens, in order

MessageBox
Waits about 10 game seconds
MessageBox
40 Seedlings sent to Asteroid 4

So from that, the first sendseedlingstotarget is still completely missed out?

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
Re: Small problem with SendSeedlingsToTarget in waves.
« Reply #3 on: May 17, 2012, 04:15:49 AM »
Hmmmmm, this does absolutely nothing but show the messagebox...

Code: [Select]
function LevelLogic()
StartLevelLogic()

waveonedone = false

GetAsteroid(1).SendDistance = 2500
GetAsteroid(2).SendDistance = 2500
GetAsteroid(3).SendDistance = 2500
GetAsteroid(4).SendDistance = 2500
GetAsteroid(5).SendDistance = 2500
GetAsteroid(6).SendDistance = 2500
GetAsteroid(7).SendDistance = 14000
GetAsteroid(8).SendDistance = 14000

MessageBox("1")

GetAsteroid(8):SendSeedlingsToTarget(3,20,GetAsteroid(3))

MessageBox("1")


while GameRunning() do
CheckConditions()
coroutine.yield()
end

end

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Small problem with SendSeedlingsToTarget in waves.
« Reply #4 on: May 17, 2012, 04:46:30 AM »
Code: [Select]
MessageBox("1")

if IsiOS() then
WaitReal(1)
GetAsteroid(8):SendSeedlingsToTarget(3,20,GetAsteroid(3))
WaitReal(10)
waveonedone = true
end

MessageBox("2")

if waveonedone == true then
if IsiOS() then
WaitReal(1)
GetAsteroid(7):SendSeedlingsToTarget(3,40,GetAsteroid(4))
wavetwodone = true
end
end

MessageBox("3")

Right, this is what happens, in order

MessageBox
Waits about 10 game seconds
MessageBox
40 Seedlings sent to Asteroid 4

So from that, the first sendseedlingstotarget is still completely missed out?


I meant try something like this:


Code: [Select]
if IsiOS() then
MessageBox("Fish")
WaitReal(1)
GetAsteroid(8):SendSeedlingsToTarget(3,20,GetAsteroid(3))
waveonedone = true
end

That way, you'll know whether the answer to if IsiOS() is true or false; if it's true, you'll get a Fish.  If it's false, you won't get a Fish.  Understand? :>

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
Re: Small problem with SendSeedlingsToTarget in waves.
« Reply #5 on: May 17, 2012, 04:54:01 AM »
I've found something, that it kind of strange, and I'm stuck and confused...

Code: [Select]
if IsiOS() then -- Need to Trap Sprawl
WaitReal(1)
Message("Test 1", true, 1.0, "Left")
WaitMessage(true)
stage = 1
else
MessageBox("01_01")
WaitDialog()
end

if stage == 1 then
GetAsteroid(7):SetGraceTime(0)
GetAsteroid(7):SendSeedlingsToTarget(0,10,GetAsteroid(4))
WaitReal(1)
stage = 2
end

if stage == 2 then
GetAsteroid(8):SetGraceTime(0)
GetAsteroid(8):SendSeedlingsToTarget(0,40,GetAsteroid(4))
end

if IsiOS() then -- Need to Trap Sprawl
WaitReal(1)
Message("Test 2", true, 1.0, "Left")
WaitMessage(true)
stage = 2
else
MessageBox("01_01")
WaitDialog()
end

Message("Test 2", true, 1.0, "Top")

while GameRunning() do
CheckConditions()
coroutine.yield()
end

That completely works, it sends seedlings from 7 and 8 to Asteroid 4...


But check this out, if it's not Asteroid 4, IT WON'T SEND SEEDLINGS THERE. what?

The send distance of 7 and 8 reaches every asteroid, so why is Asteroid 4 so demanding?

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Small problem with SendSeedlingsToTarget in waves.
« Reply #6 on: May 17, 2012, 04:56:58 AM »
What's the purpose of the IsiOS() thing?

Also, when you start the above level, what does the messagebox say?

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Small problem with SendSeedlingsToTarget in waves.
« Reply #7 on: May 17, 2012, 04:58:57 AM »
I recommend trying the fish test as I described above to find out what the result of IsiOS() is.  That will point you in the right direction.

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
Re: Small problem with SendSeedlingsToTarget in waves.
« Reply #8 on: May 17, 2012, 05:04:40 AM »
well iOS is the operating system of the ipad and i've done the fish test, but with how messages with ipad eufloria works

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
Re: Small problem with SendSeedlingsToTarget in waves.
« Reply #9 on: May 17, 2012, 05:35:58 AM »
it seems this at the start of levellogic()

Code: [Select]
--GetAsteroid(1).SendDistance = 20000
--GetAsteroid(2).SendDistance = 20000
--GetAsteroid(3).SendDistance = 20000
--GetAsteroid(4).SendDistance = 20000
--GetAsteroid(5).SendDistance = 20000
--GetAsteroid(6).SendDistance = 20000

Was messing things up, and it actually works now by putting a.SendDistance = 20000 in levelsetup

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
Re: Small problem with SendSeedlingsToTarget in waves.
« Reply #10 on: May 17, 2012, 05:40:09 AM »

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Small problem with SendSeedlingsToTarget in waves.
« Reply #11 on: May 17, 2012, 05:45:01 AM »
Glad you got it working :>  But doesn't that mean that if someone plays it on a PC, the If statement won't trigger?

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
Re: Small problem with SendSeedlingsToTarget in waves.
« Reply #12 on: May 17, 2012, 05:48:31 AM »
Well i'm only making it for iPad aren't I, so if someone wanted my custom story mode, they'd have to port it.

For example some stuff that maybe would crash the PC would be this....

Code: [Select]
    Globals():Get("Asteroids"):Set("RadiusPowerRule",4)
Globals():Get("Asteroids"):Set("SizeFromEnergy",530)
Globals():Get("Asteroids"):Set("SizeFromStrength",530)
Globals():Get("Asteroids"):Set("SizeFromSpeed",540)
Globals():Get("Asteroids"):Set("MinCoreHealth",75)
Globals():Get("Asteroids"):Set("MaxCoreHealth",350)
Globals():Get("Asteroids"):Set("CoreHealthPowerRule",2.5)
    Globals():Get("Asteroids"):Set("MinSendDistance",3500)
    Globals():Get("Asteroids"):Set("MaxSendDistance",5500)
    Globals():Get("Asteroids"):Set("SendPowerRule",2.0)
Globals():Get("Asteroids"):Set("SpawnCap", 40)

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",1)

Globals():Get("Game"):Set("EnemyFactionsMin",0)
Globals():Get("Game"):Set("EnemyFactionsMax",1)
Globals():Get("Game"):Set("MinAsteroidSeparation",1500)
Globals():Get("Game"):Set("MaxAsteroidNeighbourDist",6000)
Globals():Get("Game"):Set("GreysProbability",0)

and

Code: [Select]
SetBackdropColour(8/255,8/255,20/255)[/code

and

[code] SetDysonTreeButtonAvailable(false)
SetDefenseTreeButtonAvailable(false)
SetFlowerDefenseButtonAvailable(false)
SetFlowerSeederButtonAvailable(false)
SetTerraformingButtonAvailable(true)
SetBeaconButtonAvailable(false)

if IsiOS() then
SetEnemyInfoAvailable(true)
SetCoreInfoAvailable(true)
SetAttribsInfoAvailable(true)

SetSpeedSwitchAvailable(true)
SetSendModeScoutAvailable(false)
SetSendModeUnitsSelectorAvailable(false)

SetSendModeButtonAvailable(false)
SetSendModeHoldAvailable(false)
SetSendModeDragAvailable(false)
else
SetTreeInfoAvailable(true)
SetEnemyInfoAvailable(true)
SetCoreInfoAvailable(true)
SetAttribsInfoAvailable(true)
end
[/code]

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Small problem with SendSeedlingsToTarget in waves.
« Reply #13 on: May 17, 2012, 11:40:01 PM »
Code: [Select]
SetBackdropColour(8/255,8/255,20/255)
That would work on PC.

Code: [Select]
SetDysonTreeButtonAvailable(false)
SetDefenseTreeButtonAvailable(false)
SetFlowerDefenseButtonAvailable(false)

These will work.


Code: [Select]
SetFlowerSeederButtonAvailable(false)
SetTerraformingButtonAvailable(true)
SetBeaconButtonAvailable(false)

These ones won't work.



Code: [Select]
if IsiOS() then
IsiOS() doesn't work on PC.


Code: [Select]
SetEnemyInfoAvailable(true)
SetCoreInfoAvailable(true)
SetAttribsInfoAvailable(true)

These ones should work.


Code: [Select]
SetSpeedSwitchAvailable(true)
SetSendModeScoutAvailable(false)
SetSendModeUnitsSelectorAvailable(false)

Don't think these ones will work.

Code: [Select]
SetSendModeButtonAvailable(false)
SetSendModeHoldAvailable(false)
SetSendModeDragAvailable(false)
SetTreeInfoAvailable(true)
SetEnemyInfoAvailable(true)
SetCoreInfoAvailable(true)
SetAttribsInfoAvailable(true)

Not sure about these.




Also,
Code: [Select]
Globals():Get("Asteroids"):Set("SizeFromEnergy",530)
I'm not sure whether this works on PC.  Might do. :>

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
Re: Small problem with SendSeedlingsToTarget in waves.
« Reply #14 on: May 17, 2012, 11:54:00 PM »
The whole available buttons which are set as false or true at the levels I knew some would work and some wouldn't. The iOS version has some nice features, terraform allows you to change your asteroids attributes :p at the cost of seedlings and you can only change 1 attribute.

E.g energy, but not speed and strength, or strength, etc....

The Beacon button automatically sends new seedlings to one asteroid, really good feature. You get a really nice effect when you have a few asteroids auto sending the seedlings to a new asteroid, In a few of my levels I purposely achieve this effect.

The flower seeder button is wether the flower pods can create super seedlings, the glowing seedlings, does of not have them?

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Small problem with SendSeedlingsToTarget in waves.
« Reply #15 on: May 18, 2012, 12:56:04 AM »
There are glowing seedlings in the PC version too, but I think the commands used to reference them are different.
For example, if a dyson tree has been upgraded so that it produces Glowing Seedlings, this is known as tree.enhanced = true

tree.enhanced = false means a normal dyson tree, not glowy.


So I think the syntax may have changed for some of that stuff.