Methods
Game:addFlag(flag: string, amount: number?)
Adds amount
to a numeric flag named flag
(or defines it if it does not exist)
@param flag
— The name of the flag to add to
@param amount
— (Defaults to 1
)
Arguments:
flag: string | The name of the flag to add to |
amount: number? | (Defaults to |
Returns:
new_value: number |
Game:addFollower(chara: string|Follower, index: integer?)
Arguments:
chara: string|Follower | Followers are a type of Overworld character that follow the player's movements. |
index: integer? |
Game:addPartyMember(chara: string|PartyMember, index: any)
Arguments:
chara: string|PartyMember | The PartyMember class is a type of data class that stores information about a member of the party. |
index: any |
Returns:
1: any |
Game:encounter(encounter: string|Encounter, transition: (boolean|string)?, enemy: (table|Character)?, context: ChaserEnemy?)
Starts a battle using the specified encounter file.
@param encounter
— The encounter id or instance to use for this battle.
@param transition
— Whether to start in the transition state (Defaults to true
). As a string, represents the state to start the battle in.
@param enemy
— An enemy instance or list of enemies as Character
s in the world that will transition into the battle.
Arguments:
encounter: string|Encounter | The encounter id or instance to use for this battle. |
transition: (boolean|string)? | Whether to start in the transition state (Defaults to |
enemy: (table|Character)? | An enemy instance or list of enemies as |
context: ChaserEnemy? | An enemy found in the Overworld that can chase the player and start encounters. |
Game:enter(previous_state: string, save_id: number?, save_name: string?, fade: boolean?)
Arguments:
previous_state: string | |
save_id: number? | |
save_name: string? | |
fade: boolean? |
Game:enterShop(shop: string|Shop, options: table?)
Enters a shop
@param shop
— The shop to enter
@param options
— An optional table of leave_options
for exiting the shop
Arguments:
shop: string|Shop | The shop to enter |
options: table? | An optional table of |
Game:fadeIntoLegend(cutscene: string, legend_options: table?, fade_options: table?)
Arguments:
cutscene: string | |
legend_options: table? | |
fade_options: table? |
Game:getConfig(key: string, merge: boolean?, deep_merge: boolean?)
Arguments:
key: string | |
merge: boolean? | |
deep_merge: boolean? |
Returns:
1: any |
Game:getFlag(flag: string, default: any)
Gets the value of the flag named flag
, returning default
if the flag does not exist
Arguments:
flag: string | |
default: any |
Returns:
1: any |
Game:getPartyIndex(chara: string|PartyMember)
Arguments:
chara: string|PartyMember | The PartyMember class is a type of data class that stores information about a member of the party. |
Returns:
1: integer |
Game:getRecruits(include_incomplete: boolean?, include_hidden: boolean?)
Arguments:
include_incomplete: boolean? | |
include_hidden: boolean? |
Returns:
1: Recruit[] |
Game:hasPartyMember(chara: string|PartyMember)
Arguments:
chara: string|PartyMember | The PartyMember class is a type of data class that stores information about a member of the party. |
Returns:
1: boolean? |
Game:load(data: SaveData?, index: number?, fade: boolean?)
Arguments:
data: SaveData? | All the data that gets saved by Kristal when the player saves their game |
index: number? | |
fade: boolean? |
Game:movePartyMember(chara: string|PartyMember, index: integer)
Arguments:
chara: string|PartyMember | The PartyMember class is a type of data class that stores information about a member of the party. |
index: integer |
Returns:
1: string|PartyMember |
Game:removeFollower(chara: string|Follower)
Arguments:
chara: string|Follower | Followers are a type of Overworld character that follow the player's movements. |
Game:removePartyMember(chara: string|PartyMember)
Arguments:
chara: string|PartyMember | The PartyMember class is a type of data class that stores information about a member of the party. |
Returns:
1: PartyMember? |
Game:setBorder(border: (string|Border)?, time: number?)
Arguments:
border: (string|Border)? | |
time: number? |
Game:setFlag(flag: string, value: any)
Sets the value of the flag named flag
to value
Arguments:
flag: string | |
value: any |
Game:setPartyMembers(: string|PartyMember)
Arguments:
: string|PartyMember | The PartyMember class is a type of data class that stores information about a member of the party. |
Game:setupShop(shop: string|Shop)
Arguments:
shop: string|Shop | The class which all Shops in Kristal use. |
Fields
Game.battle: Battle
The Battle
Object manages everything related to battles in Kristal.
A globally available reference to the in-use Battle
instance is stored in Game.battle
.
Game.dark_inventory: DarkInventory
A type of inventory used to store items in the Dark World.
Game.gameover: GameOver
An object that is created whenever the player reaches a Game Over, responsible for managing the GameOver sequence.
The type of GameOver that plays (Chapter 1, Chapter 2, or Undertale) is dependent on the mod configuration and whether the death occurred in the Light World or not.
Game.inventory: DarkInventory|LightInventory
A type of inventory used to store items in the Dark World.
Game.legend: Legend
The handler object for Legend-style cutscenes.
For the object that is received by legend cutscene scripts, see LegendCutscene
.
Game.light_inventory: LightInventory
A type of inventory used to store items in the Light World.
Game.quick_save: SaveData
All the data that gets saved by Kristal when the player saves their game
Game.shop: Shop
The class which all Shops in Kristal use.
Shop files should be located in scripts/shops
, and will use their filepath relative to this location as an id by default.
Either World:shopTransition()
or a Transition
event with the property shop
defined can be used to enter shops.
Game.stage: Stage
The Stage object in Kristal is designed to be the highest parent object at all times.
All throughout gameplay, the active stage is Game.stage
, while when in the Kristal menu, Kristal.Stage
is the stage instead.
Game.world: World
The World
Object manages everything relating to the overworld in Kristal.
A globally available instance of World
is stored in Game.world
.
Undocumented
Game.encounter_enemies: table|Character
All types of character in the overworld inherit from the Character
class.
This class is not to be confused with the psuedo-event NPC
that is used for characters placed in the overworld.
Game.encounter_enemies: Character
All types of character in the overworld inherit from the Character
class.
This class is not to be confused with the psuedo-event NPC
that is used for characters placed in the overworld.
Game.old_soul_inv_timer: integer
Used to carry the soul invulnerability frames between waves