Eufloria > Eufloria Classic Mods

Lua scripting in Eufloria - reference

(1/13) > >>

Alex:
Thread for lua script command reference

Currently existing commands

Function prototypereturn typeDescriptionGameRunning()boolreturns true if the game is still runningAddAsteroid(x, y)AsteroidAdds an asteroid to the game at the given coordinates during setup.AddAsteroidWithAttribs(x, y, energy, strength, speed)AsteroidAdds an asteroid with the given attributes at the given x,y location, during setup.GetAsteroid(id)AsteroidGet a specific asteroid. Asteroid ID starts at zero and goes up by one with each asteroid created. All of the GetAsteroid functions may return nil if you pass in an invalid ID, so ideally you will check the return value if you are at all uncertain.GetRandomAsteroid()AsteroidGet any asteroid in the current game, at random.GetRandomRangeAsteroid(start, end)AsteroidGet a random asteroid from the given range of IDs (start is inclusive, end is exclusive, so e.g. a range of (4, 10) would select a random asteroid from the asteroids with IDs of 4, 5, 6, 7, 8, and 9)GetRandomEmptyAsteroid()AsteroidGet a random asteroid in the game that is empty (that is, it has no trees or seedlings on it and is owned by the grey team)GetRandomRangeEmptyAsteroid(start, end)AsteroidGet an empty asteroid from the given range of asteroid IDs.GetGameTime()numberReturns a real number in seconds showing the time the current game has been running.MessageBox(string message)nilPops up a message box with an OK button and the given message.AddAsteroidRing(int numAsteroids, float x, float y, float centreRadius, float beltWidth)nilAdds an asteroid ring containing numAsteroids asteroids, centred around coordinates (x, y), with radius centreRadius, and spreading asteroids out over a ring thickness of beltWidth game units.GetDialogActive()boolreturns whether there is an active dialog on the screen (from MessageBox).Pause()nilPauses the game (without popping up the pause menu).Unpause()nilUnpauses the game (without removing the pause menu if it is active)GetNumInactiveFactionsnumberReturns the number of currently inactive factions.GetFirstInactiveFactionIDnumberReturns the number of the first faction number which is 'dead', i.e. has no asteroids.GetRandomInactiveFactionIDnumberGets a random dead faction and returns its id number.Quit(bool win)nilStops the game and returns to the main menu. Set the parameter to true if the game was won, false if not.GetEmpire(int faction)EmpireGets the empire with the given ID.GetAI(int faction)AI or nilGets the AI with the given ID. can return nil, e.g. if you ask for team 1 (the player) the function will return nil as the player has no AI.SetBackdropColor / SetBackdropColournilSet the level colour (r, g, b values from 0 - 255)SetVignetteAlphanilSet the darkness of the vignette (value from 0 - 255)printnilSetDysonTreeButtonAvailable(bool available)nilSets the availability of this button.SetDefenseTreeButtonAvailable(bool available)nilSets the availability of this button.SetFlowerDefenseButtonAvailable(bool available)nilSets the availability of this button.SetFlowerSeederButtonAvailable(bool available)nilSets the availability of this button.SetTreeInfoAvailable(bool available)nilSets the availability of this information on the info panel.SetEnemyInfoAvailable(bool available)nilSets the availability of this information on the info panel.SetCoreInfoAvailable(bool available)nilSets the availability of this information on the info panel.SetAttribsInfoAvailable(bool available)nilSets the availability of this information on the info panel.SetCameraPosition(float x, float y)nilSets the camera's position, without causing it to smoothly transition.SetCameraTarget(float x, float y)nilSets the camera target, causing it to smoothly move from the current location to the new target.SetCameraPositionToAsteroidID(int id)nilSets the camera's position to that of the given asteroid's ID, without causing it to smoothly transition. Will do nothing if the asteroid does not exist.SetCameraTargetToAsteroidID(int id)nilSets the camera target position to that of the given asteroid's ID, causing it to smoothly move from the current location to the new target.SetCameraZoom(float zoom)nilSets the camera zoom. The camera will smoothly zoom to the given value.SetCameraZoomNow(float zoom)nilSets the camera zoom bypassing any smooth transition.GetNumFactionsintHow many factions are there? This one will tell you.UnlockArenaLevel(int level)voidUnlock an arena level (pass in 1 to unlock the first arena, 2 for the second etc)DrawLine(x1,y1,x2,y2,r1,g1,b1,a1,r2,g2,b2,a2,thickness)void(all parameters floating point) Draws a line from (x1,y1) to (x2,y2) with starting colour (r1,g1,b1,a1) and ending colour (r2,g2,b2,a2) where colour values are from 0 to 1. use alpha <1 (e.g. 0.99) rather than 1 in general.DrawTexLine(int id, x1,y1,x2,y2,r1,g1,b1,a1,r2,g2,b2,a2,thickness)voidAs for DrawLine except applies a texture (see below for id indexes)DrawSprite(int id, x,y, r,g,b,a, size)voidDraws sprite of size size and index id at (x,y) in colour (r,g,b,a). IsOnScreen(x,y, radius)boolreturns true if the object at x,y with radius radius would be on the screen at the time of drawing. GetLODAlpha(int LOD)floatreturns the alpha of the given LOD (0,1,2). LOD 2 is the most zoomed-in; LOD 0 is the farthest zoomed-out.GetCameraScale()floatreturns the current scale of the camera. Divide a value by this to get a size in pixels on-screen to pass to draw functions.SaveStats(string filename)e.g. SaveStats("myfile.bin") - saves out the current game stats to the given fileLoadStats(string filename)e.g. LoadStats("myfile.bin") - loads myfile.bin into the current stats registerGetCameraX()floatGet camera's x positionGetCameraY()floatGet camera's y positionGetCameraZoom()floatGets the camera zoom - warning this value is different from the value passed in from SetCameraZoom for arcane and ridiculous reasons... the formula is (0.05f + ((float)(Zoom * Zoom * Math.Sign(Zoom)) / 10)) where Zoom is the value you passed in

Alex:
All accessible from lua. They are floats or ints. Try not to put floating point numbers into int vars... I have put the type after the var name.

Camera vars
Globals.Camera.ViewSupplement (float)

Flower vars
Globals.Flowers.GrowTime (float)
Globals.Flowers.MinSpeed (float)
Globals.Flowers.MaxSpeed (float)
Globals.Flowers.SpeedPower (float)
Globals.Flowers.MinHealth (int)
Globals.Flowers.MaxHealth (int)
Globals.Flowers.HealthPower (float)
Globals.Flowers.Available (int) - sets whether or not flowers will grow (0 = won't grow, anything else = will grow)

Mine vars
Globals.Mines.GrowTime (float)
Globals.Mines.MinSpeed (float)
Globals.Mines.MaxSpeed (float)
Globals.Mines.SpeedPower (float)
Globals.Mines.MinHealth (int)
Globals.Mines.MaxHealth (int)
Globals.Mines.HealthPower (float)
Globals.Mines.NumberOfLasers (int)
Globals.Mines.LaserPowerMin (float)
Globals.Mines.LaserPowerMax (float)
Globals.Mines.LaserPowerRule (float)
Globals.Mines.ExplosionPowerMin (float)
Globals.Mines.ExplosionPowerMax (float)
Globals.Mines.ExplosionPowerRule (float)
Globals.Mines.ExplosionRadiusMin   (float)
Globals.Mines.ExplosionRadiusMax (float)
Globals.Mines.ExplosionRadiusPower  (float)
Globals.Mines.LaserRange  (float)

Missile vars
Globals.Missiles.AmmoAvailable1 (int)
Globals.Missiles.AmmoAvailable2  (int)
Globals.Missiles.AmmoAvailable3  (int)
Globals.Missiles.AmmoAvailable4  (int)
Globals.Missiles.DamageMin  (float)
Globals.Missiles.DamageMax (float)
Globals.Missiles.DamagePowerRule (float)
Globals.Missiles.RadiusMin  (float)
Globals.Missiles.RadiusMax (float)
Globals.Missiles.RadiusPowerRule (float)
Globals.Missiles.SpeedMin  (float)
Globals.Missiles.SpeedMax (float)
Globals.Missiles.SpeedPowerRule  (float)
Globals.Missiles.TriggerDistance  (float)
Globals.Missiles.ReloadMin (float)
Globals.Missiles.ReloadMax (float)
Globals.Missiles.ReloadPowerRule (float)
Globals.Missiles.TurnRate  (float)
Globals.Missiles.LaunchDuration (float)
Globals.Missiles.CheckTimer  (float)

Seedling vars
Globals.Agents.MaxSpeed   (float)
Globals.Agents.MinSpeed  (float)
Globals.Agents.SpeedPower  (float)
Globals.Agents.WanderAttackTime  (float)
Globals.Agents.AttackRepeatTime  (float)
Globals.Agents.MinDamage  (float)
Globals.Agents.MaxDamage (float)
Globals.Agents.DamagePower (float)
Globals.Agents.MinAltitude  (float)
Globals.Agents.MaxAltitude (float)
Globals.Agents.AttackDist   (float)
Globals.Agents.BomVolume  (int)
Globals.Agents.MinHealth  (int)
Globals.Agents.MaxHealth (int)
Globals.Agents.HealthPower  (float)
Globals.Agents.RegenRate (float)
Globals.Agents.NoseLengthMin  (float)
Globals.Agents.NoseLengthMax (float)
Globals.Agents.TurnRate (float)
Globals.Agents.AttackTravellerMultiplier (float)
Globals.Agents.AttackAgentDistanceSuper (float)
Globals.Agents.AttackRepeatTimeSuper (float)
Globals.Agents.SendThresholdEnergy (float)
Globals.Agents.SendThresholdStrength (float)
Globals.Agents.SendThresholdSpeed (float)

Asteroid vars
Globals.Asteroids.MaxVolume (int)
Globals.Asteroids.TakeoverVolume (int)
Globals.Asteroids.MaxTrees (int)
Globals.Asteroids.MinRadius (float)
Globals.Asteroids.MaxRadius (float)
Globals.Asteroids.RadiusPowerRule (float)
Globals.Asteroids.SizeFromEnergy (float)
Globals.Asteroids.SizeFromStrength (float)
Globals.Asteroids.SizeFromSpeed (float)
Globals.Asteroids.AttributeMinimum (float)
Globals.Asteroids.AttributeDivisions (int)
Globals.Asteroids.SendVolume (int)
Globals.Asteroids.AsteroidSelectRadius (int)
Globals.Asteroids.MinSendDistance (float)
Globals.Asteroids.MaxSendDistance (float)
Globals.Asteroids.SendPowerRule (float)
Globals.Asteroids.MinCoreHealth (float)
Globals.Asteroids.MaxCoreHealth (float)
Globals.Asteroids.CoreHealthPower (float)
Globals.Asteroids.SeedlingCap  (int)
Globals.Asteroids.SpawnCap (int)

Dyson tree vars
Globals.Structures.TreeCost  (int)
Globals.Structures.MinHealth  (float)
Globals.Structures.MaxHealth  (float)
Globals.Structures.HealthPower  (float)
Globals.Structures.RegenRate  (float)
Globals.Structures.LevelTime1 (float)
Globals.Structures.LevelTime2  (float)
Globals.Structures.LevelTime3 (float)
Globals.Structures.LevelTime4  (float)
Globals.Structures.SpawnTime1 (float)
Globals.Structures.SpawnTime2 (float)
Globals.Structures.SpawnTime3 (float)
Globals.Structures.SpawnTime4 (float)
Globals.Structures.SoundVolume (float)
Globals.Structures.MinSoundTime (float)
Globals.Structures.MaxSoundTime (float)
Globals.Structures.MaxDamage   (float)
Globals.Structures.MinDamage  (float)
Globals.Structures.DamagePower  (float)
Globals.Structures.FlowerProbability (float)
Globals.Structures.RootSpeed (float) - affects all roots in the game

Defense tree vars
Globals.StructuresDefense.TreeCost (int)
Globals.StructuresDefense.MinHealth (float)
Globals.StructuresDefense.MaxHealth (float)
Globals.StructuresDefense.HealthPower (float)
Globals.StructuresDefense.RegenRate (float)
Globals.StructuresDefense.LevelTime1  (float)
Globals.StructuresDefense.LevelTime2  (float)
Globals.StructuresDefense.LevelTime3  (float)
Globals.StructuresDefense.LevelTime4  (float)
Globals.StructuresDefense.SpawnTime1  (float)
Globals.StructuresDefense.SpawnTime2  (float)
Globals.StructuresDefense.SpawnTime3  (float)
Globals.StructuresDefense.SpawnTime4  (float)
Globals.StructuresDefense.MaxDamage (float)
Globals.StructuresDefense.MinDamage (float)
Globals.StructuresDefense.DamagePower (float)

AI stuff
Globals.AI.MinDecisionTime (float)
Globals.AI.MaxDecisionTime (float)
Globals.AI.GraceTimer (int)

Program vars - try not to change these yourself :)
Globals.P.ToolTipWait (float)
Globals.P.ToolTipWaitUI (float)
Globals.P.AutoHide (int)
Globals.P.FullScreen (int)
Globals.P.SeenHelp (int)
Globals.P.FontSize (float)
Globals.P.BGFade (float)
Globals.P.PlayerColour  (int)

Game vars
Globals.G.EnemyFactionsMin (int)
Globals.G.EnemyFactionsMax (int)
Globals.G.BeltRadius (int)
Globals.G.BeltWidth  (int)
Globals.G.Asteroids  (int)
Globals.G.MinAsteroidSeparation (int)
Globals.G.StartingSeedlings (int)
Globals.G.StartingSeedlingsPlayer  (int)
Globals.G.MaxAsteroidNeighbourDist (int)
Globals.G.GreysProbability (float)
Globals.G.GreysMin (int)
Globals.G.GreysMax (int)

Alex:
function LevelSetup()
Called once at the start of the game - use it to set up asteroids and stuff.
Example:
(click to show/hide)
--- Code: ---function LevelSetup()

SetBackdropColour(237,220,198)

    Globals.Asteroids.MaxTrees=0
    Globals.Asteroids.MinRadius=85
    Globals.Asteroids.MaxRadius=800
    Globals.Asteroids.RadiusPowerRule=1.5
    Globals.Asteroids.MinSendDistance=2500
    Globals.Asteroids.MaxSendDistance=4000
    Globals.Asteroids.SendPowerRule=2.5
Globals.G.MinAsteroidSeparation = 500

AddAsteroidRing(4, 0, 0, 900, 150)

a = GetAsteroid(0)
a.Owner = 1
a:AddSeedlings(4)

a = GetAsteroid(1)
a.Owner = 0
a:AddSeedlings(4)
a:Reveal(1)

a = GetAsteroid(2)
a.Owner = 1
a:AddSeedlings(4)
a:Hide(1)

a = GetAsteroid(3)
a.Owner = 1
a:AddSeedlings(4)
a:Hide(1)

end
--- End code ---

function LevelLogic()
Called as a coroutine. Put in while loops with coroutine.yield() in them to hold up your script.
Example:
(click to show/hide)
--- Code: ---function LevelLogic()

Pause()
MessageBox("Starting message\n\nThis message pops up before the level begins.")
WaitDialog()
Unpause()

player = GetEmpire(1)

while player.NumSeedlings <= 15 do

coroutine.yield()
end

Pause()
MessageBox("Ending message\n\nYou totally won the level.\n\nGo you.")
WaitDialog()
Unpause()

Quit()
end
--- End code ---

function LevelDraw()
Optional. Called every time the game draws to the screen. Fill it with your lovely drawing code. Check the script examples thread for an example.

function OnAsteroidTaken(id, owner)
This is optional but if defined will be called whenever an asteroid changes hands. Use it to check for specific asteroids being taken over by specific teams, or whatever you like.
(click to show/hide)
--- Code: ---function OnAsteroidTaken(id, owner)
if id == 1 then MessageBox("Asteroid "..id.." was taken by faction "..owner..".") end
end
--- End code ---


function OnAsteroidRevealed(id, owner)
This is optional but if defined will be called whenever an asteroid is revealed to an owner. So when you discover an asteroid, this will be called with the id of the asteroid and owner 1, for example.
(click to show/hide)
--- Code: ---function OnAsteroidRevealed(id, owner)
if id == 1 then MessageBox("Asteroid "..id.." was discovered by faction "..owner..".") end
end
--- End code ---

Alex:
Let's say you have an Asteroid called a. To call functions on a, you use the colon like so

--- Code: ---a:AddTrees(1,2)
--- End code ---
and to set fields you use the dot like so

--- Code: ---a.Owner = 3
--- End code ---

These are the most important functions and fields available to you as a scripter (there are tons more but listing them all would take ages and confuse people):

Asteroids
Function nameReturn valueDescriptionMoveBy(float, float)nilMoves the asteroid by the given offset.MoveTo(float, float)nilMoves the asteroid to the given position.GetNumSeedlings()intCounts the number of seedlings present at the asteroid.GetNumSeedlings(int faction)intCounts the number of seedlings present at the asteroid belonging to the given faction/empire.GetNumSeedlingsExcluding(int faction)intCounts the number of seedlings present at the asteroid, excluding seedlings from the given faction.GetNumFlowers(int faction)intCounts the number of flowers present at the asteroid belonging to the given faction/empire.GetNumMines(int faction)intCounts the number of mines present at the asteroid belonging to the given faction/empire.GetFlower(int faction)FlowerGets one of the flowers of the given faction present on the asteroid. Will return nil if there are none available.GetMine(int faction)MineGets one of the mines of the given faction present on the asteroid. Will return nil if there are none available.GetNumTrees()intCounts the number of trees present at the asteroid.GetNumDysonTrees()intCounts the number of these trees present at the asteroid.GetNumDefenseTrees()intCounts the number of these trees present at the asteroid.FreeSlots()intReturns how many places for trees are left here.AvailableStructureSpace()boolTells you if there is space for any trees here.SetRadius(float radius)nilSet the radius of the asteroid. Probably best not to call this after level setup.SendSeedlingsToTarget(int faction, int number, Asteroid asteroid)intAttempt to send number seedlings from faction faction to asteroid asteroid.CanAddSeedling(int faction)boolCheck to see if faction faction can add any seedlings to this asteroid.CanSpawnSeedling(int faction)boolCheck to see if faction faction can spawn any seedlings on this asteroid.AddDysonTree()StructureAttempt to add a Dyson tree to the asteroid; if nothing can be done (all tree slots are taken) the function does nothing and returns nil. Otherwise the function returns a Structure, which is the base type of the trees in Dyson.AddDefenseTree()StructureSee above.PlantDysonTree(int faction)StructureAttempt to plant a Dyson tree using the seedlings present at the asteroid; if nothing can be done (all tree slots are taken, or there are not enough seedlings or the asteroi is owned by some other faction than team 0 or the given faction) the function does nothing and returns nil. Otherwise the function returns a Structure, which is the base type of the trees in Dyson.PlantDefenseTree(int faction)StructureSee above.ChangeOwner(int faction)nilInstantly transfers ownership of the asteroid to the given team.GetSendDistance()floatInstantly transfers ownership of the asteroid to the given team.IsBarren()boolInforms of the asteroid's barren status (barren is when team 0 (the greys) is the owner and there are no trees).AddSeedlings(int numberToAdd)nilAdds numberToAdd seedlings to the asteroid of the current asteroid owner's team.AddSuperSeedlings(int numberToAdd)nilAdds numberToAdd enhanced seedlings to the asteroid of the current asteroid owner's team.AddSeedlings(int numberToAdd, int faction, float energy, float strength, float speed)nilAdds numberToAdd seedlings to the asteroid of the given team and with the given attributes.AddSuperSeedlings(int numberToAdd, int faction, float energy, float strength, float speed)nilAdds numberToAdd enhanced seedlings to the asteroid of the given team and with the given attributes.RemoveSeedlings(int faction, int numberToRemove)nilRemoves numberToAdd seedlings at random from the asteroid of the given owner's team.AddFlower()FlowerAdds a flower of the asteroid's owners type to the asteroid. May return nil if there are too many flowers in the game.AddFlower(int faction)FlowerAdds a flower of the given faction type to the asteroid.AddMine()MineAdds a mine of the asteroid's owners type to the asteroid. May return nil if there are too many mines in the game.AddMine(int faction)MineAdds a mine of the given faction type to the asteroid.AddTrees(int dyson, int defense)nilAdd the given number of trees to the asteroid.SetGraceTime(float gracetime)nilSets the grace time for the current owner of the asteroid - stops the owner's AI from doing anything with the asteroid while the grace timer is still above 0.SetFlowerProbability(float probability)nilOverride the probability (0 = no chance -> 1 = guaranteed) of flowers being grown on trees planted on this asteroid. Will also affect any trees currently planted here - if they are currently not going to grow a flower (as this is decided when they are created), they will "roll the die" again to see if they will grow a flower.GetRandomDefenseTree() and
GetRandomDefenseTree(bool ignoreEnhance) Structure or nilThis gets a random defense tree. If you send in false as the parameter, it will choose a tree without a flower already planted on it. If no tree is suitable the function returns nil.GetRandomDysonTree() and
GetRandomDysonTree(bool ignoreEnhance) Structure or nilThis gets a random dyson tree. If you send in false as the parameter, it will choose a tree without a flower already planted on it. If no tree is suitable the function returns nil.GetRandomTree() and
GetRandomTree(bool ignoreEnhance) Structure or nilThis gets a random tree. If you send in false as the parameter, it will choose a tree without a flower already planted on it. If no tree is suitable the function returns nil.Field nameTypeDescriptionIDintThe ID of the asteroid, corresponding to when it was created in the level setup. Do not edit this value unless you want trouble.MoveableboolCan the game move the asteroid around during setup to make sure it isn't too close / far away from other asteroids? This field will have no effect after level setup.NamestringThe name of the asteroid. You can name your asteroids if you like.SeedlingCapintSet the maximum number of seedlings allowed on an asteroid.SpawnCapintSet the number of seedlings at an asteroid before Dyson trees stop producing seedlings.TreeCapintSet the maximum number of trees allowed on an asteroid.CoreHealthintSet the asteroid's core health.MaxCoreHealthintSet the asteroid's maximum core health.SendDistancefloatSet the asteroid's sending distance.
Trees
Function nameReturn valueDescriptionLevelUp()nilLevel the tree up. If called during setup the tree will start the game with a fully grown root and at the next level up. Call it multiple times have the tree at higher levels.SetFlowerProbability(float probability)nilOverride the probability (0 = no chance -> 1 = guaranteed) of flowers being grown on a tree. The tree will "roll the die" again to see if it will grow a flower.AddFlower()Flower/Mine or nilIf the tree is a dyson tree this will add a Flower. If the tree is a Defense tree it will add a Mine. If the tree already has a flower or mine this will return nil.Field nameTypeDescriptionEnhancedboolSets the tree to have been enhanced (to make super seedlings).
Flower/Mine
Function nameReturn valueDescriptionGrowToMax()nilThe flower will immediately grow to full age, ready to be plucked.Pluck()nilThe flower or mine will detatch itself from its tree, if it is attached.SendTo(Asteroid destination)nilAttempt to send the flower/mine to the destination asteroid.Plant(Structure tree)boolPlant the flower on the given tree, returns false if it couldn't plant.PlantOnRandomTree()boolPlant the flower on a random tree, returns false if it couldn't plant.PlantOnRandomDysonTree()boolPlant the flower on a random dyson tree, returns false if it couldn't plant.PlantOnRandomDefenseTree()boolPlant the flower on a random defense tree, returns false if it couldn't plant.Field nameTypeDescription

Empires
Function nameReturn valueDescriptionGetRandomAsteroid()Asteroid.GetNumOwnedAsteroids()intHow many asteroids the empire ownsGetNumVisibleAsteroids()intHow many asteroids the empire knows aboutOwnsAsteroidID(int id)boolreturns true if the empire currently owns asteroid with given id.Field nameTypeDescriptionNumSeedlingsint.NumTreesint.NumDysonTreesint.NumDefenseTreesint.Defeatedboolset by the game to true when the empire has been defeated.

AIs - AIs are also Empires, so you can also call/set anything in the above Empire reference on any AI you might have around. e.g. num = GetAI(3).NumSeedlings
Function nameReturn valueDescription...Field nameTypeDescriptionMinScoutTimefloatscout timer - how often will we check to scout.MaxScoutTimefloatThe timer is set to a random value between the min and max values.MinScoutableArmyintwon't scout from asteroids with this number or fewer seedlings.MinBattleAnalysisTimefloatTime between periodic checks. When this timer runs out, an analysis of battles in progress is conducted. Various values below are then taken in to account to govern the AI's decisions depending on the battle's progression.MaxBattleAnalysisTimefloatThe timer is set to a random value between the min and max values.Cowardicefloat (0-1)chances of retreating a battle we are losing.BattleSavvyfloat (0-1)chances of picking a battle for a valuable asteroid - don't put this at 1 or the AI will only look at one asteroid at a time!RecognisableThreatProportionfloat (0-1)enemy army size relative to ours before it's considered a threat.ReinforcementGreedfloat (0-1)proportion of existing forces elsewhere to send in aid of battle.AidEnthusiasmfloat (0-1)how much to overshoot the battle rating when sending aid, to allow for inbound enemy forces, estimate errors, travel time, wanting to win, etc.MinExpansionTimefloatExpand the empire. Expansion won't happen if seedling numbers are below a certain valueMaxExpansionTimefloatThe timer is set to a random value between the min and max values.MinExpansionForceintThis should be at least the cost of a tree.ExpandToValuableAsteroidChancefloat (0-1)likelihood of choosing a more valuable asteroid to expand to.GreedyExpansionfloat (0-1)likelihood of sending all/most of the seedlings to expand.ExpandBlindfloat (0-1)likelihood of expanding to asteroids that haven't been scouted yet.MinAttackTimefloatTime between checks for vulnerable nearby asteroids that can be attacked.MaxAttackTimefloatThe timer is set to a random value between the min and max values.MinPlantTimefloatTime between checks for suitable locations for planting trees.MaxPlantTimefloatThe timer is set to a random value between the min and max values.MinFlowerTimefloatTime between checks that cause the AI to pluck, plant and send flowers.MaxFlowerTimefloatThe timer is set to a random value between the min and max values.MinGatherTimefloatTime between AI logic used to gather armies on asteroids, and send them to take over enemy asteroids too.MaxGatherTimefloatThe timer is set to a random value between the min and max values.MinTotalSeedlingsintthe minimum number of seedlings allowed in the empire. if the actual number is below this then the AI will stop expanding and planting trees.MinTotalAddPerAsteroidintadds this number on to the above minimum, per asteroid in the empire.





General game entities - these functions can be used on most anything in the game (seedlings, trees, asteroids, etc)
Function nameReturn valueDescriptionHide(int faction)nilHides the entity from the given faction.Reveal(int faction)nilReveals the entity to the given faction.IsVisible(int faction)boolTells if the entity is visible to the given faction.SetVisible(int faction, bool visible)nilSets whether the entity can be seen by the given faction.IsVisible()boolTells if the entity is visible to the game (i.e. will it render if it comes onscreen).Die()nilDeactivate the entity and do whatever else happens when it dies.SetEnergy(float energy)nilSet the energy attribute of the entity from 0.0 to 1.0SetStrength(float strength)nilSet the strength attribute of the entity from 0.0 to 1.0SetSpeed(float speed)nilSet the speed attribute of the entity from 0.0 to 1.0Regen(float time)niltells the entity to regenerate some of its energy. The parameter is delta time, so set it to e.g. 1 to regenerate a second's worth of energy. Normally this is called once a frame with the duration of the frame passed in.DistanceSquaredTo(Entity other)floatreturns the squared distance from the centre of this entity to the centre of the one you passed in.AttackedBy(Entity other)nilTells this entity that it was attacked by the one you pass in.AttackedBy(Entity other, float time)nilTells this entity that it was attacked by the one you pass in for 'time' seconds. Normally the second value is the frame duration.Field nameTypeDescriptionCurrentEnergyfloatCurrent hit points of the entity.MaxEnergyfloatMax hitpoints of the entity.PositionVector3Position of the entity - access individual coords with capital letters e.g. entity.Position.X or entity.Position.Y.Radiusfloatradius of the entity.OnScreenbooltells you whether the entity is on the screen or not.ActiveboolTells whether the entity is still active. Set it to false to remove the entity from the game.

Alex:
For reference, here are some standard Lua reference pages online:

Programming in Lua

If you are new to Lua and especiialy if you are new to scripting, at least read the Expressions and Statements sections, preferably also read the Types section, Functions, and Iterators.

Also available is the rather terse and academic official Lua reference.

Navigation

[0] Message Index

[#] Next page

Go to full version