Pickup Index Creation
Hierarchy
-
Feature
↳
PickupIndexCreation
Methods
getPickupIndex
▸ getPickupIndex(pickup
): PickupIndex
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
Name | Type |
---|---|
pickup | EntityPickup |
Returns
Defined in
packages/isaacscript-common/src/classes/features/other/PickupIndexCreation.ts:262