##dedal begin
dedal_tavern_animations = (
ti_on_agent_spawn,1,0,[
(eq, "$talk_context", tc_tavern_talk),
(store_trigger_param_1,":agent"),
(agent_get_troop_id,":troop",":agent"),
(try_begin),
(is_between,":troop","trp_musican_male","trp_musicans_end"),
(try_begin),
(agent_has_item_equipped,":agent","itm_dedal_lutnia"),
(agent_set_stand_animation, ":agent", "anim_lute_sitting"),
(agent_set_animation, ":agent", "anim_lute_sitting"),
(agent_play_sound,":agent","snd_dedal_tavern_lute"),
(else_try),
(agent_has_item_equipped,":agent","itm_dedal_lira"),
(agent_set_stand_animation, ":agent", "anim_lyre_sitting"),
(agent_set_animation, ":agent", "anim_lyre_sitting"),
(agent_play_sound,":agent","snd_dedal_tavern_lyre"),
(try_end),
(store_random_in_range,":r",0,300),
(agent_set_animation_progress,":agent",":r"),
(else_try),
(is_between,":troop",tavern_minstrels_begin,tavern_minstrels_end),
(try_begin),
(agent_has_item_equipped,":agent","itm_dedal_lutnia"),
(agent_set_stand_animation, ":agent", "anim_lute_standing"),
(agent_set_animation, ":agent", "anim_lute_standing"),
(agent_play_sound,":agent","snd_dedal_tavern_lute"),
(else_try),
(agent_has_item_equipped,":agent","itm_dedal_lira"),
(agent_set_stand_animation, ":agent", "anim_lyre_standing"),
(agent_set_animation, ":agent", "anim_lyre_standing"),
(agent_play_sound,":agent","snd_dedal_tavern_lyre"),
(try_end),
(store_random_in_range,":r",0,300),
(agent_set_animation_progress,":agent",":r"),
(else_try),
(is_between,":troop",walkers_begin,walkers_end),
(try_begin),
(agent_has_item_equipped,":agent","itm_dedal_kufel"),
(agent_set_stand_animation, ":agent", "anim_sitting_drinking_low"),
(agent_set_animation, ":agent", "anim_sitting_drinking_low"),
(store_random_in_range,":r",0,300),
(else_try),
(agent_set_stand_animation, ":agent", "anim_sitting_low"),
(agent_set_animation, ":agent", "anim_sitting_low"),
(store_random_in_range,":r",0,300),
(try_end),
(agent_set_animation_progress,":agent",":r"),
(try_end),
],[])
##dedal end
mission_templates = [
(
("town_default",0,-1,
"Default town visit",[
(0,mtef_scene_source|mtef_team_0,af_override_horse,0,1,pilgrim_disguise),
(1,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),
(2,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),
(3,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),
(4,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),
(5,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),
(6,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),
(7,mtef_scene_source|mtef_team_0,af_override_horse,0,1,[]),
(8,mtef_scene_source,af_override_horse,0,1,[]),
(9,mtef_scene_source,af_override_horse,0,1,[]),
(10,mtef_scene_source,af_override_horse,0,1,[]),
(11,mtef_scene_source,af_override_horse,0,1,[]),
(12,mtef_scene_source,af_override_horse,0,1,[]),
(13,mtef_scene_source,0,0,1,[]),
(14,mtef_scene_source,0,0,1,[]),
(15,mtef_scene_source,0,0,1,[]),
(16,mtef_visitor_source,af_override_horse,0,1,[]),
(17,mtef_visitor_source,af_override_horse,0,1,[]),
(18,mtef_visitor_source,af_override_horse,0,1,[]),
(19,mtef_visitor_source,af_override_horse,0,1,[]),
(20,mtef_visitor_source,af_override_horse,0,1,[]),
(21,mtef_visitor_source,af_override_horse,0,1,[]),
(22,mtef_visitor_source,af_override_horse,0,1,[]),
(23,mtef_visitor_source,af_override_horse,0,1,[]),
(24,mtef_visitor_source,af_override_horse,0,1,[]),
(25,mtef_visitor_source,af_override_horse,0,1,[]),
(26,mtef_visitor_source,af_override_horse,0,1,[]),
(27,mtef_visitor_source,af_override_horse,0,1,[]),
(28,mtef_visitor_source,af_override_horse,0,1,[]),
(29,mtef_visitor_source,af_override_horse,0,1,[]),
(30,mtef_visitor_source,af_override_horse,0,1,[]),
(31,mtef_visitor_source,af_override_horse,0,1,[]),
#dedal begin
(1,mtef_visitor_source,af_override_horse|af_override_gloves,0,1,[]),#32
(2,mtef_visitor_source,af_override_horse|af_override_gloves,0,1,[]),#33
(3,mtef_visitor_source,af_override_horse|af_override_gloves,0,1,[]),#34
(4,mtef_visitor_source,af_override_horse|af_override_gloves,0,1,[]),#35
(5,mtef_visitor_source,af_override_horse|af_override_gloves,0,1,[]),#36
(6,mtef_visitor_source,af_override_horse|af_override_gloves,0,1,[]),#37
(7,mtef_visitor_source,af_override_horse|af_override_gloves,0,1,[]),#38
(8,mtef_visitor_source,af_override_horse|af_override_gloves,0,1,[]),#39
(10,mtef_visitor_source,af_override_horse|af_override_gloves,0,1,[]),#40
],[
dedal_tavern_animations,
#dedal end
[
(1, 0, ti_once, [],
[
(store_current_scene, ":cur_scene"),
(scene_set_slot, ":cur_scene", slot_scene_visited, 1),
(try_begin),
(gt, "$sneaked_into_town", disguise_none),
(call_script, "script_music_set_situation_with_culture", mtf_sit_town_infiltrate),
(else_try),
(eq, "$talk_context", tc_tavern_talk),
(call_script, "script_music_set_situation_with_culture", mtf_sit_tavern),
(else_try),
(call_script, "script_music_set_situation_with_culture", mtf_sit_town),
(try_end),
]),
(ti_before_mission_start, 0, 0, [],
[
(call_script, "script_change_banners_and_chest"),
(call_script, "script_initialize_tavern_variables"),
]),
#SB : minstrels equip instruments
(ti_on_agent_spawn, 0, 0,
[
(eq, "$talk_context", tc_tavern_talk),
(store_trigger_param_1, ":agent_no"),
(agent_get_troop_id, ":troop_no", ":agent_no"),
(is_between, ":troop_no", tavern_minstrels_begin, tavern_minstrels_end),
(this_or_next|troop_slot_eq, ":troop_no", slot_troop_cur_center, "$current_town"),
(party_slot_eq, "$current_town", slot_center_tavern_minstrel, ":troop_no"),
],
#this only works for the "true" minstrel, last condition prohibits the one added from alternative_town in module_game_menus
[
(store_trigger_param_1, ":agent_no"),
(agent_get_troop_id, ":troop_no", ":agent_no"),
(assign, ":item_no", -1),
(store_item_kind_count, ":item_count", "itm_lyre", ":troop_no"),
(try_begin),
(this_or_next|gt, ":item_count", 0),
(troop_has_item_equipped, ":troop_no", "itm_lyre"),
(assign, ":item_no", "itm_lyre"),
(else_try),
(store_item_kind_count, ":item_count", "itm_lute", ":troop_no"),
(this_or_next|gt, ":item_count", 0),
(troop_has_item_equipped, ":troop_no", "itm_lute"),
(assign, ":item_no", "itm_lute"),
(try_end),
(neq, ":item_no", -1),
(agent_equip_item, ":agent_no", ":item_no"), #equip instrument
(agent_set_wielded_item, ":agent_no", -1), #doff it
]),
(ti_inventory_key_pressed, 0, 0,
[ #SB : disable inventory while attacked in taverns
(try_begin),
(this_or_next|eq, "$g_main_attacker_agent", 0),
(neq, "$talk_context", tc_tavern_talk),
(set_trigger_result, 1),
(else_try),
(display_message, "@Dispatch your opponents first!"),
(try_end),
], []),
#tavern - belligerent drunk leaving/fading out
(1, 0, 0,
[
(gt, "$g_belligerent_drunk_leaving", 0),
(entry_point_get_position, pos0, 0),
(agent_get_position, pos1, "$g_belligerent_drunk_leaving"),
(get_distance_between_positions, ":dist", pos0, pos1),
(le, ":dist", 150),
],
[
(agent_fade_out, "$g_belligerent_drunk_leaving"),
(assign, "$g_belligerent_drunk_leaving", 0),
]),
(ti_tab_pressed, 0, 0,
[
(try_begin),
(eq, "$g_main_attacker_agent", 0),
(set_trigger_result, 1),
(else_try),
(display_message, "str_cannot_leave_now"), #SB : message
(try_end),
], []),
#tavern brawl triggers - drunk
(2, 0, 0,
[
(neg|conversation_screen_is_active),
(eq, "$talk_context", tc_tavern_talk),
(neg|troop_slot_eq, "trp_hired_assassin", slot_troop_cur_center, "$g_encountered_party"),
(troop_slot_eq, "trp_belligerent_drunk", slot_troop_cur_center, "$g_encountered_party"),
(eq, "$drunks_dont_pick_fights", 0),
],
[
(try_begin),
(eq, "$g_start_belligerent_drunk_fight", 0),
(assign, "$g_start_belligerent_drunk_fight", 1),
(try_for_agents, ":cur_agent"),
(agent_get_troop_id, ":cur_agent_troop", ":cur_agent"),
(eq, ":cur_agent_troop", "trp_belligerent_drunk"),
(assign, "$g_belligerent_drunk", ":cur_agent"),
(try_end),
(else_try),
(eq, "$g_start_belligerent_drunk_fight", 1),
(agent_is_active, "$g_belligerent_drunk"),
(agent_is_alive, "$g_belligerent_drunk"),
(get_player_agent_no, ":player_agent"),
(agent_get_position, pos0, ":player_agent"),
(agent_get_position, pos1, "$g_belligerent_drunk"),
(get_distance_between_positions, ":dist", pos0, pos1),
(position_get_z, ":pos0_z", pos0),
(position_get_z, ":pos1_z", pos1),
(store_sub, ":z_difference", ":pos1_z", ":pos0_z"),
(try_begin),
(le, ":z_difference", 0),
(val_mul, ":z_difference", -1),
(try_end),
(store_mul, ":z_difference_mul_3", ":z_difference", 3),
(val_add, ":dist", ":z_difference_mul_3"),
(store_random_in_range, ":random_value", 0, 200),
(store_add, ":400_plus_random_200", 400, ":random_value"),
(le, ":dist", ":400_plus_random_200"),
(call_script, "script_activate_tavern_attackers"),
(start_mission_conversation, "trp_belligerent_drunk"),
(assign, "$g_start_belligerent_drunk_fight", 2),
(try_end),
]),
#tavern brawl triggers - assassin
(2, 0, 0, [
(neg|conversation_screen_is_active),
(eq, "$talk_context", tc_tavern_talk),
(troop_slot_eq, "trp_hired_assassin", slot_troop_cur_center, "$g_encountered_party"),
],
[
(try_begin),
(eq, "$g_start_hired_assassin_fight", 0),
(assign, "$g_start_hired_assassin_fight", 1),
(try_for_agents, ":cur_agent"),
(agent_get_troop_id, ":cur_agent_troop", ":cur_agent"),
(eq, ":cur_agent_troop", "trp_hired_assassin"),
(assign, "$g_hired_assassin", ":cur_agent"),
(try_end),
(else_try),
(eq, "$g_start_hired_assassin_fight", 1),
(agent_is_active, "$g_hired_assassin"),
(agent_is_alive, "$g_hired_assassin"),
(get_player_agent_no, ":player_agent"),
(agent_get_position, pos0, ":player_agent"),
(agent_get_position, pos1, "$g_hired_assassin"),
(get_distance_between_positions, ":dist", pos0, pos1),
(position_get_z, ":pos0_z", pos0),
(position_get_z, ":pos1_z", pos1),
(store_sub, ":z_difference", ":pos1_z", ":pos0_z"),
(try_begin),
(le, ":z_difference", 0),
(val_mul, ":z_difference", -1),
(try_end),
(store_mul, ":z_difference_mul_3", ":z_difference", 3),
(val_add, ":dist", ":z_difference_mul_3"),
(store_random_in_range, ":random_value", 0, 200),
(store_add, ":400_plus_random_200", 400, ":random_value"),
(le, ":dist", ":400_plus_random_200"),
(call_script, "script_activate_tavern_attackers"),
(assign, "$g_start_hired_assassin_fight", 2),
(try_end),
]),
#Aftermath talks
(3, 0, ti_once,
[
(neg|conversation_screen_is_active),
(eq, "$talk_context", tc_tavern_talk),
(gt, "$g_main_attacker_agent", 0),
(this_or_next|neg|agent_is_alive, "$g_main_attacker_agent"),
(agent_is_wounded, "$g_main_attacker_agent"),
],
[
(mission_enable_talk),
(try_for_agents, ":agent"),
(agent_is_alive, ":agent"),
(agent_get_position, pos4, ":agent"),
(agent_set_scripted_destination, ":agent", pos4),
(try_end),
(party_get_slot, ":tavernkeeper", "$g_encountered_party", slot_town_tavernkeeper),
(start_mission_conversation, ":tavernkeeper"),
]),
#Aftermath talks
(3, 0, ti_once,
[
(neg|conversation_screen_is_active),
(eq, "$talk_context", tc_tavern_talk),
(gt, "$g_main_attacker_agent", 0),
(main_hero_fallen),
],
[
(jump_to_menu, "mnu_lost_tavern_duel"),
(finish_mission,0)
]),
#No shooting in the tavern
(1, 0, 0,
[
(neg|conversation_screen_is_active),
(eq, "$talk_context", tc_tavern_talk),
(gt, "$g_main_attacker_agent", 0),
(get_player_agent_no, ":player_agent"),
(agent_is_alive, ":player_agent"),
## SB : move diplomacy standing check back up here in conditions
(call_script, "script_dplmc_get_troop_standing_in_faction", "trp_player", "$g_encountered_party_faction"),
(lt, reg0, DPLMC_FACTION_STANDING_MEMBER),
(agent_get_wielded_item, ":wielded_item", ":player_agent", 0),
(gt, ":wielded_item", 0),
(item_get_type, ":type", ":wielded_item"),
(this_or_next|is_between, ":type", itp_type_bow, itp_type_goods),
(is_between, ":type", itp_type_pistol, itp_type_bullets),
# (is_between, ":wielded_item", "itm_darts", "itm_torch"),
# (neq, ":wielded_item", "itm_javelin_melee"),
# (neq, ":wielded_item", "itm_throwing_spear_melee"),
# (neq, ":wielded_item", "itm_jarid_melee"),
# (neq, ":wielded_item", "itm_light_throwing_axes_melee"),
# (neq, ":wielded_item", "itm_throwing_axes_melee"),
# (neq, ":wielded_item", "itm_heavy_throwing_axes_melee"),
#SB : also add these conditions
],
[
(party_get_slot, ":tavernkeeper", "$g_encountered_party", slot_town_tavernkeeper),
# ##diplomacy start+
# #Turn of this !@#$%ing obnoxious and totally illogical restriction provided:
# (try_begin),
# #1) there is an actual fight
# (gt, "$g_main_attacker_agent", 0),
# (agent_is_alive, "$g_main_attacker_agent"),
# (neg|agent_is_wounded, "$g_main_attacker_agent"),
# #2) the player is the lord of this town, a mercenary captain in the kingdom's employ, or ruler of this kingdom
# (store_faction_of_party , ":center_faction", "$g_encountered_party"),
# (this_or_next|eq, ":center_faction", "$players_kingdom"),
# (eq, ":center_faction", "fac_player_supporters_faction"),
# (else_try),
# #Else, original behavior:
(start_mission_conversation, ":tavernkeeper"),
# (try_end),
##diplomacy stop+
]),
#SB : drunks are totally effective fighters
(3, 0, 0,
[
(eq, "$talk_context", tc_tavern_talk),
(ge, "$g_start_belligerent_drunk_fight", 1),
(gt, "$g_main_attacker_agent", 0),
(agent_is_alive, "$g_main_attacker_agent"),
# (eq, "$g_belligerent_drunk_leaving", 0), #don't stumble while leaving
(store_random_in_range, ":random_no", 0, 3),
(eq, ":random_no", 0),
],
[
# (store_random_in_range, ":anim", "anim_strike_chest_front_stop", "anim_cheer"),
(store_random_in_range, ":anim", "anim_strike3_head_left", "anim_fall_face_hold"),
(agent_set_animation, "$g_main_attacker_agent", ":anim"),
(store_random_in_range, ":progress", 0, 100),
(agent_set_animation_progress, "$g_main_attacker_agent", ":progress"),
]),
#Check for weapon in hand of attacker, also, everyone gets out of the way
(1, 0, 0,
[
(gt, "$g_main_attacker_agent", 0),
],
[
(agent_get_wielded_item, ":wielded_item", "$g_main_attacker_agent", 0),
(val_max, "$g_attacker_drawn_weapon", ":wielded_item"),
(call_script, "script_neutral_behavior_in_fight"),
]),
],
),