Players
Overview
void
boolean
boolean
integer
string
integer
integer
void
PlayerIndex
InventoryObject[]
void
integer
integer
integer
void
boolean
boolean
void
boolean
boolean
boolean
boolean
boolean
void
void
void
TrinketSituation?
TrinketSituation?
boolean
boolean
boolean
boolean
Functions
AddSmeltedTrinket()
Gives the player an smelted trinket without changing the player's current held trinkets.
DoesAnyPlayerHasItem()
Returns true if at least one player has the given item.
DoesAnyPlayerHasTrinket()
Returns true if at least one player has the given trinket.
GetBlackHeartsNum()
Returns the number of black hearts that the player has, excluding any soul hearts. For example, if the player has one full black heart, one full soul heart, and one half black heart, this function returns 3. This is different from the EntityPlayer.GetBlackHearts
method, since that returns a bitmask.
GetCharacterDeathAnimationName()
Helper function to determine which death animation a character will play - Most characters have a 56 frame death animation (i.e. the "Death" animation). - The Lost and Tainted Lost have a 38 frame death animation (i.e. the "LostDeath" animation). - Tainted Forgotten has a 20 frame death animation (i.e. the "ForgottenDeath" animation).
GetCharacterMaxHeartContainers()
Returns the maximum heart containers that the provided character can have. Normally, this is 12, but with Keeper it is 3, and with Tainted Keeper it is 2. This does not account for Birthright or Mother's Kiss; use the GetPlayerMaxHeartContainers
helper function for that.
GetClosestPlayers()
Returns the n closest players to a certain point. The players are ordered by their distance.
GetHearts()
Returns the number of red hearts that the player has, excluding any rotten hearts. For example, if the player has one full black heart, one full soul heart, and one half black heart, this function returns 3. This is different from the EntityPlayer.GetHearts
method, since that returns a value that includes rotten hearts.
GetPlayerByIndex()
Returns a player given its index.
GetPlayerFromEntity()
Helper function to get the player from a tear, laser, bomb, etc. Returns nil if the entity does not correspond to any particular player. This function works by looking at the Parent
and the SpawnerEntity
fields (in that order). As a last resort, it will attempt to use the Entity.ToPlayer
method on the entity itself.
GetPlayerHealthType()
Helper function to get the amount of a given health type a player has.
GetPlayerIndex()
@class PlayerIndex : integer Returns a given player's index. Useful for storing unique data per player.
GetPlayerInventory()
@class InventoryObject @field Type InventoryType @field Id CollectibleType | TrinketType Returns a list of all the items/gulped trinkets (things that appear on the extra HUD) ordered by the time they were collected. This method is not perfect and will fail if the player rerolls all of their items or a mod gives several items in the same frame.
GetPlayerMaxHeartContainers()
Helper function to get the max amount of heart containers a player can have.
GetPlayerNumHitsRemaining()
Returns the combined value of all of the player's red hearts, soul/black hearts, and bone hearts, minus the value of the player's rotten hearts. This is equivalent to the number of hits that the player can currently take, but does not take into account double damage from champion enemies and/or being on later floors. (For example, on Womb 1, players who have 1 soul heart remaining would die in 1 hit to anything, even though this function would report that they have 2 hits remaining.)
GetPlayers()
Returns a list of all players.
GetPlayersByCollectible()
Returns a list of all players that have a certain item
GetPlayersByTrinket()
Returns all the players that have a certain trinket
GetPlayersOfType()
Returns all the players of a given type.
GetPlayersWithControllerIndex()
Returns all the players corresponding to a controller index.
GetSmeltedTrinketMultiplier()
Returns the number of trinkets a player has smelted. Won't count the trinkets they're currently holding.
GetSoulHearts()
Returns the number of soul hearts that the player has, excluding any black hearts. For example, if the player has one full black heart, one full soul heart, and one half black heart, this function returns 2. This is different from the EntityPlayer.GetSoulHearts
method, since that returns the combined number of soul hearts and black hearts.
GetSubPlayerParent()
Helper function to get the parent of a given sub player.
GiveTrinketsBack()
Helper function to restore the player's trinkets back to the way they were before the temporarilyRemoveTrinket
function was used. It will re-smelt any smelted trinkets that were removed.
IsActiveTaintedLazForm()
Returns wether the given form of tainted lazarus is the active one. If the given player is not tainted lazarus, it'll always return false. Accounts for when the player has Birthright.
IsBethany()
Helper function to check if a player is Bethany or T.Bethany.
IsChildPlayer()
Helper function to detect if a player is a "child player", meaning they have a defined Parent
field (i.e. Strawman players)
IsDamageToPlayerFatal()
Uses the player's current health and other miscellaneous things to determine if incoming damage will be fatal.
IsJacobOrEsau()
Helper function to check if a player is either Jacob or Esau. Note that this will only be true for the non tainted versions.
IsKeeper()
Helper function to check if a player is either Keeper of T.Keeper.
IsTaintedLazarus()
Helper function to check if a player is any form of Tainted Lazarus.
IsTheLost()
Helper function to check if a player is The Lost or T.The Lost.
PlayerHasCollectible()
Returns true
if the player has one or more of the provided collectibles This function is variadic, meaning that you can specify as many collectible types that you want to check for.
RegisterCharacterHealthConversion()
Causes the provided player type to have their health be converted to the provided heart sub-type. This is the same mechanic that certain characters use for converting health, such as Blue Baby having red heart containers being converted into soul hearts.
RemoveCollectibleCostume()
Removes a costume from the provided player.
TemporarilyRemoveTrinket()
@class TrinketSituation @field TrinketTypeRemoved TrinketType @field TrinketType1 TrinketType @field TrinketType2 TrinketType @field NumSmeltedTrinkets integer Helper function to temporarily remove a specific kind of trinket from the player. Use this in combination with the giveTrinketsBack
function to take away and give back a trinket on the same frame. This function correctly handles multiple trinket slots and ensures that all copies of the trinket are removed, including smelted trinkets. Note that one smelted golden trinket is the same as two smelted normal trinkets.
TemporarilyRemoveTrinkets()
Helper function to temporarily removes a player's held trinkets, if any. This will not remove any smelted trinkets. Use this in combination with the giveTrinketsBack
function to take away and give back trinkets on the same frame.
WillMysteriousPaperRevive()
Assuming that we are on the frame of fatal damage, this function returns whether or not Mysterious Paper would rotate to Missing Poster on the frame that the "Game Over" screen would appear (which would subsequently save the player from fatal damage). Mysterious Paper rotates between the 4 items on every frame, in order. The formula for whether Mysterious Paper be Missing Power is: gameFrameCount % 4 === 3
WillPlayerRevive()
The EntityPlayer.WillPlayerRevive
method does not properly account for Mysterious Paper, so use this helper function instead for more robust revival detection.
WillReviveFromHeartbreak()
Helper function to determine if the player will be revived by the Heartbreak collectible if they take fatal damage. This is contingent on the character that they are playing as and the amount of broken hearts that they already have.
WillReviveFromSpiritShackles()
Helper function to determine if the Spirit Shackles item is in an enabled state. (It can be either enabled or disabled.)
Last updated