-
Notifications
You must be signed in to change notification settings - Fork 0
Script API
rmx edited this page May 30, 2016
·
1 revision
A list of API calls that we want to provide for user scripts. Written in functional style, although we might use OO style for the implementation.
- unitGetPosition: (unit) -> position
- returns the terrain position of a unit
- unitTeleportTo: (unit, position) ->
- instantly teleports the unit to the given position
- unitMoveToward: (unit, position) ->
- starts moving straight towards the given position
- unitMoveAlongPath: (unit, path) ->
- starts moving along the given path
- unitSetSpeed: (unit, speed) ->
- changes the movement speed of the unit
- terrainCreate: (name, tag) ->
- loads the given terrain
- terrainFindPath: (position, position) -> path
- finds a path (list of waypoints) between the two positions
- terrainGetPositionByName: (tag, name) -> position
- returns a bookmarked position
- terrainGetPositionAt: (tag, x, y, z) -> position
- returns a terrain position at the given world coordinates
- terrainGetTileByIndex: (tag, index) -> tile
- returns a terrain tile by index
- terrainPositionGetTile: (position) -> tile
- returns the tile this position is located in
- terrainPositionGetTerrain: (position) -> tag
- returns the terrain this position is located in
- terrainTileGetPosition: (tile, u, v) ->
- returns a terrain position from local tile coordinates
- worldGetUnits: () -> [unit]
- returns a list of all units
- worldCreateUnit: (model, name, behavior, position) -> unit
- creates a new unit in the encounter
- worldDeleteUnit: (unit) ->
- deletes a unit from the encounter
- gameDidStart: () ->
- starts the game (everything before this event counts as the preparation phase)
- gameDidEnd: (victory) ->
- ends the game, with the given outcome
- unitTriggerCooldown: (unit, cooldownName, cooldown) ->
- triggers a cooldown
- unitStartCast: (unit, spellName) ->
- starts casting a spell
- unitChangeAttributeBy: (unit, attribName, delta) ->
- changes an attribute (relative change)
- unitSetAttribute: (unit, attribName, value) ->
- changes an attribute (absolute change)