tModLoader Overwriting Vanilla NPC Names?

truvulture

Terrarian
Hello everyone, I'm trying to create a mod that changes a few item and NPC names, but I can't seem to find a function to do so. I've been combing through the documentation and old forum posts with no luck. Any help would be greatly appreciated!

C#:
public class customNpcName : GlobalNPC
{
    public override void SetDefaults(NPC npc)
    {
        if (npc.type == NPCID.RainbowSlime)
        {
             npc.name = "insert name here";
             //the problem is '.name' isn't a function of npc, and I can't find a function that changes display names.
        }
    }
}
 
Hello everyone, I'm trying to create a mod that changes a few item and NPC names, but I can't seem to find a function to do so. I've been combing through the documentation and old forum posts with no luck. Any help would be greatly appreciated!

C#:
public class customNpcName : GlobalNPC
{
    public override void SetDefaults(NPC npc)
    {
        if (npc.type == NPCID.RainbowSlime)
        {
             npc.name = "insert name here";
             //the problem is '.name' isn't a function of npc, and I can't find a function that changes display names.
        }
    }
}
NEVER browse old forum posts. Now you set these names in SetStaticDefaults (look ExampleMod)
 
Thank you for the reply! Unfortunately, I've already tried this :/. SetStaticDefaults isn't a function of GlobalNPCs, only a function of ModNPCs. I did try to use it anyway, but it didn't work. I rechecked ExampleMod (thank you for the suggestion) and couldn't find any GlobalNPCs with names changed. I am aware that in regards to ModNPCs, changing the display name through SetDefaults has been depreciated. Thank you for your time. :)
 
Back
Top Bottom