GrismarPicklemelt
Terrarian
I'm trying to create a weapon with a lifesteal effect, but no matter what I do I usually get this error:
c:\Users\******************\Documents\My Games\Terraria\ModLoader\Mod Sources\GrisGuns\Items\Shotbun.cs(54,23) : error CS0115: 'GrisGuns.Items.Shotbun.DamageNPC(Terraria.Player, Terraria.NPC, int, ref int, ref float, ref bool, ref float)': no suitable method found to override
I apologize if this is a simple problem but I'm still new to this so I don't know how to fix this.
The code I used is here:
public override void DamageNPC(Player p, NPC npc, int hitDir, ref int damage, ref float knockback, ref bool crit, ref float critMult)
{
p.statLife += (int)damage/6; //You will gain health based on damage divided by 6. Change this to whatever you want
p.HealEffect((int)(damage/6));
}
I have used multiple variations of this code and none with success.
c:\Users\******************\Documents\My Games\Terraria\ModLoader\Mod Sources\GrisGuns\Items\Shotbun.cs(54,23) : error CS0115: 'GrisGuns.Items.Shotbun.DamageNPC(Terraria.Player, Terraria.NPC, int, ref int, ref float, ref bool, ref float)': no suitable method found to override
I apologize if this is a simple problem but I'm still new to this so I don't know how to fix this.
The code I used is here:
public override void DamageNPC(Player p, NPC npc, int hitDir, ref int damage, ref float knockback, ref bool crit, ref float critMult)
{
p.statLife += (int)damage/6; //You will gain health based on damage divided by 6. Change this to whatever you want
p.HealEffect((int)(damage/6));
}
I have used multiple variations of this code and none with success.