• For issues you find with the Switch and Console releases, please follow this link and give as much detail as possible. This is the speediest way to get info to Pipeworks and get a hotfix in the works.
  • For issues you find with the Mobile 1.3 update, please follow this link and give as much detail as possible. This is the speediest way to get info to DR Studios to look at your issue. Also, some troubleshooting hints here.

tModLoader Can modify vanilla content with TModloader?

megagoldgolem

Terrarian
Hello anyone, i have a question: Can i modify vanilla content (like npc ai, damage, defence, projectile, etc. of items, etc) With TModloader?
Please, if you have an answer, write it here.
(Sorry for bad english, i'm don't know it very well.)
 

Kazzymodus

Moderator
Staff member
Moderator
Yes, you can. :)

To edit vanilla content, you need to implement several specific classes (the "Global " classes). There, you can change any vanilla projectile, item or NPC.
 
Last edited:

megagoldgolem

Terrarian
Yes, you can.

To edit vanilla content, you need to implement several specific classes (the "Global " classes). There, you can change any vanilla projectile, item or NPC.
Thank you very much, but sorry, can you write here an example of it? I am new at modding
 

Kazzymodus

Moderator
Staff member
Moderator
Thank you very much, but sorry, can you write here an example of it? I am new at modding
C#:
public class StrongerSlime : GlobalNPC
{
    public override void ModifyHitPlayer(NPC npc, Player target, ref int damage, ref bool crit)
    {
        if (npc.type == NPCID.GreenSlime)
        {
            damage *= 2;
        }
    }
}
Here's a simple example. This code doubles the hit damage whenever the player is attacked by a Green Slime. This is but one example, there are many ways to change vanilla behaviour, some more difficult than others.
 
Top Bottom