tModLoader Official tModLoader Help Thread

Doesn't seem to work :/
I also got this error.Turns out the the public class name wasn't the same as the one on the corresponding .png image.Have you checked if the public class name is also HammerSword?

PS: Sorry if I sound dumb.I'm fairly new to this coding business.
 
Ah, I see, and things without a direction like fall damage or lava have a hitDirection of 0. Thanks :D

Cheers, that helped point me in the right direction :) The tricky bit is that it looks like it splits no-npc and no-projectile damage into Fall Damage, Drowning, Lava Damage, {???}, {misc. like hammering Demon Altar}, {death while petrified?}, so we'd have to figure out how to distinguish between those.

Looks like I could maybe duplicate the functionality if I recreate "else if (((this.gravDir == 1f && {fall_dist} > {max_fall_dist}) || (this.gravDir == -1f && {fall_dist} < -{max_fall_dist})) && !this.noFallDmg && !{has_wings})".

I could possibly skim off of the fall-damage death messages, but it'd cause the problem of not working with a translation that I don't include (e.g. a fan-translation or an update that has bounce messages besides " fell to their death."," didn't bounce."," stuerzte in den Tod."," ist nicht gesprungen."," sente la sua morte."," non poteva rimbalzare."," a cassé sa pipe."," ne bouge plus."," le ha llegado la hora."," no saltó a tiempo.")

I'll figure something out. Thanks :D
How do I make custom weapons drop from bosses or enemies?
 
I don`t understand what`s wrong, trying to make start custom items.

http://hastebin.com/ozaqabeveq.avrasm

upload_2016-9-5_23-5-35.png
 
I don't know what you're saying...
Have a look at the exampleMod GlobalNPC class it is always useful to check the examples :)
[doublepost=1473110210,1473110051][/doublepost]
I don`t understand, can you put me an example?
The correct code would be:
Code:
using Terraria.ID;
using Terraria.ModLoader;
namespace XtrafaMod.Items
{
public class MyPlayer : ModPlayer
{
       public override void SetupStartInventory(IList<Item> items)
        {
            Item item5 = new Item();
            item5.SetDefaults(mod.ItemType("TerraEsence"));   //this is an example of how to add your moded item
            item5.stack = 15;         //this is the stack of the item
            items.Add(item5);
  
            Item item6 = new Item();
            item6.SetDefaults(ItemID.Wood);       //this is an example of how to add a vanilla terraria item
            item6.stack = 50;           //and the stack of the item
            items.Add(item6);
        }
}

When starting with modding I higly suggest to use an IDE as Visual Studio to prevent errors of this kind :)
 
Have a look at the exampleMod GlobalNPC class it is always useful to check the examples :)
[doublepost=1473110210,1473110051][/doublepost]
The correct code would be:
Code:
using Terraria.ID;
using Terraria.ModLoader;
namespace XtrafaMod.Items
{
public class MyPlayer : ModPlayer
{
       public override void SetupStartInventory(IList<Item> items)
        {
            Item item5 = new Item();
            item5.SetDefaults(mod.ItemType("TerraEsence"));   //this is an example of how to add your moded item
            item5.stack = 15;         //this is the stack of the item
            items.Add(item5);
  
            Item item6 = new Item();
            item6.SetDefaults(ItemID.Wood);       //this is an example of how to add a vanilla terraria item
            item6.stack = 50;           //and the stack of the item
            items.Add(item6);
        }
}

Oh! I see, so much thx m8
 
Have a look at the exampleMod GlobalNPC class it is always useful to check the examples :)
[doublepost=1473110210,1473110051][/doublepost]
The correct code would be:
Code:
using Terraria.ID;
using Terraria.ModLoader;
namespace XtrafaMod.Items
{
public class MyPlayer : ModPlayer
{
       public override void SetupStartInventory(IList<Item> items)
        {
            Item item5 = new Item();
            item5.SetDefaults(mod.ItemType("TerraEsence"));   //this is an example of how to add your moded item
            item5.stack = 15;         //this is the stack of the item
            items.Add(item5);
 
            Item item6 = new Item();
            item6.SetDefaults(ItemID.Wood);       //this is an example of how to add a vanilla terraria item
            item6.stack = 50;           //and the stack of the item
            items.Add(item6);
        }
}

When starting with modding I higly suggest to use an IDE as Visual Studio to prevent errors of this kind :)
Can I have a code example for making a custom sword drop from a boss (Skeletron Prime)
 
Does it work for normal mode skeletron prime?
Yes, of course it does. The !Main.expertMode states that the item will be dropped only in normal mode since in expert it drops the boss bag where you'll have to add the item to the bag
 
Ok thanks! :D
[doublepost=1473111684,1473111652][/doublepost]
Yes, of course it does. The !Main.expertMode states that the item will be dropped only in normal mode since in expert it drops the boss bag where you'll have to add the item to the bag
Also 1 more thing how do I change the drop chance of the item?
 
you can insert in the "if" a Main.rand.Next(int MinValue, int MaxValue) and check the value of that to add drop chance
 
It show me another error :p

http://hastebin.com/emuweqewaw.coffee

(logs)

c:\Users\MiHP\Documents\My Games\Terraria\ModLoader\Mod Sources\XtrafaMod\MyPlayer.cs(7,55) : error CS0246: No se puede encontrar el tipo o el nombre de espacio de nombres 'Item' (¿falta una directiva using o una referencia de ensamblado?)

c:\Users\MiHP\Documents\My Games\Terraria\ModLoader\Mod Sources\XtrafaMod\MyPlayer.cs(7,49) : error CS0246: No se puede encontrar el tipo o el nombre de espacio de nombres 'IList' (¿falta una directiva using o una referencia de ensamblado?)
 
Back
Top Bottom