Of course I wouldn't call you a noob, you're just a modder in trainingK, thanks againCode:test
I dont wanna use setmatch, ill be sure to ask you for modding support next time,
your one of thoose people that dont call other noobs when they dont know
Yes, this it possible. Instead of applying an 'effect' you'll just have to call the 'Item.NewItem' method.
Exactly like I said, just spawn a new item using Item.NewItemand how am i go around doing that
i am trying to replace/copy the example sword,s fire effect with droping a item with like a 1 of 10 chance per hit
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
// Your Item.NewItem code.
}
Exactly like I said, just spawn a new item using Item.NewItem
Code:public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { // Your Item.NewItem code. }
Allright no probs, let me spell it out plain for you:yeah as u know i got close to non info on how to put these things togetter as i got nothing to look at for info
i did look up on some c+ codeing but that did not really help me in terraria but just as the setup itselv
the c+ i was watching did not talk of the hooks and stuff there is only for tmodloader so got not much help there
that so called code i add there i got no idea how it looks
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
Item.NewItem(target.position.X, target.position.Y, target.width, target.height, mod.ItemType("YourItem"));
base.OnHitNPC(player, target, damage, knockback, crit);
}
Allright no probs, let me spell it out plain for you:
I can't make it any easier than this for youCode:public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { Item.NewItem(target.position.X, target.position.Y, target.width, target.height, mod.ItemType("YourItem")); base.OnHitNPC(player, target, damage, knockback, crit); }
This is all you have to do IF all you want to do is drop an item when you hit an NPC, yeah...so all the target position,width,damage,knockback and player
do i leave em as they are and it will work or do i have to do something with em?
Of course, that's my bad. You'll have to cast the position coordinates as integers, so:public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
if (Main.rand.Next(3) == 0)
{
target.AddBuff(BuffID.OnFire, 200);
}
if (Main.rand.Next(10) == 0)
{
target.AddBuff(BuffID.OnFire, 2000);
}
if (Main.rand.Next(2) == 0)
{
Item.NewItem(target.position.X, target.position.Y, target.width, target.height, mod.ItemType("ExampleWorkbench"));
base.OnHitNPC(player, target, damage, knockback, crit);
}
}
so this is how it looks but i get this on loading it
overload "Terraria.Item.NewItem(int, int, int, int, int, int, bool, int, bool, bool,)" invalid arguments
Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, mod.ItemType("ExampleWorkbench"));
Of course, that's my bad. You'll have to cast the position coordinates as integers, so:
Code:Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, mod.ItemType("ExampleWorkbench"));
Of course, that's my bad. You'll have to cast the position coordinates as integers, so:
Code:Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, mod.ItemType("ExampleWorkbench"));
You know how to use ItemID? Just use ItemID.CopperCoin instead of the mod.ItemType part.i can drop a mod item now but how can i tell it to drop like a coppercoin
You know how to use ItemID? Just use ItemID.CopperCoin instead of the mod.ItemType part.
... I just gave you the name... ItemID.CopperCoin...down side is i dont know the name IDs for items just there number IDs
as name IDs cant use spaces
Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, ItemID.CopperCoin);
... I just gave you the name... ItemID.CopperCoin...
Just change it to:
And note that when using ItemID/ProjectileID/TileID or ANY of the sorts, you'll need 'using Terraria.ID;' at the top of your code.Code:Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, ItemID.CopperCoin);
Take a look at this page.what i ment with name IDs i mean the rest of the items in the game
This is just a really quick one, but you can use Dust.NewDust:How do you add particles when you move and you have the armor set with
the public virtual void UpdateVanitySet ?
Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 14, 0f, 0f, 200, default(Color), 1.2f);
Take a look at this page.
This is just a really quick one, but you can use Dust.NewDust:
Code:Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 14, 0f, 0f, 200, default(Color), 1.2f);