Skin/gender specific animations

Users who are viewing this thread

Hi everyone.
Im adding some custom races to a mod and im wondering if its possible to replace some of the default animations with slightly modified ones depending of the skin that the actor performing them is using. Specifically for the 2handed weapons animations.
For this animations seems like the weapon is associated only with the right hand, being attached to that bone, and the attack and blocking animations were made specifically to show only visually the left hand grabbing the weapon considering the default skeleton shoulders/arms ratio.

Default skeleton:
male-staff.png

Thinner torso skeleton (same mesh but shoulder bones closer together):
female-staff.png


But when adding a custom race that has a mesh with a bulkier or thinner build, the shoulder bones of the skeleton that this race uses, need to be moved furter/closer to the torso for it to deform correctly. The problem is that if this is done, the bones for the elbow, wrist and hand need to be moved as well to keep the ratio so the two handed animations still look good (the left hand visibly holds the weapon). Otherwise, the left hand ends up not reaching the weapon or going further away looking wrong.
When doing this for super bulky races that have wide torsos, the arms end up being too long and can end up ignoring enemy shields. And for slim races, the arms end up being too short, deducing the reach and looking super weird.
So, is somehow possible to have some kind of gender/race specific animations for attacks to avoid this problems and have nive looking 2handed animations at the same time?
Its possible to show meshes from armors depending on the skin with triggers "ti_on_init_item" i wonder if when an actor is spawned, one could change its animations based on its skin.

Any suggestion is appreciated, thanks.
 
Solution
So, unfortunately, this isn't really solvable without using WSE2.

In WSE2 there is an operation:
(agent_set_personal_animation, ":agent", ":default_anim", ":personal_anim"),
Where you can set an alternate animation on a per agent basis, basically pointing a default animation at another entry.

By using it with agent_get_troop_id and troop_get_type you could easily set up a your system.

Python:
# module_scripts
("racial_animation_swap", [
    (store_script_param, ":agent", 1),
  
    (agent_get_troop_id, ":troop", ":agent"),
    (troop_get_type, ":type", ":troop"),
  
    (try_begin),
        (eq, ":type", tf_big_boyo),
      
        (agent_set_personal_animation, ":agent", "anim_defend_left_twohanded"...
So, unfortunately, this isn't really solvable without using WSE2.

In WSE2 there is an operation:
(agent_set_personal_animation, ":agent", ":default_anim", ":personal_anim"),
Where you can set an alternate animation on a per agent basis, basically pointing a default animation at another entry.

By using it with agent_get_troop_id and troop_get_type you could easily set up a your system.

Python:
# module_scripts
("racial_animation_swap", [
    (store_script_param, ":agent", 1),
  
    (agent_get_troop_id, ":troop", ":agent"),
    (troop_get_type, ":type", ":troop"),
  
    (try_begin),
        (eq, ":type", tf_big_boyo),
      
        (agent_set_personal_animation, ":agent", "anim_defend_left_twohanded", "anim_defend_left_twohanded_wide_shoulders"),
    (else_try),
        (eq, ":type", tf_smol),
      
        (agent_set_personal_animation, ":agent", "anim_defend_left_twohanded", "anim_defend_left_twohanded_narrow_shoulders"),
    (try_end),
]),

# module_mission_templates
(ti_on_agent_spawn, 0, 0, [], [

    (store_trigger_param_1, ":agent"),

    (call_script, "script_racial_animation_swap", ":agent"),
 ])
 
Last edited:
Upvote 1
Solution
It works! thank you!
Tested it with anim_defend_shield_keep, so the character blocks with its forearm when wielding a twohanded weapon haha.
Forgot to mention i was already using WSE2 for the skin limit removal feature :lol:
Just had to change the line (troop_set_type, ":type", ":troop"), for troop_get_type as the compiler complained about :type being unassigned.
The second part of your script i tested inside of one of the elements inside mission templates array, and it only works inside taverns. I guess im gonna have to put those lines on every element wheres combat involved.
I wonder if with this it would be possible to go beyond "unused_human_anim_100"as with every skin theres a good bunch of two handed animations to replace.
 
Upvote 0
Forgot to mention i was already using WSE2 for the skin limit removal feature :lol:
Lol, perfect. I always worry about recommending WSE2 since setting it up is definitely more advanced than a lot of modders are ready for. Happy to see you already had it set up.
Just had to change the line (troop_set_type, ":type", ":troop"), for troop_get_type as the compiler complained about :type being unassigned.
Ahh! Typo, I corrected in case another person needs a reference point in the future. Thanks for pointing that out.
The second part of your script i tested inside of one of the elements inside mission templates array, and it only works inside taverns. I guess im gonna have to put those lines on every element wheres combat involved.
Yeah, you have to include the trigger in each MT you need it to work inside of, check out common_battle_mission_start for a point of reference on how to create a named trigger, and reference that name inside the MTs instead of having to maintain multiple duplicates around.
I wonder if with this it would be possible to go beyond "unused_human_anim_100"as with every skin theres a good bunch of two handed animations to replace.
So, I don't know which update did it, but you can now create new entries but only outside of the hardcoded arrays. The prior info is still true, but only within the hardcoded arrays. I don't think there's a limit, but I'm at just shy of 100 additional animations added to the end on my own module and it works perfect!
 
Upvote 1
Great, thanks for your fast response.
Yeah, you have to include the trigger in each MT you need it to work inside of, check out common_battle_mission_start for a point of reference on how to create a named trigger, and reference that name inside the MTs instead of having to maintain multiple duplicates around.
Tried this, now its just one line that needs to be everywhere, nice!
I saw your code for the animations, so they have to be at the very end, got it thanks.
 
Upvote 0
Back
Top Bottom