Author Topic: Level help  (Read 20188 times)

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Level help
« on: July 02, 2011, 10:57:40 PM »
I received a PM, here's what it says:


Quote
Yo dude i followed your tuts and that and was wanting to know if you could fix my code cause i keep getting random errors but i cannot see the prob thanks

Code: [Select]
function LevelSetup()

  
   -- Set shiz
   SetBackdropColour(0,0,0)
   SetCameraZoomNow(9)
  
   -- Set Global Values
   Globals.G.Asteroids=(0)
   Globals.G.EnemyFactionsMin=(1)
   Globals.G.EnemyFactionsMax=(2)

   -- My Roid
  
   a = AddAsteroidWithAttribs(0,0, 0.8,0.8,0.8)
   a.Owner = 1
   a.TreeCap = 5
   a:SetRadius(700)
   a.SendDistance = 4000
   a:AddSeedlings(150)
   a.Moveable = false

   GenerateLevel()
  
  
end





function GenerateLevel()

   InitArrays()
  
   for i = 0,math.random(6,10) do
      RandomiseAttributes(i)
      PlaceRoids(i)
   end

function InitArrays()
   energy = {}
   strength = {}
   speed = {}
   radius = {}
   senddist = {}
   treecaptcha = {}
   seeds = {}
   x = {}
   y = {}
end

function RandomiseAttributes(RoidID)

   energy[RoidID] = math.random(1,10) / 10 + 0.1
   strength[RoidID] = math.random(1,10) / 10 + 0.1
   speed[RoidID] = math.random(1,10) / 10 + 0.1
   treecaptcha[RoidID] = math.random(2,4)
   radius[RoidID] = math.random (100,450)
   senddist[RoidID] = radius * 10
   seeds[RoidID] = math.random(20,30)
   x[RoidID] = math.random(-5000,5000)
   y[RoidID] = math.random(-5000,5000)


end


function PlaceRoid(RoidID)

   a = AddAsteroidWithAttribs(x[RoidID],y[RoidID],energy[RoidID],strength[RoidID],speed[RoidID])
   a.Owner = 0
   a.TreeCap = treecaptcha[RoidID]
   a.radius = radius[RoidID]
   a.AddSeedlings = seeds[RoidID]
   a.SendDistance = senddist[RoidID]
   a.Moveable = true

end
end



function LevelLogic()

   -- Objective Msg
   Timer = GetGameTime() + 2


   while GetGameTime() < Timer do

      coroutine.yield()
   end

   Pause()
   MessageBox("Take over the whole galaxy to win. Good Luck.")
   WaitDialog()
   Unpause()

   -- Send timed Attack
   Timer = GetGameTime() + 13


   while GetGameTime() < Timer do

      coroutine.yield()
   end
  
      GetAsteroid(2):AddSeedlings(20)
      GetAsteroid(2):SendSeedlingsToTarget(0,200,GetAsteroid(0))
      
      while GameRunning() do
      
      -- Win condition
      if GetEmpire(2):GetNumOwnedAsteroids() == 0 and GetEmpire(3):GetNumOwnedAsteroids() == 0 and GetEmpire(0):GetNumOwnedAsteroids() == 0 then
         Pause()
         MessageBox("You have won")
         WaitDialog()
         Unpause()
         Quit(true)
      end

      -- lose condition
      if GetEmpire(1):GetNumOwnedAsteroids() == 0 then
         Pause()
         MessageBox("You have lost")
         WaitDialog()
         Unpause()
         Quit(false)
      end

      coroutine.yield()
   end
end

Here's the problems I've spotted:

1.  There's no "end" to finish off the GenerateLevel() function.
2.  There's an extra, un-needed "end" at the end of the PlaceRoid() function.

Looks ok apart from that.. :>

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Level help
« Reply #1 on: July 03, 2011, 12:03:58 AM »
Looks a little OTT for a "followed your tuts" map - unless you already know how to use Lua, I'd just stick with something simple.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Level help
« Reply #2 on: July 03, 2011, 12:45:17 AM »
It sounds like he followed all of them.. :>

It's mostly correct, just a few minor things.  Don't see why he shouldn't go for it.  :>

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Level help
« Reply #3 on: July 03, 2011, 01:03:42 AM »
Yeah, fair enough, but I just didn't want him/her to jump in too deep, too quick and give up right at the start.

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Level help
« Reply #4 on: July 03, 2011, 01:45:27 AM »
Here:

Code: [Select]
function LevelSetup()

   
   -- Set shiz
   SetBackdropColour(0,0,0)
   SetCameraZoomNow(9)
   
   -- Set Global Values
   Globals.G.Asteroids=(0)
   Globals.G.EnemyFactionsMin=(1)
   Globals.G.EnemyFactionsMax=(2)

   -- My Roid
   
   a = AddAsteroidWithAttribs(0,0, 0.8,0.8,0.8)
   a.Owner = 1
   a.TreeCap = 5
   a:SetRadius(700)
   a.SendDistance = 4000
   a:AddSeedlings(150)
   a.Moveable = false

   GenerateLevel()
   
   
end





function GenerateLevel()

   InitArrays()
   
   for i = 0,math.random(6,10) do
      RandomiseAttributes(i)
      PlaceRoid(i)
   end
end

function InitArrays()
   energy = {}
   strength = {}
   speed = {}
   radius = {}
   senddist = {}
   treecaptcha = {}
   seeds = {}
   x = {}
   y = {}
end

function RandomiseAttributes(RoidID)

   energy[RoidID] = math.random(1,10) / 10 + 0.1
   strength[RoidID] = math.random(1,10) / 10 + 0.1
   speed[RoidID] = math.random(1,10) / 10 + 0.1
   treecaptcha[RoidID] = math.random(2,4)
   radius[RoidID] = math.random (100,450)
   senddist[RoidID] = radius[RoidID] * 10
   seeds[RoidID] = math.random(20,30)
   x[RoidID] = math.random(-5000,5000)
   y[RoidID] = math.random(-5000,5000)


end


function PlaceRoid(RoidID)

   a = AddAsteroidWithAttribs(x[RoidID],y[RoidID],energy[RoidID],strength[RoidID],speed[RoidID])
   a.Owner = 0
   a.TreeCap = treecaptcha[RoidID]
   a:SetRadius(radius[RoidID])
   a:AddSeedlings(seeds[RoidID])
   a.SendDistance = senddist[RoidID]
   a.Moveable = true

end

function LevelLogic()

   -- Objective Msg
   Timer = GetGameTime() + 2


   while GetGameTime() < Timer do

      coroutine.yield()
   end

   Pause()
   MessageBox("Take over the whole galaxy to win. Good Luck.")
   WaitDialog()
   Unpause()

   -- Send timed Attack
   Timer = GetGameTime() + 13


   while GetGameTime() < Timer do

      coroutine.yield()
   end
   
      GetAsteroid(2):AddSeedlings(20)
      GetAsteroid(2):SendSeedlingsToTarget(0,200,GetAsteroid(0))
     
      while GameRunning() do
     
      -- Win condition
      if GetEmpire(2):GetNumOwnedAsteroids() == 0 and GetEmpire(3):GetNumOwnedAsteroids() == 0 and GetEmpire(0):GetNumOwnedAsteroids() == 0 then
         Pause()
         MessageBox("You have won")
         WaitDialog()
         Unpause()
         Quit(true)
      end

      -- lose condition
      if GetEmpire(1):GetNumOwnedAsteroids() == 0 then
         Pause()
         MessageBox("You have lost")
         WaitDialog()
         Unpause()
         Quit(false)
      end

      coroutine.yield()
   end
end

:)

kmercy

  • Seedling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 34
Re: Level help
« Reply #5 on: July 03, 2011, 02:20:58 AM »
Thanks guys just couldn't spot it was tired up all night etc :D

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Level help
« Reply #6 on: July 03, 2011, 02:45:53 AM »
Glad to help, you should make a topic, the more helpers, the higher are the possability to find the problems... I guess.

I must say, there were no coding errors, only names were written wrong and you sometimes used functions as fields :)
 *All of thoose stuff are common, and deadly irritating!

Welcome aboard, btw :D

kmercy

  • Seedling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 34
Re: Level help
« Reply #7 on: July 04, 2011, 01:43:01 AM »
Causes this error

Attempt to yield across
metamethod\c-call boundary

Anyone know what the prob is?


Code:
(click to show/hide)
« Last Edit: July 04, 2011, 01:50:56 AM by kmercy »

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Level help
« Reply #8 on: July 04, 2011, 03:30:40 AM »
Here:

Code: [Select]
function LevelSetup()

 
   -- Set shiz
   SetBackdropColour(0,0,0)
   SetCameraZoomNow(9)
 
   -- Set Global Values
   Globals.G.EnemyFactionsMin=(1)
   Globals.G.EnemyFactionsMax=(2)
   Globals.Asteroids.SeedlingCap=(500)
   Globals.Asteroids.SpawnCap=(2000)
 

   -- My Roid
 
   a = AddAsteroidWithAttribs(0,0, 0.8,0.8,0.8)
   a.Owner = 1
   a.TreeCap = 5
   a:SetRadius(700)
   a.SendDistance = 4000
   a:AddSeedlings(150)
   a.Moveable = false
 
   a = AddAsteroidWithAttribs(15000,0, 0.8,0.8,0.8)
   a.Owner = 2
   a.TreeCap = 5
   a:SetRadius(700)
   a.SendDistance = 4000
   a:AddSeedlings(150)
   a.Moveable = false
 
   GenerateLevel()
 
end





function GenerateLevel()

   InitArrays()
 
   for i = 2,math.random(15,40) do
      RandomiseAttributes(i)
      PlaceRoid(i)
   end
end

function InitArrays()
   energy = {}
   strength = {}
   speed = {}
   radius = {}
   senddist = {}
   treecaptcha = {}
   owner = {}
   seeds = {}
   x = {}
   y = {}
end

function RandomiseAttributes(RoidID)

   energy[RoidID] = math.random(1,10) / 10 + 0.1
   strength[RoidID] = math.random(1,10) / 10 + 0.1
   speed[RoidID] = math.random(1,10) / 10 + 0.1
   owner[RoidID] = 0
   treecaptcha[RoidID] = math.random(2,4)
   radius[RoidID] = math.random (200,600)
   senddist[RoidID] = radius[RoidID] * 10
   seeds[RoidID] = math.random(0,5)
   x[RoidID] = math.random(0,13000)
   y[RoidID] = math.random(-10000,10000)

   if radius[RoidID] > 500 then
   seeds[RoidID] = 20
   end
end


function PlaceRoid(RoidID)

   a = AddAsteroidWithAttribs(x[RoidID],y[RoidID],energy[RoidID],strength[RoidID],speed[RoidID])
   a.Owner = owner[RoidID]
   a.TreeCap = treecaptcha[RoidID]
   a:SetRadius(radius[RoidID])
   a:AddSeedlings(seeds[RoidID])
   a.SendDistance = senddist[RoidID]
   a.Moveable = true

end

function LevelLogic()

   -- Objective Msg
   Timer = GetGameTime() + 2


   while GetGameTime() < Timer do

      coroutine.yield()
   end

   Pause()
   MessageBox("Take over the whole galaxy to win. Good Luck.")
   WaitDialog()
   Unpause()

   -- Send timed Attack
   --Timer = GetGameTime() + 10


   --while GetGameTime() < Timer do

   --  coroutine.yield()
   --end
 
   --   Pause()
   --  MessageBox("Incomming")
    --  WaitDialog()
    --  Unpause()
   --   GetEmpire(1):SendSeedlingsToTarget(0,100,GetAsteroid(0))
     
     while GameRunning() do
     
      -- Win condition
      if GetEmpire(2):GetNumOwnedAsteroids() == 0 and GetEmpire(0):GetNumOwnedAsteroids() == 0 then
         Pause()
         MessageBox("You have won")
         WaitDialog()
         Unpause()
         Quit(true)
      end

      -- lose condition
      if GetEmpire(1):GetNumOwnedAsteroids() == 0 then
         Pause()
         MessageBox("You have lost")
         WaitDialog()
         Unpause()
         Quit(false)
      end
      coroutine.yield()
     end
end

and try to put it in a code box, because thoose emoticons I had to fix up :P

The map looks great BTW, I'd love to beta-test it :)

Good job, Good luck coding more :P

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Level help
« Reply #9 on: July 04, 2011, 03:53:43 AM »
What exactly did that error mean? I've never seen it before.

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Level help
« Reply #10 on: July 04, 2011, 04:05:28 AM »
I got no real idea, but seems you ended the LevelLogic and left over some code underneath it, I guess thats the error :P

kmercy

  • Seedling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 34
Re: Level help
« Reply #11 on: July 04, 2011, 04:11:47 AM »
Here:

Code: [Select]
function LevelSetup()

 
   -- Set shiz
   SetBackdropColour(0,0,0)
   SetCameraZoomNow(9)
 
   -- Set Global Values
   Globals.G.EnemyFactionsMin=(1)
   Globals.G.EnemyFactionsMax=(2)
   Globals.Asteroids.SeedlingCap=(500)
   Globals.Asteroids.SpawnCap=(2000)
 

   -- My Roid
 
   a = AddAsteroidWithAttribs(0,0, 0.8,0.8,0.8)
   a.Owner = 1
   a.TreeCap = 5
   a:SetRadius(700)
   a.SendDistance = 4000
   a:AddSeedlings(150)
   a.Moveable = false
 
   a = AddAsteroidWithAttribs(15000,0, 0.8,0.8,0.8)
   a.Owner = 2
   a.TreeCap = 5
   a:SetRadius(700)
   a.SendDistance = 4000
   a:AddSeedlings(150)
   a.Moveable = false
 
   GenerateLevel()
 
end





function GenerateLevel()

   InitArrays()
 
   for i = 2,math.random(15,40) do
      RandomiseAttributes(i)
      PlaceRoid(i)
   end
end

function InitArrays()
   energy = {}
   strength = {}
   speed = {}
   radius = {}
   senddist = {}
   treecaptcha = {}
   owner = {}
   seeds = {}
   x = {}
   y = {}
end

function RandomiseAttributes(RoidID)

   energy[RoidID] = math.random(1,10) / 10 + 0.1
   strength[RoidID] = math.random(1,10) / 10 + 0.1
   speed[RoidID] = math.random(1,10) / 10 + 0.1
   owner[RoidID] = 0
   treecaptcha[RoidID] = math.random(2,4)
   radius[RoidID] = math.random (200,600)
   senddist[RoidID] = radius[RoidID] * 10
   seeds[RoidID] = math.random(0,5)
   x[RoidID] = math.random(0,13000)
   y[RoidID] = math.random(-10000,10000)

   if radius[RoidID] > 500 then
   seeds[RoidID] = 20
   end
end


function PlaceRoid(RoidID)

   a = AddAsteroidWithAttribs(x[RoidID],y[RoidID],energy[RoidID],strength[RoidID],speed[RoidID])
   a.Owner = owner[RoidID]
   a.TreeCap = treecaptcha[RoidID]
   a:SetRadius(radius[RoidID])
   a:AddSeedlings(seeds[RoidID])
   a.SendDistance = senddist[RoidID]
   a.Moveable = true

end

function LevelLogic()

   -- Objective Msg
   Timer = GetGameTime() + 2


   while GetGameTime() < Timer do

      coroutine.yield()
   end

   Pause()
   MessageBox("Take over the whole galaxy to win. Good Luck.")
   WaitDialog()
   Unpause()

   -- Send timed Attack
   --Timer = GetGameTime() + 10


   --while GetGameTime() < Timer do

   --  coroutine.yield()
   --end
 
   --   Pause()
   --  MessageBox("Incomming")
    --  WaitDialog()
    --  Unpause()
   --   GetEmpire(1):SendSeedlingsToTarget(0,100,GetAsteroid(0))
     
     while GameRunning() do
     
      -- Win condition
      if GetEmpire(2):GetNumOwnedAsteroids() == 0 and GetEmpire(0):GetNumOwnedAsteroids() == 0 then
         Pause()
         MessageBox("You have won")
         WaitDialog()
         Unpause()
         Quit(true)
      end

      -- lose condition
      if GetEmpire(1):GetNumOwnedAsteroids() == 0 then
         Pause()
         MessageBox("You have lost")
         WaitDialog()
         Unpause()
         Quit(false)
      end
      coroutine.yield()
     end
end

and try to put it in a code box, because thoose emoticons I had to fix up :P

The map looks great BTW, I'd love to beta-test it :)

Good job, Good luck coding more :P

Thanks i prob will release it once its done or get some beta testers :D

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Level help
« Reply #12 on: July 04, 2011, 04:17:18 AM »
Actually, a 'common error messages' section to annikk's bugfixing guide could be useful. Want me to try to write one?

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Level help
« Reply #13 on: July 04, 2011, 04:23:22 AM »
Don't forget the painful Vector3f then :D

kmercy

  • Seedling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 34
Re: Level help
« Reply #14 on: July 04, 2011, 04:33:51 AM »
Yeah a common bug section is a good idea go make one ;P
« Last Edit: July 04, 2011, 07:27:54 AM by kmercy »

kmercy

  • Seedling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 34
Re: Level help
« Reply #15 on: July 04, 2011, 09:58:23 AM »
Also how can i get it to randomly generate tree numbers on asteroids cause mines always says 4 for the ones around me -.-
and also i tried making all grays attack an asteroid but failed how would i do that?
« Last Edit: July 04, 2011, 11:01:46 AM by kmercy »

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Level help
« Reply #16 on: July 04, 2011, 11:32:44 AM »
About the numbers, were you using developer mode > F12? then it means the level of the tree, you shouldn't mess around the core things of the game? :S

And about the gray, got no idea really :/

kmercy

  • Seedling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 34
Re: Level help
« Reply #17 on: July 04, 2011, 11:49:50 AM »
I mean treecap limit on each asteroid >:(

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Level help
« Reply #18 on: July 04, 2011, 11:56:10 AM »
Ok, not that angry now... Treecap limit? there is no real limit, is there?

There is no limit on the treecap, and random is just math.random(val1,val2), but it tends to create very similar numbers, the random is pseudo random, or dependtant on different variables on the computer to make a random value, this might be why you see the same behaviour :)

Try enlarge the treecap number from 2,4 to 2,20 and see if there are difference, if there is, then you have nothing wrong in the code :)

Else, we must investigate this closer, despite my depression :/

kmercy

  • Seedling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 34
Re: Level help
« Reply #19 on: July 04, 2011, 12:00:52 PM »
Gonna try set treecap on radius of it now  :o

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Level help
« Reply #20 on: July 04, 2011, 12:01:45 PM »
Remember to use math.floor or math.ceil to prevent any crashes or stuff if happening, it may tne dto create decimals...

kmercy

  • Seedling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 34
Re: Level help
« Reply #21 on: July 04, 2011, 12:09:18 PM »
Just used math.random got no crashes tryed it a few times it seems to work sometimes sometimes it 'randomly' doesn't
« Last Edit: July 04, 2011, 12:18:52 PM by kmercy »

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: Level help
« Reply #22 on: July 05, 2011, 01:22:01 AM »
Yuo could use a modified rally code to get a massive swarm to attack. Just change the empire ID and the event that triggers it.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Level help
« Reply #23 on: July 05, 2011, 06:09:23 PM »
Treecap limit? there is no real limit, is there?

He means "how do you set the tree cap for each asteroid?"

And the answer is, like this:


Code: [Select]
GetAsteroid(0).TreeCap = 5
If you want to randomise it per-asteroid, you would do something like this:

Code: [Select]
for i = 0,numberofasteroids do
GetAsteroid(i).TreeCap = math.random(1,5)
end

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Level help
« Reply #24 on: July 05, 2011, 06:25:13 PM »
Quote
i tried making all grays attack an asteroid but failed how would i do that?

If you want the greys at a specific asteroid (EG roid #3) to attack another specific asteroid (EG roid #5) here is how you do it:

Code: [Select]
GetAsteroid(3):SendSeedlingsToTarget(0,1000,GetAsteroid(5))
That will send up to 1000 seeds from 3 to 5.


If you wanted to send all the greys on all the asteroids in the level to attack one specific asteroid, EG Asteroid #3, here is how you would do that:

Code: [Select]
for i = 0,numberofasteroids do
GetAsteroid(i):SendSeedlingsToTarget(0,1000,GetAsteroid(3))
end

AWS

  • Achiever
  • Arboreal Being
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 275
Re: Level help
« Reply #25 on: July 06, 2011, 05:35:11 AM »
Actually, a 'common error messages' section to annikk's bugfixing guide could be useful. Want me to try to write one?

any news on this?

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Level help
« Reply #26 on: July 06, 2011, 05:46:12 AM »
any news on this?

Sadly, no :/

I could do it myself, though... I'm not good with explaining long stuff Dx

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Level help
« Reply #27 on: July 06, 2011, 10:12:31 AM »
Whats wrong in this code: ??

Code: [Select]
ReinforcementsAllowed = false
CommandoCenterAllowed = false

SetBackdropColour(166,146,150)

Globals.G.EnemyFactionsMin=(0)
Globals.G.EnemyFactionsMax=(0)
Globals.G.GreysProbability=0

-- Asteroid 0
a = AddAsteroidWithAttribs(-4002, -3992, 0.9,0.8,0.8)
a.Moveable = false
a.radius = 1009
a.Owner = 2
a:AddSeedlings(23)
a.SendDistance = 8394

-- Asteroid 1
a = AddAsteroidWithAttribs(-1048, -4562, 0.3,0.3,0.2)
a.Moveable = false
a.radius = 288
a.SendDistance = 2327

-- Asteroid 2
a = AddAsteroidWithAttribs(-1324, -2292, 0.2,0.3,0.3)
a.Moveable = false
a.radius = 272
a.SendDistance = 3473

-- Asteroid 3
a = AddAsteroidWithAttribs(-4707, -1426, 0.4,0.5,0.4)
a.Moveable = false
a.radius = 586
a.SendDistance = 2634

-- Asteroid 4
a = AddAsteroidWithAttribs(-7, 7, 0.6,0.6,0.5)
a.Moveable = false
a.Owner = 1
a:AddSeedlings(35)
a.radius = 301
a.SendDistance = 1802

-- Asteroid 5
a = AddAsteroidWithAttribs(-4005, 1012, 0.4,0.5,0.4)
a.Moveable = false
a.radius = 471
a.SendDistance = 2653

-- Asteroid 6
a = AddAsteroidWithAttribs(-957, 3012, 0.5,0.4,0.4)
a.Moveable = false
a.radius = 365
a.SendDistance = 4221

-- Asteroid 7
a = AddAsteroidWithAttribs(1640, 2205, 0.5,0.5,0,6)
a.Moveable = false
a.radius = 363
a.SendDistance = 2817

-- Asteroid 8
a = AddAsteroidWithAttribs(1713, -108, 0.5,0.8,0.5)
a.Moveable = false
a.radius = 384
a.SendDistance = 2487

SetFlowerDefenseButtonAvailable(false)
SetFlowerSeederButtonAvailable(false)

StartupText = "Stop n Fight"
StartupRed = 0.1
StartupGreen = 0.5
StartupBlue = 0.5
OpeningText = "We have encountered an obstacle in our race for the... Uhh, I never mentioned anything, ok! We have atleast encountered an asteroidbelt, would be nice to capture it!"
MapTime = nil
Win = "all"
AIType = "normal"
StartCondition = "Map03"
Condition = "Map03"
LostMessage = "Our enemy defeated us, try again!"
WinMessage = "They were piece of cake to conquer. Let's move on and hope we don't need to crush more enemies though!"

And yessss, lots of spoils :D

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Level help
« Reply #28 on: July 06, 2011, 05:10:18 PM »
Code: [Select]
MapTime = nil
Why is that there?  Did you mean it equals 0?

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Level help
« Reply #29 on: July 06, 2011, 09:23:27 PM »
Hmm, let me explain: You can have MapTime to nil if there is no timelimit on the map. So if it's not nil, you have a time limit. If the Win condition is "time" you win when it runs out, else you lose.

So all of the vars I made, works. But the map itself is screwing up >.<

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Level help
« Reply #30 on: July 06, 2011, 09:34:24 PM »
And I didn't detail the error message, "Invalid arguments to method call" and it reaches over the whole code I sent, no specific line were said :)

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: Level help
« Reply #31 on: July 06, 2011, 09:37:54 PM »
I'm pretty sure that error means that you are passing a variable to a function which is not of the expected type.

For example:

Code: [Select]
number = "here is some text"
GetAsteroid(number):AddSeedlings(10)


That would produce a similar error, I believe.

Basically it's impossible to tell what is wrong without seeing the whole level file.  Post the whole thing and we can help more, perhaps.  :>

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: Level help
« Reply #32 on: July 06, 2011, 10:35:34 PM »
I found it!

It was in:

-- Asteroid 7
a = AddAsteroidWithAttribs(1640, 2205, 0.5,0.5,0,6)

:D