Standalone [1.3] tModLoader - A Modding API

Code:
test
K, thanks again
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 ;)
 
Code:
test
K, thanks again
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 ;)
Of course I wouldn't call you a noob, you're just a modder in training :p
If you ever were to go back to 'round page 100 of this thread, you'll see me asking questions like a maniac.
If you want to know something, try looking around if you can find the answer first. If not, ASK QUESTIONS! ;)
 
Yes, this it possible. Instead of applying an 'effect' you'll just have to call the 'Item.NewItem' method.

and 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
 
and 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
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.
}
 
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.
}

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
 
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
Allright no probs, let me spell it out plain for you:
Code:
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);
}
I can't make it any easier than this for you ;)
 
Allright no probs, let me spell it out plain for you:
Code:
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);
}
I can't make it any easier than this for you ;)

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?
 
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
 
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
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"));

that worked i got 7 ExampleWorkbench,s of a green slime 14 health with 1 damage per swing and fire damage
 
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"));

i can drop a mod item now but how can i tell it to drop like a coppercoin
 
down side is i dont know the name IDs for items just there number IDs

as name IDs cant use spaces
... I just gave you the name... ItemID.CopperCoin...
Just change it to:
Code:
Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, ItemID.CopperCoin);
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.
 
... I just gave you the name... ItemID.CopperCoin...
Just change it to:
Code:
Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, ItemID.CopperCoin);
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.

what i ment with name IDs i mean the rest of the items in the game
 
Hello guys! I have a problem. I setuped tModloadder and my fps in game became smaller. But most interesting. When my inventory open, my fps is normal (60), when inventory close fps is low(20-30). How solve this problem. I have steam version game.
P.S sorry for my english:)
 
How do you add particles when you move and you have the armor set with
the public virtual void UpdateVanitySet ?
 
what i ment with name IDs i mean the rest of the items in the game
Take a look at this page.
How do you add particles when you move and you have the armor set with
the public virtual void UpdateVanitySet ?
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);
 
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);

thx for the page

i found something funky the way i made it

i tryed to make the example sword 10 times longer but then it wont swing right

useing shortsword style works for the long sword but its hitbox is funky right below and above the player going 10 blocks up and down but somewhat good hitbox out the sword itselv just blocks like grass gets cut way off hitbox 10 blocks up and down from both tip and player of the sword

and the dust the example sword spawns up in sky and down in ground where the full texture box is
 
Back
Top Bottom