tModLoader Drop Your Weapon!

Lavendarjosh

Eye of Cthulhu
iFr4ZaT.png


Now with complete German translation! / Jetzt mit vollständiger deutscher Übersetzung!

Hello and welcome to my latest creation: Drop Your Weapon!

So what does this mod do?

It lets you loot your enemy's weapons. There aren't actually that many enemies in Terraria that use weapons, but didn't you sometimes wish Goblin Archers dropped their bow for you to use? Now they do!

It also makes the weapons the Town NPCs use purchasable from the respective vendor, with the exception of the Classy Cane which is sold by the Clothier and the Ale Tosser which is sold by the Mechanic.

The mod is available on the Mod Browser.

The following weapons are added in the mod:
qZbip84.png
The Goblin Bow drops from Goblin Archers

oIubLRG.png
The Pirate Pistol drops from Pirate Deadeyes

avRIleQ.png
The Pirate Crossbow drops from Pirate Crossbowers

CiYvNvq.png
The Hallowed Sword drops from Enchanted Swords

TluwNzd.png
The Cursed Hammer drops from the Cursed Hammer

QHACk5i.png
The Crimson Axe drops from from the Crimson Axe

lVVXmdC.png
The Happy Bomb drops from Clowns

YOjrwJR.png
oEW0NJQ.png
2STAnNc.png
Old One's Army Goblins drop their respective weapons (1/300 chance)

pRTd2gM.png
Goblin Javelin Throwers drop Javelins (3 different tiers)

zEWRMTa.png
The Ogre Club is dropped by the Ogre (1/25 chance)

7koGGy4.png
The Gangsta Gun drops from the Snowman Gangsta

xVayRZ4.png
The Stabby Arm drops from Mister Stabby

wiqh11d.png
The Elf Bow drops from Elf Archers

TfYnrRO.png
The Solar Spear drops from Drakanians

agn8827.png
The Storm Diver Shotgun drops from Storm Divers

lDxovN1.png
The Selenian Dual Swords drop from Selenians

mmMWoQj.png
The Pirate Cannon drops from Pirate Captains and can be purchased from the Pirate

G35PHqu.png
The Alien Zapper drops from Giga Zappers

u2Dw3MY.png
The Scutlix Blaster drops from Scutlix Riders

xpWaN7z.png
The Marksman's Rifle drops from Skeleton Snipers (1/50 chance)

9CKvhMk.png
The Combat Shotgun drops from Tactical Skeletons (1/50 chance)

q9zaamk.png
The Slime Umbrella drops from Umbrella Slimes

e9o7wYU.png
The Unicorn Spear drops from Unicorns

k17shs0.png
The Mechanic's Wrench can be purchased from the Mechanic

Fm0Cj30.png
Poison Syringes are purchasable from the Arms Dealer if the Nurse is present

mhv6x5m.png
The Truffle Tome can be purchased from the Truffle

vuyYtsB.png
Baubles can be purchased from Santa Claus

Confused.png
What's that? A secret end-game weapon maybe?

dRISpKz.png
The Secret Box can be purchased from the Merchant after the Moonlord has been defeated


Thanks go to:
Re Logic - obviously
bluemagic123 & the Team - for creating the tModLoader and the Example Mods
@Kazzymodus - for his tireless help with the melee weapon projectile code

Like my mod really, really much?
Czv66Pl.png

Copy into your signature:
Code:
[url="https://forums.terraria.org/index.php?threads/drop-your-weapon.57976/"][img]http://i.imgur.com/Czv66Pl.png[/img][/url]
 

Attachments

  • dropyourweapon1.1.1.zip
    57.7 KB · Views: 341
  • dropyourweapon1.3.zip
    78.3 KB · Views: 679
Last edited:
I like the Pirate weapons and Archer ones, but the Excalibur and Crimson Axe seem way too OP. This means you could get Excalibur pre-mech. The Crimson Axe is a PHM weapon as well.
 
I like the Pirate weapons and Archer ones, but the Excalibur and Crimson Axe seem way too OP. This means you could get Excalibur pre-mech. The Crimson Axe is a PHM weapon as well.
Considering they're very inbalanced, they're probably different weapons rather the actual weapons themselves.

Anyway nice mod, I'd hope to see more things from the future.
Something that might be interesting is a spikeball entity dropping a weapon of a spikeball. That's probably impossible though.
 
I like the Pirate weapons and Archer ones, but the Excalibur and Crimson Axe seem way too OP. This means you could get Excalibur pre-mech. The Crimson Axe is a PHM weapon as well.
The hallowed Sword is different from the excalibur (although it's almost as strong, but the Excalibur was never the best sword to begin with), but I totally forgot about the Blood Lust Cluster. The Crimson Axe is also a different weapon, and I made the sprite from the enemy's, I forgot that they look almost exactly the same.
 
Update time!
- Crimson Axe sprite slightly reddened to make it distinguishable from the Blood Lust Cluster
- Crimson Axe has axe power, Cursed Hammer has hammer power
- Happy Bomb added
- Old One's Army weapons added!
 
Great Idea. The goblin war cleaver is it intended to swing that fast? Also would be nice to add to the late game weapons some special effects like for example the cursed hammer/sword/axe to dash with right click or throw a projectile similar to the True Excalibur an other example could be that the ogre club could on right click and with a big delay between uses hit enemies around the player with a big knokback (with the animation of the club hitting the floor hard).
 
Great Idea. The goblin war cleaver is it intended to swing that fast? Also would be nice to add to the late game weapons some special effects like for example the cursed hammer/sword/axe to dash with right click or throw a projectile similar to the True Excalibur an other example could be that the ogre club could on right click and with a big delay between uses hit enemies around the player with a big knokback (with the animation of the club hitting the floor hard).
The goblin weapons are intended to swing fast to compensate for their size, more like the Fetid Baghnakhs.
I fear adding projectiles and extras to attacks is a bit beyond me at this point, I'm a complete beginner when it comes to modding. Maybe I'll see into it if I have a bit more experience.
 
To make a weapon shoot a projectile you only need to add on SetDefaults() the line item.shoot = mod.ProjectileType("xxx"); where xxx is the name of the projectile you are going to make then the projectile you put this for example

public override void SetDefaults()
{
projectile.CloneDefaults(132); // 132 is terra blade proj
projectile.name = "xxx";
projectile.penetrate = 2; // hits the first enemy and 2 more
}

There are a lot of examples in the examplemod https://github.com/bluemagic123/tModLoader/tree/master/ExampleMod

Also you could look at some mods source code using tmodreader which you can download from the tmodloader thread https://forums.terraria.org/index.php?threads/1-3-tmodloader-a-modding-api.23726/ (not all mods allow to view it source code but for example calamity does and my mods do as well).
 
To make a weapon shoot a projectile you only need to add on SetDefaults() the line item.shoot = mod.ProjectileType("xxx"); where xxx is the name of the projectile you are going to make then the projectile you put this for example

public override void SetDefaults()
{
projectile.CloneDefaults(132); // 132 is terra blade proj
projectile.name = "xxx";
projectile.penetrate = 2; // hits the first enemy and 2 more
}

There are a lot of examples in the examplemod https://github.com/bluemagic123/tModLoader/tree/master/ExampleMod

Also you could look at some mods source code using tmodreader which you can download from the tmodloader thread https://forums.terraria.org/index.php?threads/1-3-tmodloader-a-modding-api.23726/ (not all mods allow to view it source code but for example calamity does and my mods do as well).
Projectiles themselves aren't the problem, several of the weapons are projectile based after all. I'm rather talking about effects, dust and particles, stuff to make it look good, that's hard.
Thanks for the info on the tmodreader, though!
 
If you clone a projectile all the dusts effects etc will be cloned as well so don't worry much about it. The only way it could look bad is if you try to draw the sprites particles yourself and you dont know how to do it and make them in MS paint half assedly. Also the guys at tmodloader's discord ( link on their thread) will help you if for example you want it to have smaller dust or whatever. Here is a thread that list the numbers for the dusts and what they do if you want to add or change the original dust from the cloned projectile https://forums.terraria.org/index.php?threads/dust-and-sound-catalogue-2.42370/
 
Next update!
- Gangsta Gun and Stabby Arm from the Snowmen
- Elf Bow from Elf Archers
- Solar Spear from Drakanians (now with fire and debuff!)


There's not much left, and the remaining weapons seem to be a bit more challenging, so it may take some time.
And I'll see if I can make some of the implemented ones more fancy, like Roxxz suggested, but for the most part, I'll try to be true to their origin as close as possible.
 
Update!
- Storm Diver Shotgun added
- Selenian Dual Swords added
- Hallowed Sword, Crimson Axe and Cursed Hammer now shoot projectiles (see below)
- Alien Zapper and Compacted Snowball are in the code but unobtainable, cause they don't work as intended for now

I want the Hallowed Sword, Crimson Axe and Cursed Hammer to only shoot a projectile every few swings, but I don't really know how to do that. If anybody could help me with it, that would be great.
 
Update!
I want the Hallowed Sword, Crimson Axe and Cursed Hammer to only shoot a projectile every few swings, but I don't really know how to do that. If anybody could help me with it, that would be great.

if (Main.rand.Next(4) == 0) // 4 stands for 1 in 5 chances of it shooting 5 instead of 4 because the 0 is included
{
//The action of shooting the projectile
}


Would be better to ask this questions in the tmodloader's chat https://discord.gg/YCJQAVW

EDIT: I'm glad that you endorsed the special effects on weapons the new ones and the updated ones are looking great and fun to play with. Be sure to check similar tier weapons and keep the dps of your weapons not too far away from those weapons so they don't become very op.
 
Last edited:
I'd like to help in the mod
Thank you for your offer, but out of personal preference, I work alone on my projects.

if (Main.rand.Next(4) == 0) // 4 stands for 1 in 5 chances of it shooting 5 instead of 4 because the 0 is included
{
//The action of shooting the projectile
}
I tried something like this, but it didn't work. I guess I'll ask around a bit.

Can we get items from Tremor, Spirit, and Thorium mobs?
To work on those mods, I would need access to the respective enemy sprites and preferably code, too. Sadly, those three are not tModReader compatible, and I doubt I'd get access to them otherwise.
 
Update!
- Storm Diver Shotgun added
- Selenian Dual Swords added
- Hallowed Sword, Crimson Axe and Cursed Hammer now shoot projectiles (see below)
- Alien Zapper and Compacted Snowball are in the code but unobtainable, cause they don't work as intended for now

I want the Hallowed Sword, Crimson Axe and Cursed Hammer to only shoot a projectile every few swings, but I don't really know how to do that. If anybody could help me with it, that would be great.
If you want it to shoot in an interval (for instance, every third swing), make a field that keeps the track of the amount of swings, then increment it every time you attack. Then, you can use that counter to perform your logic.

You'd want something like this:
Code:
int useCounter; // Keeps track of how many times the weapon was used.
int shootInterval; // The cooldown between projectiles.

public override bool UseItem(Player player)
{ 
    useCounter++; // Increment the useCounter on every strike.
 
    if(useCounter >= shootInterval) // Greater than in case you choose to modify useCounter somewhere else as well (for instance, if you want critical hits to count for two hits)
    {
        // Shoot stuff here.
     
        useCounter = 0; // Reset the useCounter.
    }
}
 
You'd want something like this:
Code:
int useCounter; // Keeps track of how many times the weapon was used.
int shootInterval; // The cooldown between projectiles.

public override bool UseItem(Player player)
{
useCounter++; // Increment the useCounter on every strike.

if(useCounter >= shootInterval) // Greater than in case you choose to modify useCounter somewhere else as well (for instance, if you want critical hits to count for two hits)
{
// Shoot stuff here.

useCounter = 0; // Reset the useCounter.
}
}

May I ask you for a ready example? I don't know much about coding, so I'm struggling where to put the integers.
 
Back
Top Bottom