Main top-level module. Provides access to most of the API. Available as the global variable game.
Summary
Section titled “Summary”Fields
Functions
- spawn_unit
(unit: string, position: vector, team: Team, source: Entity?) -> UnitSpawns a new unit based on the provided unit definition. […]
- spawn_projectile
(spawn: SpawnProjectile) -> UnitSpawns a new projectile based on the provided projectile definition. […]
Fields
Section titled “Fields”enums Read only
Section titled “enums Read only ”enums: Enums
See Enums
steering
Section titled “steering”steering: SteeringBehaviors
Functions
Section titled “Functions”spawn_unit
Section titled “spawn_unit”game.spawn_unit(unit: string, position: vector, team: Team, source: Entity?) -> Unit
Spawns a new unit based on the provided unit definition.
Parameters
- unit Required
stringThe path of the unit definition file.
- position Required
vectorThe position to spawn the unit at. The
zvalue will be ignored. -
The team of the unit.
-
The entity that spawned this unit.
Returns
-
The newly spawned unit.
Example
Section titled “Example”game.spawn_unit("units/skeleton.unit.ron", vector.zero, game.enums.Team.player)spawn_projectile
Section titled “spawn_projectile”game.spawn_projectile(spawn: SpawnProjectile) -> Unit
Spawns a new projectile based on the provided projectile definition.
Parameters
{ projectile: string, position: vector } & ({ direction: vector } | { target: Unit }) & { team: Team, source: Entity? }
A table with the following fields:
- projectile Required
stringThe path of the projectile definition file.
- position Required
vectorThe absolute position to spawn the projectile at. The
zvalue will be ignored. - Either:
- direction Required
vectorThe direction vector of the projectile. Will be normalized.
-
The target of the projectile.
-
-
The team the projectile will belong to. Used for projectile abilities that find targets, and for projectiles that have collision filters.
-
The entity that spawned this projectile.
Returns
-
The newly spawned projectile.
Example
Section titled “Example”game.spawn_projectile({ projectile = "projectiles/fireball.projectile.ron", position = unit.position, direction = vector.create(1, 0)})