Player
Instance of Entity. All Living and Character functions are available as well.
Player functions are accessible to all entities, but will throw if the entity is not a Player.
Player.from(entity)
Returns the entity passed in if the entity is a player, otherwise returns nil.
player:is_local()
Used for creating small private differences between players, such as playing a sound effect, hiding a sprite, or changing a sprites color.
Returns true if the player is the local player.
Warning: Can cause unintentional desyncs. Limit behavior driven by this.
Creating or deleting sprites, entities, and animations can cause non obvious unintentional desyncs. Of course those aren't the only ways to cause unintentional desyncs.
Even modifying a sprite's color can cause a desync if another script attempts to read the sprite's color to drive behavior.
player:player_index()
Returns a number, represents the index of the player in the list of players sent from the server.
player:emotions()
Returns a list of valid values for player:set_emotion().
player:emotion()
Returns the name of the current emotion animation state.
player:set_emotion(state)
Sets the current animation state for the player's emotion.
If the state doesn't exist, this does nothing.
player:emotions_texture()
Returns a string.
player:emotions_animation_path()
Returns a string.
player:emotion_node()
Returns a Sprite
player:set_emotions_texture(path)
path: file path relative to script file, use values returned fromResources.load_texture()for better performance.
player:load_emotions_animation(path)
path: file path relative to script file, use values returned fromResources.load_texture()for better performance.
If the animation doesn't have a state matching the current emotion, it will reset the player's emotion to "DEFAULT"
player:input_has(input_query)
input_queryInput.Held.*Input.Pressed.*Input.Pulsed.*LeftRightDownUseSpecialShootFaceLeftFaceRightLeftShoulderRightShoulderConfirmCancelEndTurnReady
Returns true if input_query matches the player's current input state.
player:input_delay()
Returns a number, represents the configured input delay for this player.
Useful for timing based selection, most mods will not need to use this value.
player:remember(key, number_or_string)
Stores a value that can be read in future battles.
player:recall(key)
Returns a number, string, or nil, store values with to player:remember()
player:forget(key)
Clears a value stored through player:remember()
player:play_audio(path, audio_behavior?)
path: file path relative to script file, use values returned fromResources.load_audio()for better performance.audio_behavior: AudioBehavior
Plays an audio file to only this player.
See Resources.play_audio() for playing audio for all players.
player:set_fully_charged_color(color)
color: Color
Sets the color of the fully charged sprite.
player:charge_position()
Returns { x: number, y: number }.
This table represents the offset for the attack charge animation.
player:set_charge_position(x, y)
Sets the offset for the attack charge animation.
player:slide_when_moving()
Returns a bool.
player:movement_on_input()
Returns true if holding movement buttons causes the player to move.
With no calls to *:set_movement_on_input(), the default is true.
player:set_movement_on_input(bool?)
Configures whether holding movement buttons causes the player to move, when no other augments or forms are overriding this behavior.
player:set_slide_when_moving(bool?)
When true, the player will slide to tiles and continue using the CHARACTER_IDLE state.
When false, the player will teleport to tiles and animate with the CHARACTER_MOVE state.
player:queue_normal_attack()
Queues an action from a Form, Augment, or the base player mod.
player:queue_charged_attack()
Queues an action from a Form, Augment, or the base player mod.
player:queue_special_attack()
Queues an action from a Form, Augment, or the base player mod.
player:special_on_input()
Returns true if pressing the Special button activates the special attack.
With no calls to *:set_special_on_input(), the default is true.
player:set_special_on_input(bool?)
Configures whether the Special button should activate the special attack, when no other augments or forms are overriding this behavior.
player:has_regular_card()
Returns a bool.
player:deck_cards()
Returns a list of DeckCard.
player:deck_card(index)
index: number, 1 is the first card in the deck.
Returns DeckCard or nil.
Creating CardProperties through this function rather than player:deck_card_properties() may cause desyncs when the mod is installed on multiple clients in battle.
player:deck_card_properties(index)
index: number, 1 is the first card in the deck.
Returns CardProperties or nil.
player:set_deck_card(index, deck_card)
index: number, 1 is the first card in the deck.deck_card: DeckCard
If there's no card at this index, nothing happens.
player:remove_deck_card(index)
index: number, 1 is the first card in the deck.
Removes a card from the player's deck.
Any StagedItem referencing this card will be dropped.
player:insert_deck_card(index, deck_card)
index: number, 1 is the first card in the deck.deck_card: DeckCard
Inserts a card into the player's deck.
player:staged_items_confirmed()
Returns true if Card Select can close.
player:confirm_staged_items()
Allows Card Select to close.
player:stage_card(card_properties, function()?)
card_properties: CardProperties- The callback will be called when the player removes the StagedItem.
Appends a new StagedItem to display in Card Select.
player:stage_deck_card(deck_index, function()?)
deck_index: number, 1 is the first card in the deck.- The callback will be called when the player removes the StagedItem.
Appends a new StagedItem to display in Card Select.
Any StagedItems already referencing deck_index will be removed.
player:stage_deck_discard(deck_index, function()?)
deck_index: number, 1 is the first card in the deck.- The callback will be called when the player removes the StagedItem.
Appends a new StagedItem to display in Card Select.
Any StagedItems already referencing deck_index will be removed.
player:stage_form(form, texture_path?, function()?)
form: PlayerFormtexture_path: The texture to use for the icon.- The callback will be called when the player removes the StagedItem.
Prepends a new StagedItem that will be displayed in card select if a texture is set. If a form is already staged this StagedItem will replace the existing item.
player:stage_icon(texture_path, function()?)
texture_path: The texture to use for the icon.- The callback will be called when the player removes the StagedItem.
Appends a new StagedItem to display in Card Select.
player:pop_staged_item()
Removes the latest StagedItem, calling the undo callback.
player:staged_items()
Returns a list of StagedItem
player:staged_item(index)
index: number, starts with 1.
Returns a StagedItem or nil.
player:staged_item_texture(index)
index: number, starts with 1.
Returns a string. Represents the path to the StagedItem's icon texture.