Pommel bash script help

Users who are viewing this thread

Reks

Recruit
So I've struggled for the past few hours trying to figure out how to make a pommel bash attack, the idea is to have it work just like the shield bash attack but when you're using just a weapon (IE: two hander, polearm, or just a one hander with no shield) problem is I can't for the life of me get it to work, I have an animation that works fine the problem is the syntax in module_scripts, module_mission_templates and module_animations. I was trying to edit the shield bash code for my own purposes but to no success.

Here is my attempt, if someone could help me that would be great.

here's what I have in module_scripts:
#pommel Bash Script
("cf_pommel_bash",
  [ 
(agent_get_animation, ":anim", "$fplayer_agent_no", 0),
(neq, ":anim", "anim_pommel_bash"),
(agent_get_horse, ":horse", "$fplayer_agent_no"),
(eq, ":horse", -1),
(agent_get_defend_action, ":action", "$fplayer_agent_no"),
(eq, ":action", 2), #Blocking.
(agent_get_wielded_item, ":sword_item", "$fplayer_agent_no", 1),
(gt, ":sword_item", itm_no_item),
(item_get_type, ":type", ":sword_item"),
(eq, ":type", itp_type_shield),
(item_get_slot, ":sword_width", ":sword_item", slot_item_length),
(ge, ":sword_width", 0), ##FLORIS, balance as needed

#(set_fixed_point_multiplier, 100),
##Fail above this point--don't allow fail after, so the failure/re-arm goes with the firing of the animation
(agent_set_animation, "$fplayer_agent_no","anim_pommel_bash"),
(agent_get_position, pos63, "$fplayer_agent_no"),
(position_move_y, pos63, 75),#75 cm directly ahead, so it's not a cuboid space around player center
(agent_get_troop_id, ":id", "$fplayer_agent_no"),
(troop_get_type, ":type", ":id"),
(try_begin),
(eq, ":type", tf_male),
(agent_play_sound, "$fplayer_agent_no", "snd_man_yell"),
(else_try),
(agent_play_sound, "$fplayer_agent_no", "snd_woman_yell"),
(try_end),

(assign, ":victim", -1),
(assign, ":closest_dist", 100),
(try_for_agents,":agent"),
(neq, ":agent", "$fplayer_agent_no"),
(neg|agent_is_ally,":agent"),#don't bash allies
(agent_is_human, ":agent"),#stop if not human
(agent_is_alive,":agent"),
(agent_get_horse, ":horse", ":agent"),
(eq, ":horse", -1),

(agent_get_position,pos62,":agent"),
(neg|position_is_behind_position, pos62, pos63),
(get_distance_between_positions,":dist",pos63,pos62),
(le, ":dist", ":closest_dist"),
(assign, ":victim", ":agent"),
(assign, ":closest_dist", ":dist"),
(try_end),
(try_begin),
(ge, ":victim", 0),
(agent_play_sound, "$fplayer_agent_no", "snd_wooden_hit_low_armor_high_damage"),
#(set_fixed_point_multiplier, 100),
#(position_move_y,pos62,-25),
#(agent_set_position, ":victim", pos62),
(agent_set_animation, ":victim", "anim_shield_strike"),
(try_end),
  ]), 
#End pommel bash script

here is what I have in module_mission_templates:
pommel_bash = ( #in pbod_common_triggers
  0, 0, 1,
  [
(game_key_is_down, gk_defend),
(key_clicked, "$key_special_3"),
(neg|main_hero_fallen),
(ge, "$fplayer_agent_no", 0),
(call_script, "script_cf_pommel_bash"),
  ],[])

common_pbod_triggers = [
  init_player_global_variables,
 
  #Fix for setting divisions, duplicated in formations code, so disabled in mst_lead_charge
  (ti_on_agent_spawn, 0, 0, [(neq, "$g_next_menu", "mnu_simple_encounter"),(neq, "$g_next_menu", "mnu_join_battle")], [(store_trigger_param_1, ":agent"),(call_script, "script_prebattle_agent_fix_division", ":agent")]),
  (0.5, 0, 0, [(neq, "$g_next_menu", "mnu_simple_encounter"), #not mst_lead_charge (or the various village raid templates...will be better with WSE)
  (neq, "$g_next_menu", "mnu_join_battle"),
  (store_mission_timer_a, reg0),(gt, reg0, 4)],
  [
    (try_for_agents, ":agent"),
(agent_is_alive, ":agent"),
(agent_slot_ge, ":agent", slot_agent_new_division, 0),
    (agent_get_division, ":division", ":agent"),
(neg|agent_slot_eq, ":agent", slot_agent_new_division, ":division"),
(agent_get_slot, ":division", ":agent", slot_agent_new_division),
(agent_set_division, ":agent", ":division"),
(try_end), 
  ]),
 
  pommel_bash,
]

and finally what I have in module_animations:
##pommel bash
["pommel_bash", acf_enforce_all, amf_play|amf_priority_striked|amf_use_defend_speed|amf_client_owner_prediction,
  [0.75, "pommel_bash", 0, 30, blend_in_defense],
  # [0.75, "defend_onehanded_parry_all", 1, 50, blend_in_defense], #Adjust duration for balance.  Currently at 0.75 seconds, fixed.
  # [0.75, "defend_right_onehanded ", 1, 50, blend_in_defense],
  # [0.75, "defend_left_onehanded", 1, 50, blend_in_defense],
  # [0.75, "defend_right_onehanded ", 1, 50, blend_in_defense], 
],
["shield_strike", acf_enforce_all|acf_align_with_ground, amf_priority_striked|amf_play|amf_accurate_body|amf_restart,
[2, "anim_human", blow+5000, blow+5010, arf_blend_in_3|arf_make_custom_sound], 
[2.5, "anim_human", blow+5400, blow+5453, arf_blend_in_2|arf_make_custom_sound],
[2.5, "anim_human", blow+5400, blow+5445, arf_blend_in_2|arf_make_custom_sound], 
  ],
##
]

If it seems like I have no idea what I'm doing, its because I don't. again, any help would be appreciated.
 
I don't know if you had a compile error, an in-game error or the code just won't do what you want to do, but anyway, here the script is still checking whether the player has a shield equipped or not.
(agent_get_wielded_item, ":sword_item", "$fplayer_agent_no", 1),
(gt, ":sword_item", itm_no_item),
(item_get_type, ":type", ":sword_item"),
(eq, ":type", itp_type_shield),
This is retrieving the item reference wielded in the left hand (1) which is always valid for shields.
I guess it should be like this:
Code:
 (agent_get_wielded_item, ":sword_item", "$fplayer_agent_no", 0), #Right hand
(gt, ":sword_item", itm_no_item),
(item_get_type, ":type", ":sword_item"),
(is_between, ":type", itp_type_one_handed_wpn, itp_type_arrows), #One handed, two handed or polearm
 
It wasn't doing anything before, no errors when compiling or anything but I'll have to give your script a shot, but what I'm aiming for is to be able to pommel bash when blocking with 1h/2h swords.

Thanks for the help I'll give that a try.

EDIT: Still doesn't do anything. No compile errors or anything, just doesn't trigger the animation. No idea where the error is in the script but I'm sure thats where the problem lies.
 
Hmm, it should work, unless common_pbod_triggers isn't included in the mission template you want (e.g. "lead_charge").
Also, you can try displaying debug messages in your trigger and script after each condition, to see exactly where the problem occurs.
 
I'll go try that and see if I can figure it out but like I said in my OP I don't really know what I'm doing. I'll post the original shield bash script and maybe you can see where I went wrong.

Module_scripts:
#Shield Bash Script - Xenoargh (Blood & Steel); edited/reworked per comments in the thread, etc, by Caba
("cf_shield_bash",
  [ 
(agent_get_animation, ":anim", "$fplayer_agent_no", 0),
(neq, ":anim", "anim_shield_bash"),
(agent_get_horse, ":horse", "$fplayer_agent_no"),
(eq, ":horse", -1),
(agent_get_defend_action, ":action", "$fplayer_agent_no"),
(eq, ":action", 2), #Blocking.
(agent_get_wielded_item, ":shield_item", "$fplayer_agent_no", 1),
(gt, ":shield_item", itm_no_item),
(item_get_type, ":type", ":shield_item"),
(eq, ":type", itp_type_shield),
(item_get_slot, ":shield_width", ":shield_item", slot_item_length),
(ge, ":shield_width", 50), ##FLORIS, balance as needed

#(set_fixed_point_multiplier, 100),
##Fail above this point--don't allow fail after, so the failure/re-arm goes with the firing of the animation
(agent_set_animation, "$fplayer_agent_no","anim_shield_bash"),
(agent_get_position, pos63, "$fplayer_agent_no"),
(position_move_y, pos63, 75),#75 cm directly ahead, so it's not a cuboid space around player center
(agent_get_troop_id, ":id", "$fplayer_agent_no"),
(troop_get_type, ":type", ":id"),
(try_begin),
(eq, ":type", tf_male),
(agent_play_sound, "$fplayer_agent_no", "snd_man_yell"),
(else_try),
(agent_play_sound, "$fplayer_agent_no", "snd_woman_yell"),
(try_end),

(assign, ":victim", -1),
(assign, ":closest_dist", 100),
(try_for_agents,":agent"),
(neq, ":agent", "$fplayer_agent_no"),
(neg|agent_is_ally,":agent"),#don't bash allies
(agent_is_human, ":agent"),#stop if not human
(agent_is_alive,":agent"),
(agent_get_horse, ":horse", ":agent"),
(eq, ":horse", -1),

(agent_get_position,pos62,":agent"),
(neg|position_is_behind_position, pos62, pos63),
(get_distance_between_positions,":dist",pos63,pos62),
(le, ":dist", ":closest_dist"),
(assign, ":victim", ":agent"),
(assign, ":closest_dist", ":dist"),
(try_end),
(try_begin),
(ge, ":victim", 0),
(agent_play_sound, "$fplayer_agent_no", "snd_wooden_hit_low_armor_high_damage"),
#(set_fixed_point_multiplier, 100),
#(position_move_y,pos62,-25),
#(agent_set_position, ":victim", pos62),
(agent_set_animation, ":victim", "anim_shield_strike"),
(try_end),
  ]), 
#End Shield Bash Script - Xenoargh

Module_mission_templates:
shield_bash = ( #in pbod_common_triggers
  0, 0, 1,
  [
(game_key_is_down, gk_defend),
(key_clicked, "$key_special_3"),
(neg|main_hero_fallen),
(ge, "$fplayer_agent_no", 0),
(call_script, "script_cf_shield_bash"),
  ],[])

common_pbod_triggers = [
  init_player_global_variables,
 
  #Fix for setting divisions, duplicated in formations code, so disabled in mst_lead_charge
  (ti_on_agent_spawn, 0, 0, [(neq, "$g_next_menu", "mnu_simple_encounter"),(neq, "$g_next_menu", "mnu_join_battle")], [(store_trigger_param_1, ":agent"),(call_script, "script_prebattle_agent_fix_division", ":agent")]),
  (0.5, 0, 0, [(neq, "$g_next_menu", "mnu_simple_encounter"), #not mst_lead_charge (or the various village raid templates...will be better with WSE)
  (neq, "$g_next_menu", "mnu_join_battle"),
  (store_mission_timer_a, reg0),(gt, reg0, 4)],
  [
    (try_for_agents, ":agent"),
(agent_is_alive, ":agent"),
(agent_slot_ge, ":agent", slot_agent_new_division, 0),
    (agent_get_division, ":division", ":agent"),
(neg|agent_slot_eq, ":agent", slot_agent_new_division, ":division"),
(agent_get_slot, ":division", ":agent", slot_agent_new_division),
(agent_set_division, ":agent", ":division"),
(try_end), 
  ]),
 
  shield_bash,
]

Module_animations:
##Shield Bash by Xeno, animation by Papa Larazou
["shield_bash", acf_enforce_all, amf_play|amf_priority_striked|amf_use_defend_speed|amf_client_owner_prediction,
  [0.75, "shield_bash", 0, 30, blend_in_defense],
  # [0.75, "defend_shield_parry_all", 1, 50, blend_in_defense], #Adjust duration for balance.  Currently at 0.75 seconds, fixed.
  # [0.75, "defend_shield_right", 1, 50, blend_in_defense],
  # [0.75, "defend_shield_left", 1, 50, blend_in_defense],
  # [0.75, "defend_shield_right", 1, 50, blend_in_defense], 
],
["shield_strike", acf_enforce_all|acf_align_with_ground, amf_priority_striked|amf_play|amf_accurate_body|amf_restart,
[2, "anim_human", blow+5000, blow+5010, arf_blend_in_3|arf_make_custom_sound], 
[2.5, "anim_human", blow+5400, blow+5453, arf_blend_in_2|arf_make_custom_sound],
[2.5, "anim_human", blow+5400, blow+5445, arf_blend_in_2|arf_make_custom_sound], 
  ],
##

EDIT: Still no luck, is there anywhere or anyone you would recommend bringing this issue to?
 
You might get another answer if you post it in the Mod Makers Q&A Thread.
Btw, I even tested it with PBOD and it works for me (I used exactly the same code but with the shield animation, obviously). Your problem maybe outside the script/trigger, e.g. with the mission template or the animation (I know nothing about animations so I don't think I can help with that).
 
Back
Top Bottom