Standalone [1.3] tModLoader - A Modding API

I am trying to make a gun that turns any bullet into a custom shot, not just musket balls, and I tried
Code:
 public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref int knockback)
{
            if (type == ProjectileID.Bullet)
            {
                type = mod.ProjectileType("Blast");
            }
            return true;
}

but there was an error that said
'no suitable method found to override'
and referred to the first line of code above

help pls
 
can someone pls show/give me the codes needed to make my accesory like cobalt shield and medicated bandage? I dont know how to get the codes by myself
 
I am trying to make a gun that turns any bullet into a custom shot, not just musket balls, and I tried
Code:
 public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref int knockback)
{
            if (type == ProjectileID.Bullet)
            {
                type = mod.ProjectileType("Blast");
            }
            return true;
}

but there was an error that said
'no suitable method found to override'
and referred to the first line of code above

help pls
Knock back is a float
 
To backup the "vanilla Terraria.exe," do you just only copy Terraria.exe to a backup folder? Or everything in Terraria's Steam folder?
 
To backup the "vanilla Terraria.exe," do you just only copy Terraria.exe to a backup folder? Or everything in Terraria's Steam folder?
Just the exe. You can just keep it in the same folder if you like.
 
how do you update tmod loader. please help. im not familiar with this.
 
You redownload the file in subject post (here so) then you replace just file.
 
In my experience, Main.NewText itself should be called on the server (same as when the server displays the chat input of every player).
So if this is never called on the server, my guess is that it never reaches the server(?).
Calling Main.NewText on a server only won't have any effect because the server has no chat to output to, only the console lines. There are ways to output to the chat from a server: use a NetMessage. I tried the following in the AI of a projectile:
NetMessage.SendData(25, -1, -1, "AI", 255, 175f, 75f, 199f, 0, 0, 0);
And the text "AI" was correctly output to the chat, but the same line in several item hooks had no effect whatsoever. I even downloaded an older version of my mod that I know was working, and now one item that is dependant on useItem being called on the server no longer works.

There may be a workaround for this, but it's annoying if this is just the way that tModLoader works now.

EDIT: Ok, after some rebuilding and connecting to my server from another PC, these hooks have inexplicably started working as normal again. No idea how, but I'm not complaining.
 
Last edited:
how can i make a Boss or mob drop a random amount of an item?? (10-15)
 
ExampleMod => NPCs => ExampleGlobalNPC => public override void NPCLoot(NPC npc) =>
Code:
            if (npc.type == NPCID.DukeFishron && !Main.expertMode)
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bubble"), Main.rand.Next(5, 8));
            }
 
Last edited:
does that drop 5 to 8 items??
 
This is 5-7, here.
 
also, how do i make custom gloves?? is there something in the example mod??
 
also, how do i make custom gloves?? is there something in the example mod??

is there something in the example mod?? You can check alone for that, no? ^^' The answer is no, but seriously, this is a stupid question, here.

You take that:
Code:
        public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
        {
            equips.Add(EquipType.HandsOn);
            return true;
        }
With the ExampleShield code and use the ExampleBreastplate_Arms for sprite in game. (Like this is not a arms but a HandsOn, you namesprite finish with _HandsOn, not _Arms.

And, you can go for finish alone, if no, just read my answer.
 
hmmm... for some reason both gloves are infront of my face... how can i fix this?
 
You have use the same sprite?



Here:
 

Attachments

  • ExampleBreastplate_Arms.png
    ExampleBreastplate_Arms.png
    1.5 KB · Views: 205
i want the glove on both arms, so i used the ExampleBreastplate body sprite to put the gloves on both hands... is that the thing i did wrong??
 
For that: You need add HandsOff
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
equips.Add(EquipType.HandsOn);
equips.Add(EquipType.HandsOff);
return true;
}
You can use that per example:
 

Attachments

  • Acc_HandsOn_2.png
    Acc_HandsOn_2.png
    1.1 KB · Views: 213
  • Acc_HandsOff_2.png
    Acc_HandsOff_2.png
    867 bytes · Views: 210
Back
Top Bottom