No. It's absolutely NOT the same as pNPCs uid.S1eth wrote: Is this the same as the pNPC's "uid"?
Basically, in SMBX, all enemies are kept in an array. The "index" is the position in that array that the enemy is found.
The problem is that when enemies are killed, they're removed from the array, and arrays can't have gaps, so unless the enemy is last in the array, a bunch of NPCs will then change their index.
What pNPC does is assign each NPC with a persistent UID (Unique Identifier), which is ONLY used for identifying the NPC, not for accessing the array. This allows you to find NPCs even if they change position in the array, as you can pick it out with the UID (since the UID never changes over the lifetime of the NPC).
What you'll want to do is find the NPC at the array index, which you can do using:
Code: Select all
local myNPC = NPC(index)