PlayerTracker

Common methods for tracking multiple players.

Summary

Type
Function

Iterator

EntityPlayer IterPlayers()

Iterator

EntityPlayer IterPlayersWithCollectible(

CollectibleType collectible, boolean? ignoreModifiers = false)

Function

string GetPlayerIndex(player)

Function

EntityPlayer[] GetPlayers()

Function

boolean HasTwin(PlayerType playerType)

Function

EntityPlayer[] GetPlayersWithCollectible(

CollectibleType collectible, boolean? ignoreModifiers = false)

Iterators

IterPlayers()

EntityPlayer IterPlayers()

Returns an EntityPlayer on each iteration.

Example
local PlayerTracker = IsaacHelper.GetModule("PlayerTracker")

for player in PlayerTracker.IterPlayers() do
    player:AnimateHappy() -- Makes them do a thumbs up
end

IterPlayersWithCollectible()

EntityPlayer IterPlayersWithCollectible(CollectibleType collectible, boolean? ignoreModifiers)

Returns an EntityPlayer that has the specified collectible on each iteration.

Methods

GetPlayerIndex()

string GetPlayerIndex(EntityPlayer player)

Returns a string that can be used to identify the player. Each player has a unique string that stays consistent throughout the run. No two players can have the same string.

GetPlayers()

EntityPlayer[] GetPlayers()

Returns an array with every player.

HasTwin()

boolean HasTwin(PlayerType playerType)

Checks if a player has a twin and returns true if they do. See here for a list of characters and their twins.

GetPlayersWithCollectible()

EntityPlayer[] GetPlayersWithCollectible(CollectibleType collectible, boolean? ignoreModifiers)

Returns an array with every player that has a specified collectible. If no players have the collectible, the array will be empty. See here for more information about the ignoreModifiers argument.

Example
local PlayerTracker = IsaacHelper.GetModule("PlayerTracker")

local PlayersWithCollectible = PlayerTracker.GetPlayersWithCollectible(CollectibleType.COLLECTIBLE_SAD_ONION)
if #PlayersWithCollectible == 0 then
    print("Nobody has a Sad Onion. This make Sad Onion even sadder.")
end

Last updated