You take the earlier code, check in which zone the player is and apply a debuff:Ok i understand it now, but how do i apply a OnHitNPC effect to a specific zone like - im in the snow biome and i give frostburn to my enemys
public class MyModPlayer : ModPlayer // <- Deriving.
{
public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit) // <- Overriding.
{
// Tadaaaa, we're hitting an NPC.
if(player.ZoneSnow)
{
target.AddBuff(BuffID.Frostburn, 300);
}
}
}
Those are quite some questions...I only need to know a few more things, how to make a custom town NPC attack things with a modded sword, and how to make it move in when a certain boss has been defeated.
How to make custom ore shine when a spelunker potion is used and how to make my modded enemies shine when a hunter potion is used.
Making a list of them all would be boring and not funIf you are using Visual Studio when you type player. (bunch of stuff should come up in a dropdown thingy) so just choose what you need
No, as far as I know not.is it possible to add OnHitNPC thingy to an accessory?
Indeed. Detecting the accessory is actually not all that hard. On your ModPlayer create a boolean:I would have to make a ModPlayer class with it somehow detecting if the accessory is equiped and giving a buff as you said about the zones and stuff?
public bool myAccessoryEquipped;
public override void ResetEffects()
{
this.myAccessoryEquipped = false;
}
// Inside the UpdateAccessory method:
player.GetModPlayer<MyModPlayer>(mod).myAccessoryEquipped = true;
Your question has been answered.Please can someone answer my question
When you have (for example) Visual Studio installed, you can add references to certain libraries/dll's/exe's.how would you use Intellisense to get the list
player.
public bool myAccessoryEquipped; public override void ResetEffects() { this.myAccessoryEquipped = false; }
i want to create the Modplayer with - If accessory equiped - OnHitNPC if player.zonesnow do frostburnIndeed. Detecting the accessory is actually not all that hard. On your ModPlayer create a boolean:
Then over at your accessory, you can do:Code:public bool myAccessoryEquipped; public override void ResetEffects() { this.myAccessoryEquipped = false; }
And then you can use that boolean in the player.Code:// Inside the UpdateAccessory method: player.GetModPlayer<MyModPlayer>(mod).myAccessoryEquipped = true;
And is there something you need specific help with?i want to create the Modplayer with - If accessory equiped - OnHitNPC if player.zonesnow do frostburn
idk how to do the if my mod accessory is equiped partAnd is there something you need specific help with?
idk how to do the if my mod accessory is equiped part
public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit)
{
if(this.myAccessoryEquipped)
{
// Add a buff to the target NPC.
}
}