• Please note that we've updated the Mount & Blade II: Bannerlord save file system which requires you to take certain steps in order for your save files to be compatible with e1.7.1 and any later updates. You can find the instructions here.

BL Coding Playing an agent animation via code

Users who are viewing this thread


I have a function which gets called by a hotkey, that unequips an item and equips a different one.
In between I would like the agent to do a custom animation. The animation is already added via the modding kit, but I cant find any code to carry out an animation by string.

Has anyone any idea how to call the animation via c# ?

Any help is appreciated.
First you need to define your custom animation in action_sets.xml.

<action type="act_unequip_custom" animation="unequip_custom" />

Then you need to define your action type in action_types.xml.

<action name="act_unequip_custom" type="actt_equip_unequip" />

Finally you need to implement your custom animation in item_holsters.xml. There will be a lot of values in there that you will need to tweak yourself, but mainly the unequip_action will have to be act_unequip_custom.
Last edited:
Upvote 0
But wouldnt that mean I get the animation everytime I unequip the item?
I still want the normal unequipping and equipping, I just need the special animation when the hotkey is used.
Upvote 0
Hmm after looking through the code I am unable to see how it can be done. @Dejan any thoughts?

I advise you make a request to the devs to create documentation on this.
Last edited:
Upvote 0
Thanks anyway, I wasnt aware of the act thingy, and I think I found a possibility to call an act via code. I will try it at the weekend and post here the solution, if it works.
Upvote 0


In DismembermentPlus, a while back I was able to force the death animation of a agent by using the following. Where activeAgent is your target and xxNameofAnimationxx was name of animation.

My case I was using "act_fall_hard_legs_hold_left".
activeagent.SetActionChannel(0, ActionIndexCache.Create("xxNameofAnimationxx"));

It worked for my purposes
Upvote 0
Top Bottom