Spawn Collectible
Functions
Section titled “Functions”spawnCollectible()
Section titled “spawnCollectible()”spawnCollectible(
collectibleType,positionOrGridIndex,seedOrRNG,options?,forceFreeItem?,spawner?):EntityPickupCollectible
Defined in: packages/isaacscript-common/src/functions/spawnCollectible.ts:39
Helper function to spawn a collectible.
Use this instead of the Game.Spawn method because it handles the cases of Tainted Keeper
collectibles costing coins and prevents quest items from being rotated by Tainted Isaac’s
rotation mechanic.
If you want to spawn an unseeded collectible, you must explicitly pass undefined to the
seedOrRNG parameter.
Parameters
Section titled “Parameters”collectibleType
Section titled “collectibleType”CollectibleType
The collectible type to spawn.
positionOrGridIndex
Section titled “positionOrGridIndex”int | Vector
The position or grid index to spawn the collectible at.
seedOrRNG
Section titled “seedOrRNG”RNG | Seed | undefined
The Seed or RNG object to use. If an RNG object is provided, the
RNG.Next method will be called. If undefined is provided, it will default to
a random seed.
options?
Section titled “options?”boolean = false
Optional. Set to true to make the collectible a “There’s Options” style collectible. Default is false.
forceFreeItem?
Section titled “forceFreeItem?”boolean = false
Optional. Set to true to disable the logic that gives the item a price for Tainted Keeper. Default is false.
spawner?
Section titled “spawner?”Entity
Optional.
Returns
Section titled “Returns”EntityPickupCollectible
spawnCollectibleFromPool()
Section titled “spawnCollectibleFromPool()”spawnCollectibleFromPool(
itemPoolType,positionOrGridIndex,seedOrRNG,options?,forceFreeItem?,spawner?):EntityPickupCollectible
Defined in: packages/isaacscript-common/src/functions/spawnCollectible.ts:110
Helper function to spawn a collectible from a specific item pool.
Use this instead of the Game.Spawn method because it handles the cases of Tainted Keeper
collectibles costing coins and prevents quest items from being rotated by Tainted Isaac’s
rotation mechanic.
If you want to spawn an unseeded collectible, you must explicitly pass undefined to the
seedOrRNG parameter.
In order to use this function, you must upgrade your mod with ISCFeature.SPAWN_COLLECTIBLE.
Parameters
Section titled “Parameters”itemPoolType
Section titled “itemPoolType”ItemPoolType
The item pool to draw the collectible type from.
positionOrGridIndex
Section titled “positionOrGridIndex”int | Vector
The position or grid index to spawn the collectible at.
seedOrRNG
Section titled “seedOrRNG”RNG | Seed | undefined
The Seed or RNG object to use. If an RNG object is provided, the
RNG.Next method will be called. If undefined is provided, it will default to
a random seed.
options?
Section titled “options?”boolean = false
Optional. Set to true to make the collectible a “There’s Options” style collectible. Default is false.
forceFreeItem?
Section titled “forceFreeItem?”boolean = false
Optional. Set to true to disable the logic that gives the item a price for Tainted Keeper. Default is false.
spawner?
Section titled “spawner?”Entity
Optional.
Returns
Section titled “Returns”EntityPickupCollectible
spawnEmptyCollectible()
Section titled “spawnEmptyCollectible()”spawnEmptyCollectible(
positionOrGridIndex,seedOrRNG):EntityPickup
Defined in: packages/isaacscript-common/src/functions/spawnCollectible.ts:149
Helper function to spawn an empty collectible. Doing this is tricky since spawning a collectible
with CollectibleType.NULL will result in spawning a collectible with a random type from the
current room’s item pool.
Instead, this function arbitrarily spawns a collectible with CollectibleType.BROKEN_SHOVEL_1,
and then converts it to an empty pedestal afterward. (Broken Shovel is used instead of e.g. Sad
Onion because it is a quest collectible and quest collectibles will prevent Damocles from
duplicating the pedestal.)
If you want to spawn an unseeded collectible, you must explicitly pass undefined to the
seedOrRNG parameter.
Parameters
Section titled “Parameters”positionOrGridIndex
Section titled “positionOrGridIndex”int | Vector
The position or grid index to spawn the empty collectible at.
seedOrRNG
Section titled “seedOrRNG”RNG | Seed | undefined
The Seed or RNG object to use. If an RNG object is provided, the
RNG.Next method will be called. If undefined is provided, it will default to
a random seed.
Returns
Section titled “Returns”EntityPickup
