Playing an agent animation via code

Users who are viewing this thread

Hi,

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.

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

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

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
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".
Code:
activeagent.SetActionChannel(0, ActionIndexCache.Create("xxNameofAnimationxx"));

It worked for my purposes
 
Upvote 0
Back
Top Bottom