tModLoader Help with a couple of things

Vramir

Terrarian
Hi, there are two things i'm trying to do in my mod but I don't know how.
1.- I want to make a buff to change stats of the weapon you are holding. The idea is that while the buff is active the weapon knockback is increased
2.- Is there a way to switch textures in game? Lets say I have a weapon sprite and I have the same sprite but with different colors. I want to be able to change it's sprite/texture while a buff is active. Example: without buff the weapon has one texture, but when the buff is active its texture change (same layout but different colors and details)

P.D. Sorry for bad English. And thanks.
 
1) This is normally done by having the buff set a boolean on your own ModPlayer class to true. You can then check `if (myBoolean)` inside the appropriate ModPlayer hooks that indicates you have the buff.

2) There is two ways of doing this. The first and worst way would be to swap the texture entirely in the texture array. This would involve reflection. The second way is custom drawing code (including PlayerLayers since it's a weapon). This is arguably harder than the first.
 
Back
Top Bottom