0 Members and 1 Guest are viewing this topic.

#### w4tc

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

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

Quote
--[[    -- Asteroid ring one:
Contains asteroid 0-9    ]]--

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

-- Asteroid ring two: asteroid 10-19

-- Asteroid ring three: asteroid 10-19

#### Alex

• Ent
• Thank You
• -Given: 3
• Posts: 1,035
##### Re: A question about Asteroid rings
« Reply #1 on: January 07, 2010, 11:32:23 AM »
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    ]]--

-- Asteroid ring two: asteroid 5-6

-- Asteroid ring three: asteroid 7-8

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
end

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

#### w4tc

• Achiever
• Shrub
• Thank You
• -Given: 0
• Posts: 170
##### Re: A question about Asteroid rings
« Reply #2 on: January 08, 2010, 12: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 18, 2010, 04:33:39 PM by w4tc »

#### Alex

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

#### w4tc

• Achiever
• Shrub
• Thank You
• -Given: 0
• Posts: 170
##### Re: A question about Asteroid rings
« Reply #4 on: January 08, 2010, 03: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

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.SizeFromEnergy=170
Globals.Asteroids.SizeFromStrength=170
Globals.Asteroids.SizeFromSpeed=170
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    ]]--

-- Asteroid ring two: asteroid 5-6

-- Asteroid ring three: asteroid 7-8

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()