Constructor






Methods


BattleCutscene:alert(chara: string|Battler, : unknown)

Creates an alert bubble above a character.

@param chara — The character being shaken. Accepts either a Battler instance or an id to search for.

@param ... — Arguments to be passed to Battler:alert().

@return alert_icon — The result alert icon created above the character's head.

@return finished — A function that returns true once the alert icon has disappeared.
See: Battler.alert for details on the arguments to pass to this function.

Arguments:

chara: string|Battler

The character being shaken. Accepts either a Battler instance or an id to search for.

: unknown

Arguments to be passed to Battler:alert().

Returns:

alert_icon: Sprite

The result alert icon created above the character's head.

finished: fun()boolean

A function that returns true once the alert icon has disappeared. \



BattleCutscene:battlerText(battlers: string|Battler, text: string, options: (table|"advance"|"after"|"auto"|"line_callback"...(+3))?)

Creates a text bubble for one or more battlers.

@param battlers — A battler id, or a Battler instance. If multiple battlers share the same id, specifying one will create a bubble for each of them.

@param text — The text that will appear in the speech bubble.

@param options — A table defining additional properties to control the text.

@return finished — If the cutscene is not automatically waiting, a boolean that reflects whether all the dialogue bubbles have finished.

@return bubbles — A table of all bubbles created by this function call.

options:
    | "wait" -- Whether the cutscene should automatically suspend itself until the bubbles have finished. (Defaults to `true`)
    | "x" -- The x-offset of the speech bubble. (Defaults to `0`)
    | "y" -- The y-offset of the speech bubble. (Defaults to `0`)
    | "advance" -- Whether the bubble can be manually advanced by the player. (Defaults to `true`)
    | "auto" -- Whether the bubble will auto-advance after it has typed the last character. (Defaults to `false`)
    | "after" -- A callback to add to the bubble, that will be run when it finishes.
    | "line_callback" -- Sets the line_callback of the text.

Arguments:

battlers: string|Battler

A battler id, or a Battler instance. If multiple battlers share the same id, specifying one will create a bubble for each of them.

text: string

The text that will appear in the speech bubble.

options: (table|"advance"|"after"|"auto"|"line_callback"...(+3))?

A table defining additional properties to control the text.

Returns:

finished: any

If the cutscene is not automatically waiting, a boolean that reflects whether all the dialogue bubbles have finished.

bubbles: table?

A table of all bubbles created by this function call.



BattleCutscene:choicer(choices: table, options: (table|"color"|"highlight"|"wait")?)

Creates a choicer with the choices specified in choices for the player to select from.

@param choices — A table of strings specifying the choices the player can select. Maximum of four.

@param options — A table defining additional properties to control the choicer.

@return selected — The index of the selected item if the cutscene has been set to wait for the choicer, otherwise a boolean that states whether the player has made their choice.

@return choicer — The choicebox object for this choicer. Only returned if wait is false.

options:
    | "color" -- The main color to set all the choices to, or a table of main colors to set for different choices. (Defaults to `COLORS.white`)
    | "highlight" -- The color to highlight the selected choice in, or a table of colors to highlight different choices in when selected. (Defaults to `COLORS.yellow`)
    | "wait" -- Whether the cutscene should automatically suspend itself until the player makes their choice. (Defaults to `true`)

Arguments:

choices: table

A table of strings specifying the choices the player can select. Maximum of four.

options: (table|"color"|"highlight"|"wait")?

A table defining additional properties to control the choicer.

Returns:

selected: number|function

The index of the selected item if the cutscene has been set to wait for the choicer, otherwise a boolean that states whether the player has made their choice.

choicer: Choicebox?

The choicebox object for this choicer. Only returned if wait is false.



BattleCutscene:closeText()

Clears the active choicebox and current encounter text, and removes all battler bubbles.



BattleCutscene:fadeIn(speed: number?, options: (table|"alpha"|"blocky"|"color"|"music")?)

Fades the screen and music back in after a fade out.

@param speed — The speed to fade in at, in seconds (Defaults to last fadeOut's speed.)

@param options — A table defining additional properties to control the fade.

@return finished — A function that returns true once the fade has finished.

options:
    | "color" -- The color that should be faded to (Defaults to last fadeOut's color)
    | "alpha" -- The alpha to start at (Defaults to `1`)
    | "blocky" -- Whether to do a rough, 'blocky' fade. (Defaults to `false`)
    | "music" -- The speed to fade the music at, or whether to fade it at all (Defaults to fade speed)

Arguments:

speed: number?

The speed to fade in at, in seconds (Defaults to last fadeOut's speed.)

options: (table|"alpha"|"blocky"|"color"|"music")?

A table defining additional properties to control the fade.

Returns:

finished: fun()boolean

A function that returns true once the fade has finished.



BattleCutscene:fadeOut(speed: number?, options: (table|"alpha"|"blocky"|"color"|"music")?)

Fades the screen and music out.

@param speed — The speed to fade out at, in seconds. (Defaults to 0.25)

@param options — A table defining additional properties to control the fade.

@return finished — A function that returns true once the fade has finished.

options:
    | "color" -- The color that should be faded to (Defaults to `COLORS.black`)
    | "alpha" -- The alpha to start at (Defaults to `0`)
    | "blocky" -- Whether to do a rough, 'blocky' fade. (Defaults to `false`)
    | "music" -- The speed to fade the music at, or whether to fade it at all (Defaults to fade speed)

Arguments:

speed: number?

The speed to fade out at, in seconds. (Defaults to 0.25)

options: (table|"alpha"|"blocky"|"color"|"music")?

A table defining additional properties to control the fade.

Returns:

finished: fun()boolean

A function that returns true once the fade has finished.



BattleCutscene:getCharacter(id: string)

Gets the first instance of a specific party or enemy character in the current battle.

@param id — The character id to search for.

@return battler — The PartyBattler/EnemyBattler instance of the character if they exist, otherwise nil.

Arguments:

id: string

The character id to search for.

Returns:

battler: EnemyBattler|PartyBattler|nil

The PartyBattler/EnemyBattler instance of the character if they exist, otherwise nil.



BattleCutscene:getEnemies(id: string)

Gets all enemies with the specified id in the current battle.

@param id — The enemy id to search for.

@return enemies — A table containing all matched EnemyBattler instances.

Arguments:

id: string

The enemy id to search for.

Returns:

enemies: table

A table containing all matched EnemyBattler instances.



BattleCutscene:getTarget()

Gets the character being targetted of the current action.

@return target — The target Battler of the current action.

Returns:

target: Battler

The target Battler of the current action.



BattleCutscene:getUser()

Gets the character that is performing the current action.

@return battler — The PartyBattler performing the current action.

Returns:

battler: PartyBattler

The PartyBattler performing the current action.



BattleCutscene:moveTo(chara: string|Battler, x: number, y: number, speed: number?)

(Deprecated) Linearly moves a character to a new position (x, y) over time at a rate of speed pixels per frame.

@param chara — The character being moved. Accepts either a Battler instance or an id to search for.

@param x — The new x-coordinate to approach.

@param y — The new y-coordinate to approach.

@param speed — The amount the character's x and y should approach their new position by every frame, in pixels per frame at 30FPS. (Defaults to 4)

@return finished — A function that returns true once the movement has finished.

Arguments:

chara: string|Battler

The character being moved. Accepts either a Battler instance or an id to search for.

x: number

The new x-coordinate to approach.

y: number

The new y-coordinate to approach.

speed: number?

The amount the character's x and y should approach their new position by every frame, in pixels per frame at 30FPS. (Defaults to 4)

Returns:

finished: fun()boolean

A function that returns true once the movement has finished.





BattleCutscene:resetSprites()

Resets the sprites of characters who have had their sprites changed in this cutscene.
Called in BattleCutscene:onEnd() automatically.



BattleCutscene:setAnimation(chara: string|Battler, anim: string?)

Sets the animation of a particular character.
The change lasts until the end of the cutscene or until the animation is changed again.

@param chara — The character to change the sprite of. Accepts either a Battler instance or an id to search for.

@param anim — The name of the animation to be set.

@return finished — A function that returns true once the animation has finished.

Arguments:

chara: string|Battler

The character to change the sprite of. Accepts either a Battler instance or an id to search for.

anim: string?

The name of the animation to be set.

Returns:

finished: fun()boolean

A function that returns true once the animation has finished.



BattleCutscene:setSpeaker(actor: (Actor|EnemyBattler|PartyBattler|nil)?)

Sets the active speaker for the encountertext box.

@param actor — The character or actor to set as the speaker. nil resets the speaker to nothing.

Arguments:

actor: (Actor|EnemyBattler|PartyBattler|nil)?

The character or actor to set as the speaker. nil resets the speaker to nothing.



BattleCutscene:setSprite(chara: string|Battler, sprite: string?, speed: number?)

Sets the sprite of a particular character.
The change lasts until the end of the cutscene or until the sprite is changed again.

@param chara — The character to change the sprite of. Accepts either a Battler instance or an id to search for.

@param sprite — The name of the sprite to be set.

@param speed — The time, in seconds, between frames for the sprite, if it has multiple frames. (Defaults to 1/30)

Arguments:

chara: string|Battler

The character to change the sprite of. Accepts either a Battler instance or an id to search for.

sprite: string?

The name of the sprite to be set.

speed: number?

The time, in seconds, between frames for the sprite, if it has multiple frames. (Defaults to 1/30)



BattleCutscene:shakeCamera(x: number?, y: number?, friction: number?)

Shakes the camera by the specified x, y.

@param x — The amount of shake in the x direction. (Defaults to 4)

@param y — The amount of shake in the y direction. (Defaults to 4)

@param friction — The amount that the shake should decrease by, per frame at 30FPS. (Defaults to 1)

@return finished — A function that returns true once the shake value has returned to 0.

Arguments:

x: number?

The amount of shake in the x direction. (Defaults to 4)

y: number?

The amount of shake in the y direction. (Defaults to 4)

friction: number?

The amount that the shake should decrease by, per frame at 30FPS. (Defaults to 1)

Returns:

finished: fun()boolean

A function that returns true once the shake value has returned to 0.



BattleCutscene:shakeCharacter(chara: string|Battler, x: number?, y: number?, friction: number?, delay: number?)

Shakes a character by the specified x, y.

@param chara — The character being shaken. Accepts either a Battler instance or an id to search for.

@param x — The amount of shake in the x direction. (Defaults to 4)

@param y — The amount of shake in the y direction. (Defaults to 0)

@param friction — The amount that the shake should decrease by, per frame at 30FPS. (Defaults to 1)

@param delay — The time it takes for the object to invert its shake direction, in seconds. (Defaults to 1/30)

@return finished — A function that returns true once the shake value has returned to 0.

Arguments:

chara: string|Battler

The character being shaken. Accepts either a Battler instance or an id to search for.

x: number?

The amount of shake in the x direction. (Defaults to 4)

y: number?

The amount of shake in the y direction. (Defaults to 0)

friction: number?

The amount that the shake should decrease by, per frame at 30FPS. (Defaults to 1)

delay: number?

The time it takes for the object to invert its shake direction, in seconds. (Defaults to 1/30)

Returns:

finished: fun()boolean

A function that returns true once the shake value has returned to 0.



BattleCutscene:slideTo(obj: string|Battler, x: number, y: number, time: number?, ease: ("in-back"|"in-bounce"|"in-circ"|"in-cubic"|"in-elastic"...(+66))?)

Moves a character to a new position (x, y) over time seconds. \ Supports easing.

@param obj — The character being moved. Accepts either a Battler instance or an id to search for.

@param x — The new x-coordinate to approach.

@param y — The new y-coordinate to approach.

@param time — The amount of time, in seconds, that the slide should take. (Defaults to 1 second)

@param ease — The ease type to use when moving position. (Defaults to "linear")

@return finished — A function that returns true once the movement is finished.

ease:
    | "linear"
    | "in-quad"
    | "in-cubic"
    | "in-quart"
    | "in-quint"
    | "in-sine"
    | "in-expo"
    | "in-circ"
    | "in-back"
    | "in-bounce"
    | "in-elastic"
    | "out-quad"
    | "out-cubic"
    | "out-quart"
    | "out-quint"
    | "out-sine"
    | "out-expo"
    | "out-circ"
    | "out-back"
    | "out-bounce"
    | "out-elastic"
    | "in-out-quad"
    | "in-out-cubic"
    | "in-out-quart"
    | "in-out-quint"
    | "in-out-sine"
    | "in-out-expo"
    | "in-out-circ"
    | "in-out-back"
    | "in-out-bounce"
    | "in-out-elastic"
    | "inQuad"
    | "outQuad"
    | "inOutQuad"
    | "outInQuad"
    | "inCubic"
    | "outCubic"
    | "inOutCubic"
    | "outInCubic"
    | "inQuart"
    | "outQuart"
    | "inOutQuart"
    | "outInQuart"
    | "inQuint"
    | "outQuint"
    | "inOutQuint"
    | "outInQuint"
    | "inSine"
    | "outSine"
    | "inOutSine"
    | "outInSine"
    | "inExpo"
    | "outExpo"
    | "inOutExpo"
    | "outInExpo"
    | "inCirc"
    | "outCirc"
    | "inOutCirc"
    | "outInCirc"
    | "inElastic"
    | "outElastic"
    | "inOutElastic"
    | "outInElastic"
    | "inBack"
    | "outBack"
    | "inOutBack"
    | "outInBack"
    | "inBounce"
    | "outBounce"
    | "inOutBounce"
    | "outInBounce"

Arguments:

obj: string|Battler

The character being moved. Accepts either a Battler instance or an id to search for.

x: number

The new x-coordinate to approach.

y: number

The new y-coordinate to approach.

time: number?

The amount of time, in seconds, that the slide should take. (Defaults to 1 second)

ease: ("in-back"|"in-bounce"|"in-circ"|"in-cubic"|"in-elastic"...(+66))?

The ease type to use when moving position. (Defaults to "linear")

Returns:

finished: fun()boolean

A function that returns true once the movement is finished.



BattleCutscene:slideToSpeed(obj: string|Battler, x: number, y: number, speed: number?)

Linearly moves a character to a new position (x, y) over time at a rate of speed pixels per frame.

@param obj — The character being moved. Accepts either a Battler instance or an id to search for.

@param x — The new x-coordinate to approach.

@param y — The new y-coordinate to approach.

@param speed — The amount the character's x and y should approach their new position by every frame, in pixels per frame at 30FPS. (Defaults to 4)

@return finished — A function that returns true once the movement has finished.

Arguments:

obj: string|Battler

The character being moved. Accepts either a Battler instance or an id to search for.

x: number

The new x-coordinate to approach.

y: number

The new y-coordinate to approach.

speed: number?

The amount the character's x and y should approach their new position by every frame, in pixels per frame at 30FPS. (Defaults to 4)

Returns:

finished: fun()boolean

A function that returns true once the movement has finished.



BattleCutscene:text(text: string, portrait: string?, actor: Actor?, options: (table|"advance"|"align"|"auto"|"font"...(+6))?)

Types text on the encounter text box, and suspends the cutscene until the player progresses the dialogue.
When passing arguments to this function, the options table can be passed as the second or third argument to forgo specifying portrait or actor.


@param text — The text to be typed.

@param portrait — The character portrait to be used.

@param actor — The actor to use for voice bytes and dialogue portraits, overriding the active cutscene speaker.

@param options — A table defining additional properties to control the text.

@return finished — A function that returns true when the textbox has been advanced. (Only use if options["wait"] is set to false.)

options:
    | "x" -- The x-offset of the dialgoue portrait.
    | "y" -- The y-offset of the dialogue portrait.
    | "reactions" -- A table of tables that define "reaction" dialogues. Each table defines the dialogue, x and y position of the face, actor and face sprite, in that order. x and y can be strings as well, referring to existing positions; x can be left, leftmid, mid, middle, rightmid, or right, and y can be top, mid, middle, bottommid, and bottom. Must be used in combination with a react text command.
    | "functions" -- A table defining additional functions that can be used in the text with the `func` text command. Each key, value pair will form the id to use with `func` and the function to be called, respectively.
    | "font" -- The font to be used for this text. Can optionally be defined as a table {font, size} to also set the text size.
    | "align" -- Sets the alignment of the text.
    | "skip" -- If false, the player will be unable to skip the textbox with the cancel key.
    | "advance" -- When `false`, the player cannot advance the textbox, and the cutscene will no longer suspend itself on the dialogue by default.
    | "auto" -- When `true`, the text will auto-advance after the last character has been typed.
    | "wait" -- Whether the cutscene should automatically suspend itself until the textbox advances. (Defaults to `true`, unless `advance` is false.)

Arguments:

text: string

The text to be typed.

portrait: string?

The character portrait to be used.

actor: Actor?

The actor to use for voice bytes and dialogue portraits, overriding the active cutscene speaker.

options: (table|"advance"|"align"|"auto"|"font"...(+6))?

A table defining additional properties to control the text.

Returns:

finished: fun()

A function that returns true when the textbox has been advanced. (Only use if options["wait"] is set to false.)






Fields



Undocumented













BattleCutscene.textbox_actor: (Actor|EnemyBattler|PartyBattler|nil)?

PartyBattlers are a type of Battler that represent PartyMembers when they are in battle.
The set of PartyBattlers in the current battle are stored in Game.battle.party.
Unlike EnemyBattler, party members do not need to define a PartyBattler in a file as their PartyMember file defines everything necessary and is utilised by PartyBattler.