How do you handle multiple animation states (weapon equipped/unequipped)?

I’ve got an anim BP which is just the third person anim BP plus a slot for montages on the upper body and my attempt at adapting it for multiple character states (with and without a weapon).


Basically I just use conduits to redirect to the right idle or walk/run anim based on a bool “hasWeapon”. This feels very messy and not expandable. So how is this supposed to be handled? I imagine there must be a more elegant way to handle situations like where a variable can change the basic locomotion animations.

Any help is appreciated. I would like to clean up my anim BP and learn how to better set up anim BPs.

I found a solution to my situation but it may not suit all projects. As always there are many ways to accomplish something. For me this works for now.

First off I discovered that Sequence Player nodes within the Anim Graph can apparently expose many useful pins if you select them and look at their details. I just thought they could only play a specified anim but this is not true.

Here is my Idle State


What I am doing is blending between two anims based on a bool. This bool determines if a weapon is equipped or not. If one is not the default Idle anim is used, otherwise it will grab the Idle anim from a component attached to the Character BP. Following the arrows you can see how I changed the anim to grab it from the variable in the component.

I decided to use a component so that if the character equips a different weapon the set of anims can change based on the weapon. This allows a sword to use different Idles and Movement anims from an axe.

Here is how the movement blend space is handled.


Similar to the Sequence Player, the Blendspace Player is used and has the anim pin exposed with the Walk variable selected from the component.

Here is how I set the component variable on the AnimBP.


I use the Event Blueprint Begin Play node rather than the initialize event because the initialization happens too quick and does not properly get the component from the owner.



To summarize, I expose the anim to use as a pin then select between a default anim and a variable anim based on if the character has a weapon equipped.
Hope this is useful to anyone in the future.

So instead of that, think of it as creating a weapon class from which you careate weapon instances which hold the information that you defined in your summary on top of more info.

And you got yourself the basis for a simple to change system…

Sorry but I don’t understand your point.
What is a “simple to change system”? And what exactly would be different in this weapon class you are mentioning?

That it is an Object you place in the level or the character inventory and it drives everything else from itself rather than you having to code custom things within the character or similar.

One class, a good interface to be implemented by the children.
A little creativity, and you can make child blueprints of different stuff all day long without having to lock anything in.

Ah, yeah I think I got you. That’s the direction I’m heading. My project is still early on but my plan is to have a class with all the weapon related data (mesh, damage info, anims…). This component is just the container for all the anims of a weapon that will be used in the larger container. Then weapons can share anims (maybe all swords have the same anims) or have their own by using a child of the component (axes may use the same movement and idle but with different attacks).

I was just unsure in the beginning of how to access and use the animations from a component within animation states, but then I saw you can expose pins on sequence players.

You should probably go one step further and lock the player into a custom animation blueprint when he uses a specific weapon.

It affords you the ability to do just about anything.

The only real downside is that you need a shared base skeleton thats the same across all your characters for it to not be a pita to set up.

Look into replacong the ABP at runtime.

I’ve seen that suggested when I was initially researching how to swap anims but I felt a whole new AnimBP was unnecessary. I see the benefit of being able to add logic but I don’t think I’ll need that as of now and it is much faster to swap some variables than rebuilding an anim graph.

Ha, but you can acrually make child animation blueprints as well.
:wink:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.