Play animation based on what weapon I currently have in hand

Title pretty much says it all…how to play an animation based on what weapon I currently have in hand,so if I have an axe I want it to play an animation for attacking with that axe,if I have something else then play animation for attacking with that other thing…I’m sorry if this thread was already answered but I don’t know how to do this…any halp is appreciated :slight_smile:

I use anim montages for my weapons. I keep the references to anim montages in weapon class properties. In C++ I can call a multicast function to play it on each client. You might want to watch a tutorial on how to use it correctly.
Hope this helps a little.

It’s all you want:

Documentation: Animation Montage
Unreal Channel: 16 - Introduction to Animation Montage

I do pretty much what @Iceey says…

You want to use AnimMontage, I have an AnimMontage for each Different set of animations for weapons I need. So There could be a MeleeWeaponMontage, RangedWeaponMontage, HeavyWeaponMontage, etc. Each equipped weapon determines what montage it should use (somehow). You could have the weapon itself have the reference to the montage or you could have the pawn own the references, some mechanism must exist for you to determine what Montage to use. For replication purposes I store a struct that keeps the current equipped weapon being fired or the fire mode of that weapon, what it’s current state is (Inactive, Firing, Cooldown, etc), and a multi-cast function on the pawn fires to update the pawn animation to all clients when a user decides to start or stop firing.

Thanks,you helped a lot

I made animation for punching and its working great but now I don’t know how to use different animation montage when I am holding an axe…please help,I am new to this engine

‘‘Each equipped weapon determines what montage it should use’’ that is the part I don’t know how to do

Hi. There is an old thread where I explained how to play different animations depending on weapon held.

Go to post 6

Thanks but I still can’t do it you explained it but its still to hard’‘For every weapon you equip, set this integer variable to a fifferent value’’ I don’t know how to do that…thanks anyway

First you need to decide what kinda weapon system are you going to use. Anyways I slapped a little project together where you will be able to see how I did it with enumerations. A little video about a different issue I am having but you can get the idea: Unreal engine 4 android TPS umg issue. - YouTube