The problem is that there is no way to select seedlings for scripting. There is no GetAsteroid(0):GetSeedlings(faction,number) command. There is no GetSeedlings(faction,number,X1,Y1,X2,Y2). This means that currently we are limited to changing the speed of asteroid properties only, which completely does not work for a timebending effect.
I'm not sure how useful the following is, you're welcome to play around with it.
This will give you a table of seedlings at Asteroid(n).
b = GetAsteroid(n):Seedlings(playernumber)
If you want a specific seedling you can use...
b = GetAsteroid(n):Seedlings(playernumber)[0]
Likewise, the same applies to flowers and mines. Probably better to use than the random function.
b = GetAsteroid(n):Flowers()
b = GetAsteroid(n):Mines()
I'm not sure how to refresh/update seedling changes. If it's possible to do, then a timebending map would be quite easily. Although the effects would have to be localised, otherwise the code would run a tad slow.
A way to differentiate between seedlings of different qualities when referring to them in scripts. For example, it would be nifty if you could instruct seeds with a high speed stat/best overall stats/etc to travel somewhere, instead of just "seeds in general".
There are two functions that might be able to do this.
GetAsteroid(n):GetSeedlingsWithAttrib(num,EmpireID)
GetAsteroid(n):GetNumSeedlingsWithAttrib(num,EmpireID)
I've not figured out what the first number does quite yet. I think these are probably used when you double click planets to send stronger seedlings. I think these are the corresponding globals... someone should have a play around with it, to see if they can figure it out.
Globals.Agents.SendThresholdStrength = 0.6
Globals.Agents.SendThresholdEnergy = 0.6
Globals.Agents.SendThresholdSpeed = 0.6
If I had to pick one thing I want implemented into LUA, I'd say that the code for telling what an empire's colour scheme is would suffice. All you would need is the line
GetEmpire(ID).GetEmpireColour(red,green,blue)
I figured out a way of doing this the other day, when the colour settings on my lastest map didn't work.
Here's an example map. Keep in mind that the function used, requires an actual leaf to function. So if you are using it to draw, you'll have to put a one second delay into the LevelDraw function. The two couroutine.yields are at the start of the code to give the tree's time to spawn leaves as well.
function LevelSetup()
Globals.G.Asteroids = (0)
Globals.G.EnemyFactionsMin = (0)
Globals.G.EnemyFactionsMax = (0)
Globals.G.MinAsteroidSeparation = (0)
Globals.G.MaxAsteroidNeighbourDist = (20000)
Globals.G.GreysProbability = (0)
Globals.Asteroids.MinSendDistance = (12000)
Globals.Asteroids.MaxSendDistance = (12000)
a= AddAsteroidWithAttribs(0,0,1,1,1)
a.Owner = 1
for n=1,4 do
s = a:AddDysonTree()
s:LevelUp()
s:LevelUp()
s:LevelUp()
end
a:Reveal(1)
a:AddSeedlings(40)
end
function LevelDraw()
if GetGameTime() > 1 then
for n=0,(GetNumAsteroids()-1) do
if GetAsteroid(n).Owner == 1 then
x, y, r = GetAsteroid(n).position.x, GetAsteroid(n).position.y, GetAsteroid(n).Radius
DrawSprite(5, x,y, playercolour.r,playercolour.g,playercolour.b,0.99, r * 1.15)
end
end
end
end
function LevelLogic()
coroutine.yield()
coroutine.yield()
playercolour = GetAsteroid(0):GetRandomTree():GetLeafColour(0)
Display = 1
while GameRunning() do
coroutine.yield()
end
end