It's not pure mine, its just a compilation.
[OSP] AI Shield Bash based on shield skill.
More shield skill - more chance for bashing.
In module_mission_templates.py
and second part
add a trigger to every mission.
cause i'm to lazy, i "glued" it to diplomacy trigger
[OSP] AI Shield Bash based on shield skill.
More shield skill - more chance for bashing.
In module_mission_templates.py
Code:
ai_shield_bash = (3, 0, 0,[],
[
#(eq,"$mmc_ai_shield_bash",1),
(get_player_agent_no,":player_agent"),
(try_for_agents, ":agent_no"),
(neq,":agent_no", ":player_agent"),
(agent_get_troop_id, ":troop_sb_id", ":agent_no"),
(store_skill_level, ":skill_shield", "skl_shield", ":troop_sb_id"),
(ge,":skill_shield",1),#set needed level of skill_shield for bashing
(agent_is_alive, ":agent_no"),
(agent_is_human, ":agent_no"),#Only humans can kick....FOR NOW
(agent_is_active, ":agent_no"),
#-----------------------------------Garedyr begin
(agent_get_horse, ":horse", ":agent_no"),
(eq, ":horse", -1), #agent cannot be mounted
#-----------------------------------Garedyr end
(agent_slot_eq, ":agent_no", slot_agent_is_running_away, 0),#Isn't fleeing the battle.
(agent_get_wielded_item, ":shield_item", ":agent_no", 1),# what agent has in the left hand
(gt, ":shield_item", itm_no_item),#its item
(item_get_type, ":type", ":shield_item"),#
(eq, ":type", itp_type_shield),# it's shield
(agent_get_animation, ":anim", ":agent_no", 0),
(neq, ":anim", "anim_shield_bash"),
(agent_get_attack_action, ":attack_action", ":agent_no"),
(agent_get_defend_action, ":defend_action", ":agent_no"),
(this_or_next|eq,":attack_action",4),#Just got parried
(this_or_next|eq,":defend_action",1),#Parrying an enemy
##So he'll only try to kick if he just parried an enemy attack, or his own attack just got parried.
(agent_get_team, ":team", ":agent_no"),
(assign, ":maximum_distance", 100), #100 cm / 1m
#Target Acquisition
(agent_ai_get_look_target,":victim",":agent_no"),
(gt,":victim",0),#Make sure there is someone.
(agent_is_alive, ":victim"),
(agent_is_human, ":victim"),#Only kick humans
(agent_is_active, ":victim"),
#-----------------------------------Garedyr begin
(agent_get_horse, ":v_horse", ":victim"),
(eq, ":v_horse", -1), #victim agent cannot be mounted too
#-----------------------------------Garedyr end
(agent_get_team, ":v_team", ":victim"),
(teams_are_enemies, ":v_team", ":team"),
(agent_get_position, pos1, ":agent_no"),#Distance check
(position_move_y, pos1, 75),#75 cm directly ahead, so it's not a cuboid space around player center
(agent_get_position, pos2, ":victim"),
(neg|position_is_behind_position, pos2, pos1), #victim can't be behind basher.
(get_distance_between_positions, ":distance", pos1, pos2),
(le, ":distance", ":maximum_distance"),
(try_begin),
(val_mul, ":skill_shield", 3),#3 percent chance to bash per shield skill
(store_random_in_range, ":random", 1, 100),
(le,":random",":skill_shield"),
(store_mul, ":bs_damage", ":skill_shield",2),#
(agent_set_animation, ":agent_no","anim_shield_bash"),
(agent_get_troop_id, ":id", ":agent_no"),
(troop_get_type, ":type", ":id"),
(try_begin),
(eq, ":type", tf_male),
(agent_play_sound, ":agent_no", "snd_man_yell"),
(else_try),
(agent_play_sound, ":agent_no", "snd_woman_yell"),
(try_end),
(agent_play_sound, ":agent_no", "snd_wooden_hit_low_armor_high_damage"),
(agent_set_animation, ":victim", "anim_shield_strike"),
(agent_deliver_damage_to_agent, ":agent_no", ":victim", ":bs_damage", "itm_tutorial_club"),
(try_end),
(try_end),
])
#Shield Bash end
and second part
add a trigger to every mission.
cause i'm to lazy, i "glued" it to diplomacy trigger
Code:
dplmc_battle_mode_triggers = [
dplmc_horse_speed,
dplmc_death_camera,
AI_pickup_weapon,
AI_kick,
ai_shield_bash,
heretics,
]