A melee weapon that can keep swinging even when out of ammunition?

Dudley

Official Terrarian
I have created a melee weapon that when swung, fires a projectile but also uses ammo up when fired (achieved through the item.shoot and item.useammo). It works as intended but I want the weapon to be able to swing normally even when out of ammo, so it can still be used like a traditional broadsword type weapon.
Sadly when ammo reaches 0 the weapon stops swinging. Is there anyway around this?
Thanks
______________________________________
Edit: SOLVED!! I applied the firing function to right click and left the left click as the regular swing.
 
Last edited:
I know very little coding, but can you try something like:
Code:
If sword_swinging == true:
 If ammo_available == true:
  fire_projectile == true
  else:
  fire projectile == false
 
Thanks for the reply!
Just tried it, tmodloader seems to hate it lol
Played around a bit, either syntax error or CS1002 (,;
 
Thanks for the reply!
Just tried it, tmodloader seems to hate it lol
Played around a bit, either syntax error or CS1002 (,;
Probably because I only know Python so that's what I wrote it in.
 
this makes me want to make a blunderbuss that acts like a sword, swiping twice, before blasting the foe with a shotgun blast
 
this makes me want to make a blunderbuss that acts like a sword, swiping twice, before blasting the foe with a shotgun blast
see this guy gets it!
 
you can make the sword swing with alternative attack by tapping right-click or a bound key perhap
 
you can make the sword swing with alternative attack by tapping right-click or a bound key perhap
I actually did figure out how to do the right click fire and it works now!
Only issue is I can't figure out how to allow autoReuse on the alt fire. I found this strip of code on the class list
{
ItemsThatAllowRepeatedRightClick = Factory.CreateBoolSet(false, 3384, 3858, 3852)
}
but i cant get it to work sadly
 
Back
Top Bottom