ID:164284
 
Is it possible to code it (without having to list every single NPC name) so NPC names cannot be created?
You could loop through the NPCs when someone is creating a character, but it's going to be more work for the game then making a list. You could create the list at runtime (and add to it if you happen to be adding NPCs mid-session). Just make all of your uniquely named NPCs a different subtype for easy access.
If you are trying to make it so a player cannot name themselves a monsters name, use this:

for(mob/M in world)
if(M.name == usr.name)
usr << "You can't choose that name! It's already taken!"


Put that in a name-choosing proc.
The best way to solve your issue would be to change your NPC names rather than the player names. Your NPC names could have a suffix of "(NPC)" behind it. That way, players know those are NPCs.

All you have to do to prevent players from faking as NPCs is to reject them having "(NPC)" as a suffix to their name! It's the easiest and most efficient solution around.

-- Data
Whenever a mob is created, add its name to a list. Whenever a player creates a character, don't allow any name that's in that list. Also, you might as well add player's names to that list as well (and save the list, too).