Instant crash when using my Modded Weapon, any ideas?

Dudley

Official Terrarian
I'm attempting to create a new weapon that operates similar to the Bladed Glove and Fetid Baghnakhs. I took the basic ExampleSword.cs file and added this line of code to it

Item.claw = new bool[ItemID.Count]

^ (I pulled this from the tModLoader 1.4.4 Class List)

When I add it, the game crashes either the moment I craft it or the moment I swing it. Any ideas why this happens?
Thanks
 
No idea where you got that code from but uh, it's not doing what you think it is.

A claw weapon is functionally the exact same thing as a melee Broadsword, just smaller and much faster.
 
No idea where you got that code from but uh, it's not doing what you think it is.

A claw weapon is functionally the exact same thing as a melee Broadsword, just smaller and much faster.
Thanks for getting back to me. For reference I'm attempting to make a close range Boxing Glove type weapon that is swung like a claw/sword.

I'm aware on how the claw operates, I can easily make a copy, it's just that when I do make the weapon, the weapon appears under the player's hand during the swing animation instead of on top it like the Bladed Glove does. This ends up making the weapon look like its just a glove being held by the player instead of being on the players hand itself. As for the code, I am very new to programming so I was just playing around with the tmodloader settings.

If I may ask then, is there a simple line of code i can add to make the Weapon appear on top of the players hand during the swing animation, just like the Bladed Glove does, instead of under it?
edit: upon second glance it may not actually appear on top of the players hand, still though I wish to have a way for it to appear above the player sprite
 
Last edited:
There's no method that lets you change how a swung melee weapon is drawn, you'd have to make it a custom swung projectile and modify that instead.
The bladed glove does appear above the player's hand, I don't see anything in the vanilla code that it's doing differently. Just match the sprite against yours:
1742315377109.png
 
There's no method that lets you change how a swung melee weapon is drawn, you'd have to make it a custom swung projectile and modify that instead.
The bladed glove does appear above the player's hand, I don't see anything in the vanilla code that it's doing differently. Just match the sprite against yours:
View attachment 495049
Understood, thank you
 
There's no method that lets you change how a swung melee weapon is drawn, you'd have to make it a custom swung projectile and modify that instead.
The bladed glove does appear above the player's hand, I don't see anything in the vanilla code that it's doing differently. Just match the sprite against yours:
View attachment 495049
Item.claw[Item.type] = true; in SetStaticDefaults works for me. Idk how you managed to miss it. It draws an item in a different way than default sword (from what I understand, a little lower and turned towards the player more)
 
LIFE SAVER THANK YOU
 
Back
Top Bottom