Module helper_functions
Helper functions that can be used in cutscenes.
Please do not edit this file to add your own helper functions, put them in your own cutscenes. Optionally load them with `loadCelesteAsset` and put it in a common library. When using from a cutscene "helpers." is not required. For example "helpers.say" will be just "say". Return values starting with # are from C#.
Functions
helpers.setClassNamePrefix (prefix) | Set the prefix for getting Celeste classes. |
helpers.getClassNamePrefix () | Get the prefix for getting Celeste classes. |
helpers.readCelesteAsset (filename) | Get the content of a file from a Celeste asset. |
helpers.loadCelesteAsset (filename) | Loads and returns the result of a Lua asset. |
helpers.log (message[, tag="Lua Cutscenes"]) | Put debug message in the Celeste console. |
helpers.getEnum (enum, value) | Gets enum value. |
helpers.wait (duration) | Pause code exection for duration seconds. |
helpers.getRoom () | Gets the current room the player is in. |
helpers.getSession () | Gets the current session. |
helpers.say (dialog) | Display textbox with dialog. |
helpers.miniTextbox (dialog) | Display minitextbox with dialog. |
helpers.choice (...) | Allow the user to select one of several minitextboxes, similar to intro cutscene of Reflection. |
helpers.choiceDialog (Table) | Displays a choice dialog, similar to intro cutscene of Reflection. |
helpers.closeChoiceDialog () | Closes the choice dialog previously opened by helpers.choiceDialog |
helpers.postcard (dialog, sfxIn[, sfxOut=nil]) | Display postcard. |
helpers.walkTo (x[, walkBackwards=false[, speedMultiplier=1.0[, keepWalkingIntoWalls=false]]]) | Player walks to the given X coordinate. |
helpers.walk (x[, walkBackwards=false[, speedMultiplier=1.0[, keepWalkingIntoWalls=false]]]) | Player walks x pixels from current position. |
helpers.runTo (x, fastAnimation) | Player runs to the given X coordinate. |
helpers.run (x, fastAnimation) | Player runs x pixels from current position. |
helpers.die ([direction={0⸴ 0}[, evenIfInvincible=false[, registerDeathInStats=true]]]) | Kills the player. |
helpers.setPlayerState (state[, locked=false]) | Sets the current player state. |
helpers.getPlayerState () | Gets the current state of the player. |
helpers.disableMovement () | Disable player movement. |
helpers.enableMovement () | Enable player movement. |
helpers.jump ([duration=2.0]) | Make the player jump. |
helpers.waitUntilOnGround () | Waits until the player is on the ground. |
helpers.changeRoom (name[, spawnX[, spawnY]]) | Changes the room the game thinks the player is in. |
helpers.teleportTo (x, y[, room[, introType]]) | Sets the player position to the absolute coordinates. |
helpers.teleport (x, y[, room[, introType]]) | Teleport the player to (x, y) pixels from current position. |
helpers.instantTeleportTo (x, y[, room]) | Instantly teleport the player seamlessly. |
helpers.instantTeleport (x, y[, room]) | Instantly teleport the player to the same coordinates in another room seamlessly. |
helpers.completeArea ([spotlightWipe=false[, skipScreenWipe=false[, skipCompleteScreen=false]]]) | Completes the level and returns the player to the chapter screen. |
helpers.playSound (name[, position]) | Plays a sound. |
helpers.getEntities (name[, prefix]) | Gets all tracked entities by class name. |
helpers.getEntity (name[, prefix]) | Gets the first tracked entity by class name. |
helpers.getAllEntities (name[, prefix]) | Gets all entities by class name. |
helpers.getFirstEntity (name[, prefix]) | Gets the first entity by class name. |
helpers.giveFeather () | Puts player in feather state. |
helpers.deathsInCurrentRoom () | Get amount of deaths in current room. |
helpers.playMusic (track, progress) | Play and update the current music track. |
helpers.getMusic () | Get the current music track name. |
helpers.setMusicProgression (progress) | Sets music progression. |
helpers.getMusicProgression () | Gets the current music progression. |
helpers.setMusicLayer (layer, value) | Set music layer on/off. |
helpers.setSpawnPoint ([target={0⸴ 0}[, absolute=false]]) | Attempt to set the player spawnpoint. |
helpers.shake (Direction[, duration]) | Shakes the camera. |
helpers.setInventory (name) | Set player inventory |
helpers.getInventory ([inventory]) | Get player inventory |
helpers.setCameraOffset (x[, y]) | Offset the camera by x and y like in camera offset trigger. |
helpers.getCameraOffset () | Get the current offset struct. |
helpers.getRoomCoordinates () | Get the current room coordinates. |
helpers.getRoomCoordinatesOffset (x[, y]) | Get the current room coordinates offset by x and y. |
helpers.setFlag (flag, value) | Set session flag. |
helpers.getFlag (flag) | Get session flag. |
helpers.endCutscene () | Ends the current cutscene. |
helpers.setBloomStrength (amount) | Sets the current bloom strength. |
helpers.getBloomStrength () | Returns the current bloom strength. |
helpers.setDarkness (amount) | Sets the current darkness (bloom) strength. |
helpers.getDarkness () | Returns the current darkness (bloom) strength. |
helpers.setCoreMode (mode) | Sets the current core mode. |
helpers.getCoreMode () | Returns the current core mode. |
helpers.setColorGrade (colorGrade[, instant=false]) | Changes the current colorgrade to the new one. |
helpers.cassetteFlyTo (endX, endY[, controllX=endX[, controllY=endY]]) | Bubble flies (cassette collection) to the target. |
helpers.cassetteFly (endX, endY[, controllX=endX[, controllY=endY]]) | Bubble flies (cassette collection) to the target relative to player. |
helpers.giveKey () | Gives the player a key. |
helpers.makeUnskippable () | Disables skip cutscene from menu. |
helpers.enableRetry () | Enables retrying from menu. |
helpers.disableRetry () | Disables retrying from menu. |
helpers.disablePause () | Prevents the player from even accessing the pause menu. |
helpers.enablePause () | Reenables the player to pause the game. |
Functions
- helpers.setClassNamePrefix (prefix)
-
Set the prefix for getting Celeste classes.
By default this is "Celeste.".
- prefix
string
- The new prefix.
- helpers.getClassNamePrefix ()
-
Get the prefix for getting Celeste classes.
By default this is "Celeste.".
Returns
-
#Monocle.Entity
First entity of given class.
- helpers.readCelesteAsset (filename)
-
Get the content of a file from a Celeste asset.
- filename
string
- Filename to load. Filename should not have a extention.
- helpers.loadCelesteAsset (filename)
-
Loads and returns the result of a Lua asset.
- filename
string
- Filename to load. Filename should not have a extention.
- helpers.log (message[, tag="Lua Cutscenes"])
- Put debug message in the Celeste console.
- helpers.getEnum (enum, value)
-
Gets enum value.
- enum
string
- String name of enum.
- string name or enum value to get.
- value
any
- helpers.wait (duration)
-
Pause code exection for duration seconds.
- duration
number
- Duration to wait (in seconds).
- helpers.getRoom ()
-
Gets the current room the player is in.
Returns
-
#Celeste.Level
The current room.
- helpers.getSession ()
-
Gets the current session.
Returns
-
#Celeste.Session
The current session.
- helpers.say (dialog)
-
Display textbox with dialog.
- dialog
string
- Dialog ID used for the conversation.
- helpers.miniTextbox (dialog)
-
Display minitextbox with dialog.
- dialog
string
- Dialog ID used for the textbox.
- helpers.choice (...)
-
Allow the user to select one of several minitextboxes, similar to intro cutscene of Reflection.
- ...
string
- Dialog IDs for each of the textboses as varargs.
Returns
-
number
The index of the option the player selected.
- helpers.choiceDialog (Table)
-
Displays a choice dialog, similar to intro cutscene of Reflection.
Unlike helpers.choice, this function also handles displaying dialogs and keeping track of which choices were already picked.
Check the 'example_talker.lua' file for a usage example.
- Table
table
- describing all choices and requirements, etc.
- helpers.closeChoiceDialog ()
- Closes the choice dialog previously opened by helpers.choiceDialog
- helpers.postcard (dialog, sfxIn[, sfxOut=nil])
- Display postcard.
- helpers.walkTo (x[, walkBackwards=false[, speedMultiplier=1.0[, keepWalkingIntoWalls=false]]])
-
Player walks to the given X coordinate. This is in pixels and uses map based coordinates.
- x
number
- X coordinate to walk to.
- If the player should visually be walking backwards.
- How fast the player should move. Walking is considered a speed multiplier of 1.0.
- If the player should keep walking into walls.
- walkBackwards
bool
(default false)
- speedMultiplier
number
(default 1.0)
- keepWalkingIntoWalls
bool
(default false)
- helpers.walk (x[, walkBackwards=false[, speedMultiplier=1.0[, keepWalkingIntoWalls=false]]])
-
Player walks x pixels from current position.
- x
number
- X offset for where player should walk.
- If the player should visually be walking backwards.
- How fast the player should move. Walking is considered a speed multiplier of 1.0.
- If the player should keep walking into walls.
- walkBackwards
bool
(default false)
- speedMultiplier
number
(default 1.0)
- keepWalkingIntoWalls
bool
(default false)
- helpers.runTo (x, fastAnimation)
-
Player runs to the given X coordinate. This is in pixels and uses map based coordinates.
- x
number
- X coordinate to run to.
- Whether this should use the fast animation or not.
- fastAnimation
bool
- helpers.run (x, fastAnimation)
-
Player runs x pixels from current position.
- x
number
- X offset for where player should run.
- Whether this should use the fast animation or not.
- fastAnimation
bool
- helpers.die ([direction={0⸴ 0}[, evenIfInvincible=false[, registerDeathInStats=true]]])
-
Kills the player.
- direction
table
(default {0⸴ 0})
- The direction the player dies from.
- If the player should die even if they are invincible (assist mode).
- If it should count as a death in journal.
- evenIfInvincible
bool
(default false)
- registerDeathInStats
bool
(default true)
- helpers.setPlayerState (state[, locked=false])
-
Sets the current player state.
- state
- Name of the state or the state number.
- If this should prevent the player for changing state afterwards.
- locked
bool
(default false)
- helpers.getPlayerState ()
- Gets the current state of the player.
- helpers.disableMovement ()
- Disable player movement.
- helpers.enableMovement ()
- Enable player movement.
- helpers.jump ([duration=2.0])
-
Make the player jump.
- duration
number
(default 2.0)
- How long the "jump button" would be held (in seconds).
- helpers.waitUntilOnGround ()
- Waits until the player is on the ground.
- helpers.changeRoom (name[, spawnX[, spawnY]])
- Changes the room the game thinks the player is in.
- helpers.teleportTo (x, y[, room[, introType]])
-
Sets the player position to the absolute coordinates.
- x
number
- Target x coordinate.
- Target y coordinate.
- What room the game should attempt to load. If room is specified player will land at closest spawnpoint to target location.
- intro type to use, can be either a #Celeste.Player.IntroTypes enum or a string
- y
number
- room
string
(optional)
- introType
any
(optional)
- helpers.teleport (x, y[, room[, introType]])
-
Teleport the player to (x, y) pixels from current position.
- x
number
- X offset on X axis.
- Y offset on Y axis.
- What room the game should attempt to load. If room is specified player will land at closest spawnpoint to target location.
- intro type to use, can be either a #Celeste.Player.IntroTypes enum or a string. Only applies if room is specified.
- y
number
- room
string
(optional)
- introType
any
(optional)
- helpers.instantTeleportTo (x, y[, room])
-
Instantly teleport the player seamlessly.
Teleport player to (x, y) position, in pixels.
Room name as only argument will seamlessly teleport to that room at the same relative position.
- x
any
- X offset on X axis if number. Target room if string.
- Y offset on Y axis.
- What room the game should attempt to load. By default same room.
- y
number
- room
string
(optional)
- helpers.instantTeleport (x, y[, room])
-
Instantly teleport the player to the same coordinates in another room seamlessly.
Teleport player (x, y) pixels from current position.
Room name as only argument will seamlessly teleport to that room at the same relative position.
- x
any
- X offset on X axis if number. Target room if string.
- Y offset on Y axis.
- What room the game should attempt to load. By default same room.
- y
number
- room
string
(optional)
- helpers.completeArea ([spotlightWipe=false[, skipScreenWipe=false[, skipCompleteScreen=false]]])
-
Completes the level and returns the player to the chapter screen.
- spotlightWipe
bool
(default false)
- Whether this should be a spotlight wipe or not.
- Whether this wipe is skipped or not.
- Whether this skips the complete screen.
- skipScreenWipe
bool
(default false)
- skipCompleteScreen
bool
(default false)
- helpers.playSound (name[, position])
- Plays a sound.
- helpers.getEntities (name[, prefix])
- Gets all tracked entities by class name.
- helpers.getEntity (name[, prefix])
- Gets the first tracked entity by class name.
- helpers.getAllEntities (name[, prefix])
- Gets all entities by class name.
- helpers.getFirstEntity (name[, prefix])
- Gets the first entity by class name.
- helpers.giveFeather ()
- Puts player in feather state.
- helpers.deathsInCurrentRoom ()
-
Get amount of deaths in current room.
Returns
-
number
Current deaths in room.
- helpers.playMusic (track, progress)
-
Play and update the current music track.
- track
string
- Name of song, same as in Ahorn's room window.
- [opt] Which progress level the music should be at. Leave empty for no change.
- progress
number
- helpers.getMusic ()
-
Get the current music track name.
Returns
-
string
Music track name.
- helpers.setMusicProgression (progress)
-
Sets music progression.
- progress
number
- The new progress level.
- helpers.getMusicProgression ()
-
Gets the current music progression.
Returns
-
number
Music progress level.
- helpers.setMusicLayer (layer, value)
-
Set music layer on/off.
- layer
any
- number or table of numbers to set.
- The state of the layer.
- value
bool
- helpers.setSpawnPoint ([target={0⸴ 0}[, absolute=false]])
-
Attempt to set the player spawnpoint.
- target
table
(default {0⸴ 0})
- Where it should attempt to set the spawnpoint from.
- If set uses absolute coordinates from target, otherwise it offsets from the center of the cutscene trigger.
- absolute
bool
(default false)
- helpers.shake (Direction[, duration])
-
Shakes the camera.
- Direction
direction
- the screen should shake from.
- How long the screen should shake.
- duration
bool
(optional)
- helpers.setInventory (name)
-
Set player inventory
- name
- Inventory to use. If name is string look it up in valid inventories, otherwise use the inventory.
- helpers.getInventory ([inventory])
-
Get player inventory
- inventory
string
(optional)
- If name is given get inventory by name, otherwise the current player inventory
- helpers.setCameraOffset (x[, y])
-
Offset the camera by x and y like in camera offset trigger.
- x
- X coordinate or table of coordinates to offset by.
- Y coordinate to offset by.
- y
number
(optional)
- helpers.getCameraOffset ()
-
Get the current offset struct.
Returns
-
{number⸴
number} The camera offset.
- helpers.getRoomCoordinates ()
-
Get the current room coordinates.
Returns
-
{number⸴
number} The camera offset.
- helpers.getRoomCoordinatesOffset (x[, y])
-
Get the current room coordinates offset by x and y.
- x
- X coordinate or table of coordinates to offset by.
- Y coordinate to offset by.
- y
number
(optional)
Returns
-
{number,
number} The camera offset.
- helpers.setFlag (flag, value)
-
Set session flag.
- flag
string
- Flag to set.
- State of flag.
- value
bool
- helpers.getFlag (flag)
-
Get session flag.
- flag
string
- Flag to get.
Returns
-
bool
The state of the flag.
- helpers.endCutscene ()
- Ends the current cutscene.
- helpers.setBloomStrength (amount)
-
Sets the current bloom strength.
- amount
number
- New bloom strength.
- helpers.getBloomStrength ()
-
Returns the current bloom strength.
Returns
-
number
Bloom strength.
- helpers.setDarkness (amount)
-
Sets the current darkness (bloom) strength.
- amount
number
- New bloom strength.
- helpers.getDarkness ()
-
Returns the current darkness (bloom) strength.
Returns
-
number
Bloom strength.
- helpers.setCoreMode (mode)
-
Sets the current core mode.
- mode
- String name for mode or Core Mode enum.
- helpers.getCoreMode ()
-
Returns the current core mode.
Returns
-
#Celeste.Session.CoreMode.
- helpers.setColorGrade (colorGrade[, instant=false])
-
Changes the current colorgrade to the new one.
- colorGrade
string
- Name of the color grade
- Wheter the color grade should instantly change or gradually change
- instant
bool
(default false)
- helpers.cassetteFlyTo (endX, endY[, controllX=endX[, controllY=endY]])
-
Bubble flies (cassette collection) to the target. This is in pixels and uses map based coordinates.
- endX
number
- X coordinate for end point.
- Y coordinate for end point.
- X coordinate for controll point.
- coordinate for controll.
- endY
number
- controllX
number
(default endX)
- controllY
number
(default endY)
- helpers.cassetteFly (endX, endY[, controllX=endX[, controllY=endY]])
-
Bubble flies (cassette collection) to the target relative to player. Values are in pixels and not tiles.
- endX
number
- X offset for end point.
- Y offset for end point.
- X offset for controll point.
- offset for controll.
- endY
number
- controllX
number
(default endX)
- controllY
number
(default endY)
- helpers.giveKey ()
- Gives the player a key.
- helpers.makeUnskippable ()
- Disables skip cutscene from menu.
- helpers.enableRetry ()
- Enables retrying from menu.
- helpers.disableRetry ()
- Disables retrying from menu.
- helpers.disablePause ()
- Prevents the player from even accessing the pause menu.
- helpers.enablePause ()
- Reenables the player to pause the game.