This module contains Sulis' scripting API. Most structs are inserted into lua scripts as objects. The documentation for each struct describes the available functions on each object when interacting with them within a lua script.
There are currently four kinds of scripts:
- AI Scripts: These are attached to a given actor in their resource definition under
ai. Whenever the parent entity is active, the
ai_action(parent, state)method is called.
- Area / Trigger Scripts: These are called by triggers, conversations, and cutscenes.
Named script functions are called, via a
fire_scripttype containing an
idfor the script and a
- Ability Scripts: These are called when activating an ability or when an active ability
meets certain conditions. The entry point for the script is
on_activate(parent, ability). When using a targeter,
on_target_select(parent, ability, targets)is the return from that targeter.
- Item Scripts: Similar to ability scripts, but called when using an item. The entry point is
Since standard Lua methods for referencing other script files will not work, Sulis includes a simple facility to include the contents of a script into another script. This is done with a line in the target script: --INCLUDE <other_script_id> The entire contents of the referenced script will be placed into the script file in place of the --INCLUDE directive at evaluation time. --INCLUDE directives are only evaluated one level deep at this time.
A created AreaTargeter, built from a
A data structure representing all data that will be
transfered from this module to the specified subsequent module.
This is created with
Script Helper module for easily calling various script methods
Represents a specific active ability. This is passed into ability
scripts in the
Represents the set of abilities that a given Entity has access to.
This will only include active abilities, not passive ones.
Represents a surface that already exists, and is being passed into a Lua script. Not used during effect creation
An already applied effect, in contrast to an effect being created
A color animation changing a parent entity's base or secondary
color. Created normally by
An effect, normally created via
Represents a single entity for Lua scripts. Also can represent an invalid,
non-existant entity in some cases. Many script functions pass a parent
which is a script entity, and often targets, which is a
Represents a set of ScriptEntities, which can be created from a variety of
sources. This is passed to many script functions as a
An animation that adds one or more ImageLayers to the parent creature for rendering. These override any racial or inventory image layers, with "empty" being used to hide an image layer on the parent. All layers are removed when the animation is complete.
The ScriptInterface, accessible in all Lua scripts as the global
The inventory of a particular creature, including equipped items and quickslots.
A ScriptItem, representing a specific item in a player or creature inventory,
quick slot, or the party stash, depending on the
A user interface menu being created by a script. Normally created
A user menu selection
A flexible animation type, which can be used to create particle effects, simple
frame based animations, or anything in between.
Typically created by
An animation that changes the size of an entity.
Normally created via
A representation of an item in the stash
A script state, containing a complete lua state.
An animation that moves the pixel precise coordinates of
an entity. Normally created via
A representation of an item that is usable and in a particular QuickSlot for a parent entity.
A kind of Item, represented by its owner (Stash, QuickSlot, or a generic item with a specified ID)