I need little help with code.

Status
Not open for further replies.
Hi terrarians!
My little sister ask me for make simple Cheat Mod that makes The Eternial Crystal from Old One's Army Unbreakable...
I know this is stupid, but if she ask i do.
Okay, time to talk about problem.

There is a code:

Code:
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace UnbreakableCrystal
{
    public class UnbreakableCrystalNPCs : GlobalNPC
    {

        public override bool InstancePerEntity
        {
            get
            {
                return true;
            }
        }

        public override void SetDefaults(NPC npc)
        {
            if (npc.type == NPCID.DD2EterniaCrystal)
            {
                npc.dontTakeDamageFromHostiles = true;
            }
        }
    }
}

I'm not a programmer. I use information from tModLoader wiki and examples.
What is problem? This code not working.
I try make Crystal Immortal, try add more HP, try add more Defense. In game nothing changes. BUT....
If i change (npc.type == NPCID.DD2EterniaCrystal) to (npc.friendly) this code perfectly working and makes all town Npc's dont take damage from mobs.

What i do wrong or what wrong with code?
Thanks for attention. Have a nice day :)
 
Status
Not open for further replies.
Back
Top Bottom