Author Topic: A question about Asteroid rings  (Read 5699 times)

w4tc

  • Achiever
  • Shrub
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 170
A question about Asteroid rings
« on: January 07, 2010, 03:53:33 AM »
This night I was trying to make a lvl :D

but I want every enemy or AI on an asteroid
can someone explain me how?

Quote
   --[[    -- Asteroid ring one:
   Contains asteroid 0-9    ]]--
   AddAsteroidRing(5, -4200, 1200, 100, 25000)
   
   -- Asteroid 0: This one given to the player and has 50 seedlings
   a = GetAsteroid(1)
   a.Owner = 1
   a:AddTrees(90,10)
   a:AddSuperSeedlings(300)
   a.Moveable = true

   
   -- Asteroid ring two: asteroid 10-19   
   AddAsteroidRing(2, 4200, -1200, 100, 2500)
   
   -- Asteroid ring three: asteroid 10-19   
   AddAsteroidRing(2, 8200, -1200, 100, 2500)

Alex

  • Administrator
  • Ent
  • *****
  • Thank You
  • -Given: 3
  • -Receive: 14
  • Posts: 1,035
Re: A question about Asteroid rings
« Reply #1 on: January 07, 2010, 07:32:23 PM »
something like (i haven't tested this or written lua in ages so please fix as appropriate)

Code: [Select]
   --[[    -- Asteroid ring one:
   Contains asteroid 0-4    ]]--
   AddAsteroidRing(5, -4200, 1200, 100, 25000)
 
   -- Asteroid ring two: asteroid 5-6   
   AddAsteroidRing(2, 4200, -1200, 100, 2500)
   
   -- Asteroid ring three: asteroid 7-8   
   AddAsteroidRing(2, 8200, -1200, 100, 2500)
 
   for i=1,8,1 do -- where 8 is the number of asteroid you created, and asteroid 0 is the player's
      faction = math.random(10) -- get a random fatcion - 10 is just an example, use however many factions you put in the setup
      if faction == 1 then faction = 0 end --don't include the player
      a = GetAsteroid(i)
      a.Owner = faction
      a:AddTrees(1,1)
      a:AddSeedlings(300)
   end

   -- Asteroid 0: This one given to the player and has 50 seedlings
   a = GetAsteroid(0)
   a.Owner = 1
   a:AddTrees(1,1)
   a:AddSuperSeedlings(300)
   a.Moveable = true

   

w4tc

  • Achiever
  • Shrub
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 170
Re: A question about Asteroid rings
« Reply #2 on: January 08, 2010, 08:37:11 AM »
Whaha, that's no problem

Hmmm
Sometimes he does it, but then he do not

So i have make screenshot of it : http://i100.photobucket.com/albums/m16/Warp_ie/kopie39vanKopievanB.jpg

1 in 3
1° is my script
2° what it should be. I was lucky
3° So i start the lvl new and i was not good xD

Edit : edit the link on 18/06/2010 17:22h
« Last Edit: June 19, 2010, 12:33:39 AM by w4tc »

Alex

  • Administrator
  • Ent
  • *****
  • Thank You
  • -Given: 3
  • -Receive: 14
  • Posts: 1,035
Re: A question about Asteroid rings
« Reply #3 on: January 08, 2010, 10:45:50 PM »
Post up the full script and I may have time to take a look :)

w4tc

  • Achiever
  • Shrub
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 170
Re: A question about Asteroid rings
« Reply #4 on: January 08, 2010, 11:22:09 PM »
Thx Alex

Here is the script, and take your time :)
I set it  : for i=1,8,0 do , the player on 0 becaus I don't like the Gray xD

And ready and GO :
Quote
function LevelSetup()


   SetBackdropColour(5,0,0)
   
   Globals.G.EnemyFactionsMin=2
   Globals.G.EnemyFactionsMax=2
   Globals.G.MinAsteroidSeparation=100
   Globals.G.MaxAsteroidNeighbourDist=10000
   Globals.G.GreysProbability=0
   Globals.G.StartingSeedlings=40
   
    Globals.Asteroids.MaxTrees=5
    Globals.Asteroids.MinRadius=110
    Globals.Asteroids.MaxRadius=620
   Globals.Asteroids.SizeFromEnergy=170
   Globals.Asteroids.SizeFromStrength=170
   Globals.Asteroids.SizeFromSpeed=170
    Globals.Asteroids.RadiusPowerRule=1.2
    Globals.Asteroids.MinSendDistance=3000
    Globals.Asteroids.MaxSendDistance=6000
    Globals.Asteroids.SendPowerRule=2.0
   
   
   Globals.Ai.GraceTimer=5
   
   Globals.Agents.MinDamage=40
   
   Globals.Missiles.DamageMin=40



   --[[    -- Asteroid ring one:
   Contains asteroid 0-4    ]]--
   AddAsteroidRing(5, -4200, 1200, 100, 25000)
      
   -- Asteroid ring two: asteroid 5-6   
   AddAsteroidRing(2, 4200, -1200, 100, 2500)
   
   -- Asteroid ring three: asteroid 7-8   
   AddAsteroidRing(2, 8200, -1200, 100, 2500)
 

   for i=1,8,0 do                         -- where 8 is the number of asteroid you created, and asteroid 0 is the player's
      faction = math.random(3)                -- get a random fatcion - 10 is just an example, use however many factions you put in the setup
      if faction == 1 then faction = 0 end       -- don't include the player
      a = GetAsteroid(i)
      a.Owner = faction

   end

   SetCameraPositionToAsteroidID(20)
   SetCameraZoomNow(30000)      
   
end

function LevelLogic()

   Pause()
   MessageBox("kollo")
   WaitDialog()
   Unpause()

   while GameRunning() do
   

   
      coroutine.yield()
   end
   
end

      if win == 1 then
         Pause()
         MessageBox("You Have Conquered Your Nemesis.")
         WaitDialog()
         Unpause()
         Quit(true)
      end