Questions Regarding the NPC Limit

In Terraria, the max amount of NPCs can have is 200. However, since NPCs are indexed starting from 0, is index 200 bugged out or something?

Usually this spot is filled out by a supposed “slime” that doesn’t exist in the server, so perhaps it might actually be a weird buggy designation.

Why do Queen Bees fill NPC slots in a descending order starting from 199?
(I’ve only tested this in PvE so far)


Actually the NPC limit is 201. Idrc what the NPC index 200 is for but I suspect it’s similar to Item index 400. Item index 400 is used by the client to signal the server to spawn a new item and assign an index to it. However in this case, the client can’t signal the server to spawn NPC so idrc.

The slime there is because King Slime’s and Queen Slime’s AI is bugged. The method KS and QS uses to spawn slimes is NPC.NewNPC, which returns an NPC index >= 0 and < 200 if it successfully spawns an NPC, if it doesn’t, it returns 200. The bug here is that KS and QS don’t check if the NPC index returned is 200, and spawns a slime there anyway


Huh, I always thought the magic number was 200. I’m pretty sure if you modify spawnrate to the max, you can only get a maximum of 200 NPCs in the server at any given moment. (I’ve done this before a long time ago though I don’t really remember how many NPCs were exactly on screen.) Besides, it’s quite odd that the NPC limit is an odd number.