OSP Combat Two-handed attack animations on horseback

Users who are viewing this thread

Wuan

Veteran
With the help of WSE2 and his author K700, I soon realized the animations of twohanded four-dir attack and twohand lance thrust on horseback, like Bannerlord.


Add to any required scene in module_mission_templates.py
Code:
##Wuan   Add two hand animations on horseback   Optimized by SupaNinjaMan
twh_anim_horseback_replace_triggers= [

    (ti_on_item_wielded, 0, 0, [],
      [
        # Store trigger parameters (check header_triggers.py for detailed information)
        (store_trigger_param_1, ":agent_no"),
        (store_trigger_param_2, ":item"),
 
        # Check that this character is valid
        # This should be redundant because only living human agents can equip, but just to be sure.
        (agent_is_active, ":agent_no"),
        (agent_is_alive, ":agent_no"),
        (agent_is_human, ":agent_no"),
 
        # Set up variables to be used later. This is for clarity
        (agent_get_horse, ":horse", ":agent_no"),                # The agent's horse (or not)
        (item_get_type, ":wp_type", ":item"),                    # The item type of the equipped item that triggered
        (try_begin),
            (eq, ":wp_type", itp_type_shield),                                ##If the item type is shield
            (agent_set_slot, ":agent_no", slot_has_shield, 1),
            (agent_get_wielded_item, ":item", ":agent_no", 0),          # Get the right hand weapon
            (gt, ":item", -1),
            (item_get_type, ":wp_type", ":item"),                   # The item type of the right hand weapon
        (try_end),
 
        ##    In order to deal with the situation where the shield is automatically equipped or removed when changing weapons
        (try_begin),
            (agent_slot_eq, ":agent_no", slot_has_shield, 1),
            (gt, ":item", -1),
            (item_has_property, ":item", itp_two_handed),
            (agent_set_slot, ":agent_no", slot_has_shield, 2),
        (else_try),
            (agent_slot_eq, ":agent_no", slot_has_shield, 2),
            (gt, ":item", -1),
            (neg|item_has_property, ":item", itp_two_handed),
            (agent_set_slot, ":agent_no", slot_has_shield, 1),
        (try_end),

        (try_begin),
 
            (ge, ":horse", 0),                                            # Agent is mounted
            (neg|agent_slot_eq, ":agent_no", slot_has_shield, 1),                                        # Ensures there is no off-hand item
            (this_or_next|eq, ":wp_type", itp_type_two_handed_wpn),        # Item equipped is two-handed or,
            (eq, ":wp_type", itp_type_polearm),                            # Item equipped is a polearm
            (call_script, "script_cf_agent_set_personal_animation", ":agent_no"),
        (else_try),
            #restore default animation   ##WSE
            (agent_slot_eq, ":agent_no", slot_agent_personal_animation, 1),        # Is currently using a modified animation set while they shouldn't
 
            (agent_set_default_animations, ":agent_no"),                        # Revert the animations to default
 
            (agent_set_slot, ":agent_no", slot_agent_personal_animation, 0),    # And update this slot so we know their animations are at default
        (try_end),
      ]),
 
    (ti_on_item_unwielded, 0, 0, [],
      [
        # Store trigger parameters (check header_triggers.py for detailed information)
        (store_trigger_param_1, ":agent_no"),
        (store_trigger_param_2, ":item"),
 
        # Check that this character is valid
        # This should be redundant because only living human agents can equip, but just to be sure.
        (agent_is_active, ":agent_no"),
        (agent_is_alive, ":agent_no"),
        (agent_is_human, ":agent_no"),
 
        # Set up variables to be used later. This is for clarity
        (agent_get_horse, ":horse", ":agent_no"),                # The agent's horse (or not)
        (item_get_type, ":wp_type", ":item"),                    # The item type of the equipped item that triggered

        (try_begin),
            (eq, ":wp_type", itp_type_shield),                          #If the item type is shield
            (agent_set_slot, ":agent_no", slot_has_shield, 0),            # Clean the slot
            (agent_get_wielded_item, ":item", ":agent_no", 0),          # Get the right hand weapon   
            (gt, ":item", -1),                                                # Something is equipped?
            (item_get_type, ":wp_type", ":item"),                           # Get the weapon type
        (try_end),


        (try_begin),
            (ge, ":horse", 0),                                            # Agent is mounted
            (this_or_next|eq, ":wp_type", itp_type_two_handed_wpn),        # Item equipped is two-handed or,
            (eq, ":wp_type", itp_type_polearm),                            # Item equipped is a polearm
            (call_script, "script_cf_agent_set_personal_animation", ":agent_no"),
        (else_try),
            (agent_slot_eq, ":agent_no", slot_agent_personal_animation, 1),        # Is currently using a modified animation set while they shouldn't
 
            #restore default animation   ##WSE
            (agent_set_default_animations, ":agent_no"),                        # Revert the animations to default
 
            (agent_set_slot, ":agent_no", slot_agent_personal_animation, 0),    # And update this slot so we know their animations are at default
        (try_end),
      ]),
 
    (ti_on_agent_mount, 0, 0, [],
      [
        # Store trigger parameters (check header_triggers.py for detailed information)
        (store_trigger_param_1, ":agent_no"),

        (agent_is_active, ":agent_no"),
        (agent_is_alive, ":agent_no"),
        (agent_is_human, ":agent_no"),

        (agent_get_wielded_item, ":shield", ":agent_no", 1),          # Get the off-hand weapon
        (agent_get_wielded_item, ":item", ":agent_no", 0),          # Get the right hand weapon
        (gt, ":item", -1),
        (item_get_type, ":wp_type", ":item"),                   # The item type of the right hand weapon
 
        (try_begin),

            (eq, ":shield", -1),                                        # Ensures there is no off-hand item
            (this_or_next|eq, ":wp_type", itp_type_two_handed_wpn),        # Item equipped is two-handed or,
            (eq, ":wp_type", itp_type_polearm),                            # Item equipped is a polearm
            (call_script, "script_cf_agent_set_personal_animation", ":agent_no"),
        (else_try),
            #restore default animation   ##WSE
            (agent_slot_eq, ":agent_no", slot_agent_personal_animation, 1),        # Is currently using a modified animation set while they shouldn't
 
            (agent_set_default_animations, ":agent_no"),                        # Revert the animations to default
 
            (agent_set_slot, ":agent_no", slot_agent_personal_animation, 0),    # And update this slot so we know their animations are at default
        (try_end),
      ]),
 
   (ti_on_agent_dismount, 0, 0, [],
      [
            (store_trigger_param_1, ":agent_no"),
            #restore default animation   ##WSE
            (agent_slot_eq, ":agent_no", slot_agent_personal_animation, 1),        # Is currently using a modified animation set while they shouldn't
 
            (agent_set_default_animations, ":agent_no"),                        # Revert the animations to default
 
            (agent_set_slot, ":agent_no", slot_agent_personal_animation, 0),    # And update this slot so we know their animations are at default
      ]),

   (ti_on_item_dropped, 0, 0, [],
      [
            (store_trigger_param_1, ":agent_no"),
            (store_trigger_param_2, ":item"),
         
            (item_get_type, ":wp_type", ":item", ":item"),
            (eq, ":wp_type", itp_type_shield),
            (agent_set_slot, ":agent_no", slot_has_shield, 0),
      ]),
]
##Wuan
Code:
##Wuan
  ("cf_agent_set_personal_animation",
    [
      (store_script_param, ":agent_no", 1),
            (try_begin),
                (agent_slot_eq, ":agent_no", slot_agent_personal_animation, 0),        # Is currently using a default animation set while they should use a modified set
 
                #set new animation  ##WSE
                (agent_set_personal_animation, ":agent_no", "anim_ready_thrust_onehanded_lance", "anim_ready_thrust_staff"),
                (agent_set_personal_animation, ":agent_no", "anim_release_thrust_onehanded_lance", "anim_release_thrust_staff"),
                (agent_set_personal_animation, ":agent_no", "anim_release_thrust_onehanded_lance_continue", "anim_release_thrust_staff_continue"),
                (agent_set_personal_animation, ":agent_no", "anim_blocked_thrust_onehanded_lance", "anim_blocked_thrust_staff"),            
                (agent_set_personal_animation, ":agent_no", "anim_parried_thrust_onehanded_lance", "anim_parried_thrust_staff"),
            
                (agent_set_personal_animation, ":agent_no", "anim_ready_slash_horseback_right", "anim_ready_slashright_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_slash_horseback_right", "anim_release_slashright_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_slash_horseback_right_continue", "anim_release_slashright_twohanded_continue"),
                (agent_set_personal_animation, ":agent_no", "anim_blocked_slash_horseback_right", "anim_blocked_slashright_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_parried_slash_horseback_right", "anim_parried_slashright_twohanded"),
            
                (agent_set_personal_animation, ":agent_no", "anim_ready_slash_horseback_left", "anim_ready_slashleft_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_slash_horseback_left", "anim_release_slashleft_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_slash_horseback_left_continue", "anim_release_slashleft_twohanded_continue"),
                (agent_set_personal_animation, ":agent_no", "anim_blocked_slash_horseback_left", "anim_blocked_slashleft_twohanded"),            
                (agent_set_personal_animation, ":agent_no", "anim_parried_slash_horseback_left", "anim_parried_slashleft_twohanded"),
            
                (agent_set_personal_animation, ":agent_no", "anim_ready_overswing_onehanded", "anim_ready_overswing_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_overswing_onehanded", "anim_release_overswing_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_overswing_onehanded_continue", "anim_release_overswing_twohanded_continue"),
                (agent_set_personal_animation, ":agent_no", "anim_blocked_overswing_onehanded", "anim_blocked_overswing_twohanded"),            
                (agent_set_personal_animation, ":agent_no", "anim_parried_overswing_onehanded", "anim_parried_overswing_twohanded"),
            
                (agent_set_personal_animation, ":agent_no", "anim_ready_thrust_onehanded_horseback", "anim_ready_thrust_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_thrust_onehanded_horseback", "anim_release_thrust_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_thrust_onehanded_horseback_continue", "anim_release_thrust_twohanded_continue"),
                (agent_set_personal_animation, ":agent_no", "anim_blocked_thrust_onehanded_horseback", "anim_blocked_thrust_twohanded"),            
                (agent_set_personal_animation, ":agent_no", "anim_parried_thrust_onehanded_horseback", "anim_parried_thrust_twohanded"),
            
                (agent_set_slot, ":agent_no", slot_agent_personal_animation, 1), # Stores that this agent is using a modified animation set
            (try_end),
    ]),
##Wuan
This can only allow twohanded swing left and right, If you want to realize the animations of twohanded overswing and thrust, you need to
find these codes in header_items.py

itc_cut_two_handed = itcf_force_64_bits | (itcf_slashright_twohanded | itcf_slashleft_twohanded | itcf_overswing_twohanded |
itcf_horseback_slashright_onehanded|itcf_horseback_slashleft_onehanded)

and replace them with

itc_cut_two_handed = itcf_force_64_bits | (itcf_slashright_twohanded | itcf_slashleft_twohanded | itcf_overswing_twohanded |
itcf_horseback_slashright_onehanded|itcf_horseback_slashleft_onehanded|itcf_overswing_onehanded)

To use two-handed sword to thrusting on horseback, modify Next Line to:
itc_greatsword = itc_cut_two_handed | itcf_thrust_twohanded | itc_parry_two_handed | itcf_thrust_onehanded

Now you will find sometimes you can't attack to the left or right on horseback, so you should
insert "amf_rider_rot_swing_right" in "ready_slashright_twohanded", "release_slashright_twohanded", "release_slashright_twohanded_continue", "anim_blocked_slashright_twohanded" and "parried_slashright_twohanded" these five animations;

insert "amf_rider_rot_swing_left" in "ready_slashleft_twohanded", "release_slashleft_twohanded", "release_slashleft_twohanded_continue", "anim_blocked_slashleft_twohanded" and "parried_slashleft_twohanded" these five animations;

insert "amf_rider_rot_overswing" in "ready_overswing_twohanded", "release_overswing_twohanded", "release_overswing_twohanded_continue", "anim_blocked_overswing_twohanded" and "parried_overswing_twohanded" these five animations;

insert "amf_rider_rot_thrust" in "ready_thrust_twohanded", "release_thrust_twohanded", "release_thrust_twohanded_continue", "anim_blocked_thrust_twohanded", "parried_thrust_twohanded", "ready_thrust_staff", "release_thrust_staff", "release_thrust_staff_continue", "anim_blocked_thrust_staff" and "parried_thrust_staff" these ten animations.

 
Last edited:
Excellent idea Wuan, I would recommend one change to make it a little more smooth, however. Hook the script to the ti_on_item_wielded trigger! Check the item type and if they're mounted and BOOM, much smoother transition and it should prevent the bug you're experiencing (not to mention it is going to be a lot more performance friendly.
Code:
##Wuan   Add two hand animations on horseback

twh_anim_horseback_replace = (ti_on_item_wielded, 0, 0, [],
    [
        # Store trigger parameters (check header_triggers.py for detailed information)
        (store_trigger_param_1, ":agent_no"),
        (store_trigger_param_2, ":item"),
        
        # Check that this character is valid
        # This should be redundant because only living human agents can equip, but just to be sure.
        (agent_is_active, ":agent_no"),
        (agent_is_alive, ":agent_no"),
        (agent_is_human, ":agent_no"),
        
        # Set up variables to be used later. This is for clarity
        (agent_get_horse, ":horse", ":agent_no"),                # The agent's horse (or not)
        (item_get_type, ":wp_type", ":item"),                    # The item type of the equipped item that triggered this
        (agent_get_wielded_item, ":shield", ":agent_no", 1),    # Offhand item


        (try_begin),
            
            (ge, ":horse", 0),                                            # Agent is mounted
            (eq, ":shield", -1),                                        # Ensures there is no off-hand item
            (this_or_next|eq, ":wp_type", itp_type_two_handed_wpn),        # Item equipped is two-handed or,
            (eq, ":wp_type", itp_type_polearm),                            # Item equipped is a polearm
            
            (try_begin),
                (agent_slot_eq, ":agent_no", slot_agent_personal_animation, 0),        # Is currently using a default animation set while they should use a modified set
                
                #set new animation  ##WSE
                (agent_set_personal_animation, ":agent_no", "anim_ready_thrust_onehanded_lance", "anim_ready_thrust_staff"),
                (agent_set_personal_animation, ":agent_no", "anim_release_thrust_onehanded_lance", "anim_release_thrust_staff"),
                (agent_set_personal_animation, ":agent_no", "anim_release_thrust_onehanded_lance_continue", "anim_release_thrust_staff_continue"),
                
                (agent_set_personal_animation, ":agent_no", "anim_ready_slash_horseback_right", "anim_ready_slashright_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_slash_horseback_right", "anim_release_slashright_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_slash_horseback_right_continue", "anim_release_slashright_twohanded_continue"),
                
                (agent_set_personal_animation, ":agent_no", "anim_ready_slash_horseback_left", "anim_ready_slashleft_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_slash_horseback_left", "anim_release_slashleft_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_slash_horseback_left_continue", "anim_release_slashleft_twohanded_continue"),
                
                (agent_set_personal_animation, ":agent_no", "anim_ready_overswing_onehanded", "anim_ready_overswing_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_overswing_onehanded", "anim_release_overswing_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_overswing_onehanded_continue", "anim_release_overswing_twohanded_continue"),
                
                (agent_set_personal_animation, ":agent_no", "anim_ready_thrust_onehanded_horseback", "anim_ready_thrust_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_thrust_onehanded_horseback", "anim_release_thrust_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_thrust_onehanded_horseback_continue", "anim_release_thrust_twohanded_continue"),
            
                (agent_set_slot, ":agent_no", slot_agent_personal_animation, 1), # Stores that this agent is using a modified animation set
            (try_end),
        (else_try),   
            #restore default animation   ##WSE
            (agent_slot_eq, ":agent_no", slot_agent_personal_animation, 1),        # Is currently using a modified animation set while they shouldn't
            
            (agent_set_default_animations, ":agent_no"),                        # Revert the animations to default
            
            (agent_set_slot, ":agent_no", slot_agent_personal_animation, 0),    # And update this slot so we know their animations are at default
        (try_end),
    ])
##Wuan

The only issue I can see would be for mods using personal animations elsewhere, so agent_set_default_animations may cause them issues, but, in that case they could set up a loop to check if the personal animation is assigned to the relevant slots above using agent_get_personal_animation and comparing it to the default animation.
 
Excellent idea Wuan, I would recommend one change to make it a little more smooth, however. Hook the script to the ti_on_item_wielded trigger! Check the item type and if they're mounted and BOOM, much smoother transition and it should prevent the bug you're experiencing (not to mention it is going to be a lot more performance friendly.
Code:
##Wuan   Add two hand animations on horseback

twh_anim_horseback_replace = (ti_on_item_wielded, 0, 0, [],
    [
        # Store trigger parameters (check header_triggers.py for detailed information)
        (store_trigger_param_1, ":agent_no"),
        (store_trigger_param_2, ":item"),
      
        # Check that this character is valid
        # This should be redundant because only living human agents can equip, but just to be sure.
        (agent_is_active, ":agent_no"),
        (agent_is_alive, ":agent_no"),
        (agent_is_human, ":agent_no"),
      
        # Set up variables to be used later. This is for clarity
        (agent_get_horse, ":horse", ":agent_no"),                # The agent's horse (or not)
        (item_get_type, ":wp_type", ":item"),                    # The item type of the equipped item that triggered this
        (agent_get_wielded_item, ":shield", ":agent_no", 1),    # Offhand item


        (try_begin),
          
            (ge, ":horse", 0),                                            # Agent is mounted
            (eq, ":shield", -1),                                        # Ensures there is no off-hand item
            (this_or_next|eq, ":wp_type", itp_type_two_handed_wpn),        # Item equipped is two-handed or,
            (eq, ":wp_type", itp_type_polearm),                            # Item equipped is a polearm
          
            (try_begin),
                (agent_slot_eq, ":agent_no", slot_agent_personal_animation, 0),        # Is currently using a default animation set while they should use a modified set
              
                #set new animation  ##WSE
                (agent_set_personal_animation, ":agent_no", "anim_ready_thrust_onehanded_lance", "anim_ready_thrust_staff"),
                (agent_set_personal_animation, ":agent_no", "anim_release_thrust_onehanded_lance", "anim_release_thrust_staff"),
                (agent_set_personal_animation, ":agent_no", "anim_release_thrust_onehanded_lance_continue", "anim_release_thrust_staff_continue"),
              
                (agent_set_personal_animation, ":agent_no", "anim_ready_slash_horseback_right", "anim_ready_slashright_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_slash_horseback_right", "anim_release_slashright_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_slash_horseback_right_continue", "anim_release_slashright_twohanded_continue"),
              
                (agent_set_personal_animation, ":agent_no", "anim_ready_slash_horseback_left", "anim_ready_slashleft_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_slash_horseback_left", "anim_release_slashleft_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_slash_horseback_left_continue", "anim_release_slashleft_twohanded_continue"),
              
                (agent_set_personal_animation, ":agent_no", "anim_ready_overswing_onehanded", "anim_ready_overswing_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_overswing_onehanded", "anim_release_overswing_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_overswing_onehanded_continue", "anim_release_overswing_twohanded_continue"),
              
                (agent_set_personal_animation, ":agent_no", "anim_ready_thrust_onehanded_horseback", "anim_ready_thrust_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_thrust_onehanded_horseback", "anim_release_thrust_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_thrust_onehanded_horseback_continue", "anim_release_thrust_twohanded_continue"),
          
                (agent_set_slot, ":agent_no", slot_agent_personal_animation, 1), # Stores that this agent is using a modified animation set
            (try_end),
        (else_try), 
            #restore default animation   ##WSE
            (agent_slot_eq, ":agent_no", slot_agent_personal_animation, 1),        # Is currently using a modified animation set while they shouldn't
          
            (agent_set_default_animations, ":agent_no"),                        # Revert the animations to default
          
            (agent_set_slot, ":agent_no", slot_agent_personal_animation, 0),    # And update this slot so we know their animations are at default
        (try_end),
    ])
##Wuan

The only issue I can see would be for mods using personal animations elsewhere, so agent_set_default_animations may cause them issues, but, in that case they could set up a loop to check if the personal animation is assigned to the relevant slots above using agent_get_personal_animation and comparing it to the default animation.
Well done SupaNinjaMan, thank you for your correction. I must praise your professionalism. I will test it tomorrow morning (our time).
 
Excellent idea Wuan, I would recommend one change to make it a little more smooth, however. Hook the script to the ti_on_item_wielded trigger! Check the item type and if they're mounted and BOOM, much smoother transition and it should prevent the bug you're experiencing (not to mention it is going to be a lot more performance friendly.
Code:
##Wuan   Add two hand animations on horseback

twh_anim_horseback_replace = (ti_on_item_wielded, 0, 0, [],
    [
        # Store trigger parameters (check header_triggers.py for detailed information)
        (store_trigger_param_1, ":agent_no"),
        (store_trigger_param_2, ":item"),
       
        # Check that this character is valid
        # This should be redundant because only living human agents can equip, but just to be sure.
        (agent_is_active, ":agent_no"),
        (agent_is_alive, ":agent_no"),
        (agent_is_human, ":agent_no"),
       
        # Set up variables to be used later. This is for clarity
        (agent_get_horse, ":horse", ":agent_no"),                # The agent's horse (or not)
        (item_get_type, ":wp_type", ":item"),                    # The item type of the equipped item that triggered this
        (agent_get_wielded_item, ":shield", ":agent_no", 1),    # Offhand item


        (try_begin),
           
            (ge, ":horse", 0),                                            # Agent is mounted
            (eq, ":shield", -1),                                        # Ensures there is no off-hand item
            (this_or_next|eq, ":wp_type", itp_type_two_handed_wpn),        # Item equipped is two-handed or,
            (eq, ":wp_type", itp_type_polearm),                            # Item equipped is a polearm
           
            (try_begin),
                (agent_slot_eq, ":agent_no", slot_agent_personal_animation, 0),        # Is currently using a default animation set while they should use a modified set
               
                #set new animation  ##WSE
                (agent_set_personal_animation, ":agent_no", "anim_ready_thrust_onehanded_lance", "anim_ready_thrust_staff"),
                (agent_set_personal_animation, ":agent_no", "anim_release_thrust_onehanded_lance", "anim_release_thrust_staff"),
                (agent_set_personal_animation, ":agent_no", "anim_release_thrust_onehanded_lance_continue", "anim_release_thrust_staff_continue"),
               
                (agent_set_personal_animation, ":agent_no", "anim_ready_slash_horseback_right", "anim_ready_slashright_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_slash_horseback_right", "anim_release_slashright_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_slash_horseback_right_continue", "anim_release_slashright_twohanded_continue"),
               
                (agent_set_personal_animation, ":agent_no", "anim_ready_slash_horseback_left", "anim_ready_slashleft_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_slash_horseback_left", "anim_release_slashleft_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_slash_horseback_left_continue", "anim_release_slashleft_twohanded_continue"),
               
                (agent_set_personal_animation, ":agent_no", "anim_ready_overswing_onehanded", "anim_ready_overswing_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_overswing_onehanded", "anim_release_overswing_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_overswing_onehanded_continue", "anim_release_overswing_twohanded_continue"),
               
                (agent_set_personal_animation, ":agent_no", "anim_ready_thrust_onehanded_horseback", "anim_ready_thrust_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_thrust_onehanded_horseback", "anim_release_thrust_twohanded"),
                (agent_set_personal_animation, ":agent_no", "anim_release_thrust_onehanded_horseback_continue", "anim_release_thrust_twohanded_continue"),
           
                (agent_set_slot, ":agent_no", slot_agent_personal_animation, 1), # Stores that this agent is using a modified animation set
            (try_end),
        (else_try),  
            #restore default animation   ##WSE
            (agent_slot_eq, ":agent_no", slot_agent_personal_animation, 1),        # Is currently using a modified animation set while they shouldn't
           
            (agent_set_default_animations, ":agent_no"),                        # Revert the animations to default
           
            (agent_set_slot, ":agent_no", slot_agent_personal_animation, 0),    # And update this slot so we know their animations are at default
        (try_end),
    ])
##Wuan

The only issue I can see would be for mods using personal animations elsewhere, so agent_set_default_animations may cause them issues, but, in that case they could set up a loop to check if the personal animation is assigned to the relevant slots above using agent_get_personal_animation and comparing it to the default animation.
There is a problem. If the wielded item is a shield on the left hand, the weapon on the right hand is should be judged the item type. So I add the following code on the next line of
"(item_get_type, ":wp_type", ":item"),"
Code:
        (try_begin),
            (eq, ":wp_typ", itp_type_shield),                    ##If the item type is shield
            (agent_get_wielded_item, ":item", ":agent_no", 0),                ##Get the left hand weapon
        (try_end),
In addition, if a sheild is unwielded, it should also be judged to change animations, so I added another trgger: "ti_on_item_unwielded".
Although the code is more, I believe that using ti_trigger will have better performance and no delay.
The above code has been updated. Thanks again for your correction.
 
That's a great point! I was only thinking of the shield being equipped after the weapon, but someone could possibly cheese it by purposefully equipping the shield first then equipping the weapon and get benefits of both wielding a shield and getting the two hander animations.

This is why community collaboration is so powerful. We can cover each other's biases and blind spots.

I am excited to see future work from you!
 
That's a great point! I was only thinking of the shield being equipped after the weapon, but someone could possibly cheese it by purposefully equipping the shield first then equipping the weapon and get benefits of both wielding a shield and getting the two hander animations.

This is why community collaboration is so powerful. We can cover each other's biases and blind spots.

I am excited to see future work from you!
Let Warband great again:smile:!
 
Simply put: I found that in ti_on_item_wielded, (agent_get_wielded_item, ":shield", ":agent_no", 1) this code gets the offhand item before the agent wielded the item. This leads to the inability to correctly determine whether the offhand has a shield.
@SupaNinjaMan

I think there is no problem now, thanks for discussing with you.@SupaNinjaMan

Today I added two trigger judgment for mount and dismount to ensure accuracy animation.
 
I added a new animation from a frame of run_forward_staff, which is a little stiff. You can add it if you want.
Added in module_animations.py
Code:
["ride_forward_staff", acf_enforce_lowerbody | acf_synch_with_horse, amf_client_prediction|amf_priority_ride|amf_play,
[0.8, "run_forward_staff", 0, 0, arf_cyclic,pack2f(0.4,0.9), (0, 0, 0), 0.4],
],
Remember to comment out an unused_human_anim, every time you add a animation should comment out an unused_human_anim;
Then in script_cf_agent_set_personal_animation add the following two lines to the corresponding position:
Code:
(agent_set_personal_animation, ":agent_no", "anim_lancer_ride_0", "anim_stand_staff"),                          
(agent_set_personal_animation, ":agent_no", "anim_lancer_ride_1", "anim_ride_forward_staff"),
WRhVX.gif
 
Last edited:
Back
Top Bottom