Pickup Index Creation
Classes
Section titled “Classes”PickupIndexCreation
Section titled “PickupIndexCreation”Defined in: packages/isaacscript-common/src/classes/features/other/PickupIndexCreation.ts:46
Extends
Section titled “Extends”Feature
Methods
Section titled “Methods”getPickupIndex()
Section titled “getPickupIndex()”getPickupIndex(
pickup):PickupIndex
Defined in: packages/isaacscript-common/src/classes/features/other/PickupIndexCreation.ts:260
Mods often have to track variables relating to a pickups. Finding an index for these kinds of
data structures is difficult, since pickups are respawned every time a player re-enters a room,
so the PtrHash will change.
Use this function to get a unique index for a pickup to use in these data structures.
Specifically, PickupIndex is a number that represents the spawn order of the pickup on the
current run. For example, the first pickup spawned will have an index of 1, the second one will
have an index of 2, and so on.
Tracking pickups requires stateful tracking, so using pickup indexes requires an upgraded mod.
Note that the pickup index will not change:
- When a pickup is rolled with e.g. D6 or D20.
- When an item is “rotated” via e.g. Tainted Isaac’s mechanic.
In order to use this function, you must upgrade your mod with
ISCFeature.PICKUP_INDEX_CREATION.
Parameters
Section titled “Parameters”pickup
Section titled “pickup”EntityPickup
