How do i make it so when me projectile hits a NPC it gives the NPC the cursed flame debuff?

If the item uses a custom projectile, you can input this into the projectile's code and it should work.

public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(39, 60, true);
//39 is the buff ID for Cursed Inferno
//The 60 is how long the buff will be applied in ticks. There's 60 ticks per second.
}

Or, if a full example is wanted:

using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Modname.folder.stuff //Just the general namespace
{
public class ExampleProjectile : ModProjectile
{
public override void SetDefaults()
{
//The projectile defaults and stuff
}

public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(39, 60, true);
//39 is the buff ID for Cursed Inferno
//The 60 is how long the buff will be applied in ticks. There's 60 ticks per second.
}
}
}

It's probably possible (and probably better) through the item's code, but I don't know how.
 
Back
Top Bottom