Players
Overview
void
AddSmeltedTrinket(EntityPlayer
player, TrinketType
trinketId)
boolean
DoesAnyPlayerHasItem(CollectibleType
collectibleId, boolean?
ignoreModifiers = false)
boolean
DoesAnyPlayerHasTrinket(TrinketType
trinketId, boolean?
ignoreModifiers = false)
integer
GetBlackHeartsNum(EntityPlayer
player)
string
GetCharacterDeathAnimationName(PlayerType
character)
integer
GetCharacterMaxHeartContainers(PlayerType
character)
GetClosestPlayers(Vector
center, integer?
numberOfPlayers?)
integer
GetHearts(EntityPlayer
player)
GetPlayerByIndex(PlayerIndex
playerIndex)
GetPlayerFromEntity(Entity
entity)
void
GetPlayerHealthType(EntityPlayer
player, HealthType
healthType)
PlayerIndex
GetPlayerIndex(EntityPlayer
player, boolean?
differentiateSoulAndForgotten?)
InventoryObject[]
GetPlayerInventory(EntityPlayer
player, InventoryType
?
inventoryTypeFilter?)
void
integer
GetPlayers(boolean?
ignoreCoopBabies? = true)
GetPlayersByCollectible(CollectibleType
collectibleId)
GetPlayersByTrinket(TrinketType
trinketId)
GetPlayersOfType(PlayerType
playerType)
GetPlayersWithControllerIndex(integer
controllerIndex)
integer
GetSmeltedTrinketMultiplier(EntityPlayer
player, TrinketType
trinket)
integer
GetSoulHearts(EntityPlayer
player)
GetSubPlayerParent(EntityPlayer
subPlayer)
void
GiveTrinketsBack(EntityPlayer
player, TrinketSituation?
trinketSituation)
boolean
IsActiveTaintedLazForm(EntityPlayer
player)
boolean
IsBethany(EntityPlayer
player)
void
IsChildPlayer(EntityPlayer
player)
boolean
IsDamageToPlayerFatal(EntityPlayer
player, number
amount, EntityRef
source, integer?
lastDamageGameFrame)
boolean
IsJacobOrEsau(EntityPlayer
player)
boolean
IsKeeper(EntityPlayer
player)
boolean
IsTaintedLazarus(EntityPlayer
player)
boolean
IsTheLost(EntityPlayer
player)
void
PlayerHasCollectible(EntityPlayer
player, CollectibleType
...)
void
RegisterCharacterHealthConversion(PlayerType
playerType, ConversionHeartSubType
conversionHeartSubType)
void
RemoveCollectibleCostume(EntityPlayer
player, CollectibleType
collectible)
TrinketSituation?
TemporarilyRemoveTrinket(EntityPlayer
player, TrinketType
trinketType)
TrinketSituation?
boolean
boolean
WillPlayerRevive(EntityPlayer
player)
boolean
WillReviveFromHeartbreak(EntityPlayer
player)
boolean
Functions
AddSmeltedTrinket()
void AddSmeltedTrinket(
EntityPlayer
player,
TrinketType
trinketId)
Gives the player an smelted trinket without changing the player's current held trinkets.
DoesAnyPlayerHasItem()
boolean DoesAnyPlayerHasItem(
CollectibleType
collectibleId, boolean? ignoreModifiers = false)
Returns true if at least one player has the given item.
DoesAnyPlayerHasTrinket()
boolean DoesAnyPlayerHasTrinket(
TrinketType
trinketId, boolean? ignoreModifiers = false)
Returns true if at least one player has the given trinket.
GetBlackHeartsNum()
integer GetBlackHeartsNum(
EntityPlayer
player)
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()
string GetCharacterDeathAnimationName(
PlayerType
character)
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()
integer GetCharacterMaxHeartContainers(
PlayerType
character)
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()
EntityPlayer
[] GetClosestPlayers(
Vector
center, integer? numberOfPlayers?)
Returns the n closest players to a certain point. The players are ordered by their distance.
GetHearts()
integer GetHearts(
EntityPlayer
player)
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()
EntityPlayer
? GetPlayerByIndex(PlayerIndex playerIndex)
Returns a player given its index.
GetPlayerFromEntity()
EntityPlayer
? GetPlayerFromEntity(
Entity
entity)
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()
void GetPlayerHealthType(
EntityPlayer
player,
HealthType
healthType)
Helper function to get the amount of a given health type a player has.
GetPlayerIndex()
PlayerIndex GetPlayerIndex(
EntityPlayer
player, boolean? differentiateSoulAndForgotten?)
@class PlayerIndex : integer Returns a given player's index. Useful for storing unique data per player.
GetPlayerInventory()
InventoryObject[] GetPlayerInventory(
EntityPlayer
player,
InventoryType
? inventoryTypeFilter?)
@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()
void GetPlayerMaxHeartContainers(
EntityPlayer
player)
Helper function to get the max amount of heart containers a player can have.
GetPlayerNumHitsRemaining()
integer GetPlayerNumHitsRemaining(
EntityPlayer
player)
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()
EntityPlayer
[] GetPlayers(boolean? ignoreCoopBabies? = true)
Returns a list of all players.
GetPlayersByCollectible()
EntityPlayer
[] GetPlayersByCollectible(
CollectibleType
collectibleId)
Returns a list of all players that have a certain item
GetPlayersByTrinket()
EntityPlayer
[] GetPlayersByTrinket(
TrinketType
trinketId)
Returns all the players that have a certain trinket
GetPlayersOfType()
EntityPlayer
[] GetPlayersOfType(
PlayerType
playerType)
Returns all the players of a given type.
GetPlayersWithControllerIndex()
EntityPlayer
[] GetPlayersWithControllerIndex(integer controllerIndex)
Returns all the players corresponding to a controller index.
GetSmeltedTrinketMultiplier()
integer GetSmeltedTrinketMultiplier(
EntityPlayer
player,
TrinketType
trinket)
Returns the number of trinkets a player has smelted. Won't count the trinkets they're currently holding.
GetSoulHearts()
integer GetSoulHearts(
EntityPlayer
player)
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()
EntityPlayer
? GetSubPlayerParent(
EntityPlayer
subPlayer)
Helper function to get the parent of a given sub player.
GiveTrinketsBack()
void GiveTrinketsBack(
EntityPlayer
player, TrinketSituation? trinketSituation)
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()
boolean IsActiveTaintedLazForm(
EntityPlayer
player)
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()
boolean IsBethany(
EntityPlayer
player)
Helper function to check if a player is Bethany or T.Bethany.
IsChildPlayer()
void IsChildPlayer(
EntityPlayer
player)
Helper function to detect if a player is a "child player", meaning they have a defined Parent
field (i.e. Strawman players)
IsDamageToPlayerFatal()
boolean IsDamageToPlayerFatal(
EntityPlayer
player, number amount,
EntityRef
source, integer? lastDamageGameFrame)
Uses the player's current health and other miscellaneous things to determine if incoming damage will be fatal.
IsJacobOrEsau()
boolean IsJacobOrEsau(
EntityPlayer
player)
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()
boolean IsKeeper(
EntityPlayer
player)
Helper function to check if a player is either Keeper of T.Keeper.
IsTaintedLazarus()
boolean IsTaintedLazarus(
EntityPlayer
player)
Helper function to check if a player is any form of Tainted Lazarus.
IsTheLost()
boolean IsTheLost(
EntityPlayer
player)
Helper function to check if a player is The Lost or T.The Lost.
PlayerHasCollectible()
void PlayerHasCollectible(
EntityPlayer
player,
CollectibleType
...)
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()
void RegisterCharacterHealthConversion(
PlayerType
playerType,
ConversionHeartSubType
conversionHeartSubType)
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()
void RemoveCollectibleCostume(
EntityPlayer
player,
CollectibleType
collectible)
Removes a costume from the provided player.
TemporarilyRemoveTrinket()
TrinketSituation? TemporarilyRemoveTrinket(
EntityPlayer
player,
TrinketType
trinketType)
@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()
TrinketSituation? TemporarilyRemoveTrinkets(
EntityPlayer
player)
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()
boolean WillMysteriousPaperRevive(
EntityPlayer
player)
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()
boolean WillPlayerRevive(
EntityPlayer
player)
The EntityPlayer.WillPlayerRevive
method does not properly account for Mysterious Paper, so use this helper function instead for more robust revival detection.
WillReviveFromHeartbreak()
boolean WillReviveFromHeartbreak(
EntityPlayer
player)
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()
boolean WillReviveFromSpiritShackles(
EntityPlayer
player)
Helper function to determine if the Spirit Shackles item is in an enabled state. (It can be either enabled or disabled.)
Last updated