Trying to reimplement the Four Ways Inn, came across some issues

Users who are viewing this thread

I know this isn't a new topic, but since nobody thus far bothered to upload a tutorial for this, I figured I'd still try to do it myself.
So, first thing's first, remove the 'disabled' flag in mod_parties. Done. Then I edited the 'four_ways_inn' scene in mod_scenes so the game uses a tavern scene instead of the encounter scene. Then, in mod_game_menus I edited the entry for the Four Ways Inn so it displays a menu on entry where you can choose to enter, wait, or leave instead of just automatically spawning in the scene. Additionally, I copied the tavern entry from regular taverns and edited it slightly, removing a few things (code below). Here's where the issues start:
1) The tavern code has a 'cur_town' function that's needed for refreshing tavern visitors. I tried changing it to 'cur_party' and other options, but compilation gives me an error, so the best thing I can do is to comment it out until further notice. If I comment it out, it compiles no problem, but no tavern visitors seem to work.
2) When choosing to rest at the tavern, no money is subtracted from me, so I can rest indefinitely no problem. I copied the 'wait here for some time' code from towns, but the added code doesn't seem to do much, so methinks there's another entry in some other file. Additionally, in the menu, instead of saying 'Wait here for some time (x denars)' it says 'Wait here for some time (current game date)'.
3) When entering the scene, I always spawn mounted despite the fact that I assigned the 'interior' flag to the scene. (ironically, in the salt mine scene I always spawn on foot despite the scene being 'outdoors')
And here's the Four Ways Inn code below, with all my edits:
"four_ways_inn",mnf_enable_hot_keys,
"You approach the Four Ways Inn.",
"none",
[],
[
("enter",[],"Enter the Four Ways Inn.",
[(set_jump_mission,"mt_ai_training"),
(jump_to_scene,"scn_four_ways_inn_interior"),
(assign, "$talk_context", tc_tavern_talk),
(call_script, "script_initialize_tavern_variables"),

(store_random_in_range, ":randomize_attacker_placement", 0, 4),

# (modify_visitors_at_site, ":cur_town"),
(reset_visitors),

(assign, ":cur_entry", 17),

#this is just a cheat right now
#(troop_set_slot, "trp_belligerent_drunk", slot_troop_cur_center, "$g_encountered_party"),
(try_begin),
(eq, "$cheat_mode", 1),
(troop_get_slot, ":drunk_location", "trp_belligerent_drunk", slot_troop_cur_center),
(try_begin),
(eq, "$cheat_mode", 0),
(else_try),
(is_between, ":drunk_location", centers_begin, centers_end),
(str_store_party_name, s4, ":drunk_location"),
(display_message, "str_belligerent_drunk_in_s4"),
(else_try),
(display_message, "str_belligerent_drunk_not_found"),
(try_end),

(troop_get_slot, ":promoter_location", "trp_fight_promoter", slot_troop_cur_center),
(try_begin),
(eq, "$cheat_mode", 0),
(else_try),
(is_between, ":promoter_location", centers_begin, centers_end),
(str_store_party_name, s4, ":promoter_location"),
(display_message, "str_roughlooking_character_in_s4"),
(else_try),
(display_message, "str_roughlooking_character_not_found"),
(try_end),
(try_end),

#this determines whether or not a lord who dislikes you will commission an assassin
(try_begin),
(store_current_hours, ":hours"),
(store_sub, ":hours_since_last_attempt", ":hours", "$g_last_assassination_attempt_time"),
(gt, ":hours_since_last_attempt", 16:cool:,
##diplomacy start+ Support ladies owning fiefs
#(try_for_range, ":lord", active_npcs_begin, active_npcs_end),
(try_for_range, ":lord", heroes_begin, heroes_end),
(this_or_next|is_between, ":lord", active_npcs_begin, active_npcs_end),
(troop_slot_eq, ":lord", slot_troop_occupation, slto_kingdom_hero),
#Make sure they're not retired or dead
(neg|troop_slot_ge, ":lord", slot_troop_occupation, slto_retirement),
#add support for non-noble personalities
(this_or_next|troop_slot_eq, ":lord", slot_lord_reputation_type, lrep_ambitious),#"Lady MacBeth"
(this_or_next|troop_slot_eq, ":lord", slot_lord_reputation_type, lrep_roguish),
##diplomacy end+
(troop_slot_eq, ":lord", slot_lord_reputation_type, lrep_debauched),
(troop_get_slot, ":led_party", ":lord", slot_troop_leaded_party),
(party_is_active, ":led_party"),
(party_get_attached_to, ":led_party_attached", ":led_party"),
(eq, ":led_party_attached", "$g_encountered_party"),
(call_script, "script_troop_get_relation_with_troop", "trp_player", ":lord"),
(lt, reg0, -20),
(assign, "$g_last_assassination_attempt_time", ":hours"),
# (assign, "$g_last_assassination_attempt_location", "$g_encountered_party"),
# (assign, "$g_last_assassination_attempt_perpetrator", ":lord"),

(troop_set_slot, "trp_hired_assassin", slot_troop_cur_center, "$g_encountered_party"),
(try_end),
##diplomacy start+
#"Lady MacBeth" noblewomen will also attempt to have people killed on their husbands' behalf.
(lt, "$g_last_assassination_attempt_time", ":hours"),
(neg|troop_slot_eq, "trp_hired_assassin", slot_troop_cur_center, "$g_encountered_party"),
(try_for_range, ":lady", kingdom_ladies_begin, kingdom_ladies_end),
(troop_slot_eq, ":lady", slot_troop_cur_center, "$g_encountered_party"),
(troop_slot_eq, ":lady", slot_lord_reputation_type, lrep_ambitious),#"Lady MacBeth"
(troop_slot_eq, ":lady", slot_troop_occupation, slto_kingdom_lady),

(call_script, "script_troop_get_player_relation", ":lady"),
(lt, reg0, 1),
#Will send an assassin if she doesn't like the player, and either she or her husband
#is at -20 or worse with the player.
(try_begin),
(ge, reg0, -20),
(troop_slot_ge, ":lady", slot_troop_spouse, 1),
(troop_get_slot, reg0, ":lady", slot_troop_spouse),
(call_script, "script_troop_get_player_relation", reg0),
(try_end),
(lt, reg0, -20),

(assign, "$g_last_assassination_attempt_time", ":hours"),
(troop_set_slot, "trp_hired_assassin", slot_troop_cur_center, "$g_encountered_party"),
(try_end),
##diplomacy end+
(try_end),

(try_begin),
(eq, ":randomize_attacker_placement", 0),
(call_script, "script_setup_tavern_attacker", ":cur_entry"),

(val_add, ":cur_entry", 1),
(try_end),

(try_begin),
(eq, 1, 0),
(troop_slot_eq, "trp_fight_promoter", slot_troop_cur_center, "$current_town"),
(set_visitor, ":cur_entry", "trp_fight_promoter"),

(val_add, ":cur_entry", 1),
(try_end),

(party_get_slot, ":mercenary_troop", "$current_town", slot_center_mercenary_troop_type),
(party_get_slot, ":mercenary_amount", "$current_town", slot_center_mercenary_troop_amount),
(try_begin),
(gt, ":mercenary_troop", 0),
(gt, ":mercenary_amount", 0),
(set_visitor, ":cur_entry", ":mercenary_troop"),
(val_add, ":cur_entry", 1),
(try_end),

(try_begin),
(eq, ":randomize_attacker_placement", 1),
(call_script, "script_setup_tavern_attacker", ":cur_entry"),
(val_add, ":cur_entry", 1),
(try_end),

(try_for_range, ":companion_candidate", companions_begin, companions_end),
(troop_slot_eq, ":companion_candidate", slot_troop_occupation, 0),
(troop_slot_eq, ":companion_candidate", slot_troop_cur_center, "$current_town"),
(neg|troop_slot_ge, ":companion_candidate", slot_troop_prisoner_of_party, centers_begin),

(set_visitor, ":cur_entry", ":companion_candidate"),

(val_add, ":cur_entry", 1),
(try_end),

(try_begin),
(eq, ":randomize_attacker_placement", 2),
(call_script, "script_setup_tavern_attacker", ":cur_entry"),
(val_add, ":cur_entry", 1),
(try_end),

(try_begin), #this doubles the incidence of ransom brokers and (below) minstrels
(party_get_slot, ":ransom_broker", "$current_town", slot_center_ransom_broker),
(gt, ":ransom_broker", 0),

# (assign, reg0, ":ransom_broker"),
# (assign, reg1, "$current_town"),

(set_visitor, ":cur_entry", ":ransom_broker"),
(val_add, ":cur_entry", 1),
(else_try), #SB : move to script call
# (is_between, "$g_talk_troop", ransom_brokers_begin, ransom_brokers_end), #wtf is this
(call_script, "script_cf_find_alternative_town_for_taverngoers", "$current_town", 9),
(assign, ":alternative_town", reg0),

(party_get_slot, ":ransom_broker", ":alternative_town", slot_center_ransom_broker),
(is_between, ":ransom_broker", ransom_brokers_begin, ransom_brokers_end), #prevent ramun and galeas from spawning other towns

(set_visitor, ":cur_entry", ":ransom_broker"),
(val_add, ":cur_entry", 1),
(try_end),

(try_begin),
(party_get_slot, ":tavern_traveler", "$current_town", slot_center_tavern_traveler),
(is_between, ":tavern_traveler", tavern_travelers_begin, tavern_travelers_end), #SB : range check
(set_visitor, ":cur_entry", ":tavern_traveler"),
(val_add, ":cur_entry", 1),
(try_end),

(try_begin),
(party_get_slot, ":tavern_minstrel", "$current_town", slot_center_tavern_minstrel),
(is_between, ":tavern_minstrel", tavern_minstrels_begin, tavern_minstrels_end), #SB : range check

(set_visitor, ":cur_entry", ":tavern_minstrel"),
(val_add, ":cur_entry", 1),
(else_try), #SB : move to script call
(call_script, "script_cf_find_alternative_town_for_taverngoers", "$current_town", 9),
(assign, ":alternative_town", reg0),
(party_get_slot, ":tavern_minstrel", ":alternative_town", slot_center_tavern_minstrel),
(is_between, ":tavern_minstrel", tavern_minstrels_begin, tavern_minstrels_end), #SB : range check

(set_visitor, ":cur_entry", ":tavern_minstrel"),
(val_add, ":cur_entry", 1),
(try_end),

(try_begin),
(party_get_slot, ":tavern_bookseller", "$current_town", slot_center_tavern_bookseller),
(is_between, ":tavern_bookseller", tavern_booksellers_begin, tavern_booksellers_end),
(set_visitor, ":cur_entry", ":tavern_bookseller"),
(val_add, ":cur_entry", 1),
(try_end),

(try_begin),
(eq, ":randomize_attacker_placement", 3),
(call_script, "script_setup_tavern_attacker", ":cur_entry"),
(val_add, ":cur_entry", 1),
(try_end),

(try_begin),
(neg|check_quest_active, "qst_eliminate_bandits_infesting_village"),
(neg|check_quest_active, "qst_deal_with_bandits_at_lords_village"),
(assign, ":end_cond", villages_end),
(try_for_range, ":cur_village", villages_begin, ":end_cond"),
(party_slot_eq, ":cur_village", slot_village_bound_center, "$current_town"),
(party_slot_ge, ":cur_village", slot_village_infested_by_bandits, 1),
(neg|party_slot_eq, ":cur_village", slot_town_lord, "trp_player"),
(set_visitor, ":cur_entry", "trp_farmer_from_bandit_village"),
(val_add, ":cur_entry", 1),
(assign, ":end_cond", 0),
(try_end),
(try_end),

(change_screen_mission)]),
("wait",[],"Wait here for some time{s1}.",
[
(assign, "$auto_enter_town", "$current_town"),
(assign, "$g_town_visit_after_rest", 1),
(assign, "$g_last_rest_center", "$current_town"),
(assign, "$g_last_rest_payment_until", -1),

# (try_begin),
# (party_is_active, "p_main_party"),
# (party_get_current_terrain, ":cur_terrain", "p_main_party"),
# (try_begin),
# (eq, ":cur_terrain", rt_desert),
# (unlock_achievement, ACHIEVEMENT_SARRANIDIAN_NIGHTS),
# (try_end),
# (try_end),

# #SB : moved this to only display once
# (party_get_slot, ":town_lord", "$g_last_rest_center", slot_town_lord),
# (try_begin),
# (is_between, ":town_lord", lords_begin, kingdom_ladies_end),
# (call_script, "script_dplmc_is_affiliated_family_member", ":town_lord"),
# (neq, reg0, 0),
# (display_message, "@You are within the walls of an affiliated family member and don't have to pay for accommodation."),
# (try_end),
(rest_for_hours_interactive, 24 * 7, 5, 0), #rest while not attackable
(change_screen_return)]),
("leave",[],"Leave.",[(leave_encounter),(change_screen_return)]),
]
),
Edit: So what I'm asking - thanks Eärendil the Mariner - is: How do I get this to finally work?
 
Last edited:
Solution
Rereading it made that clear for me now, at the first read it was a bit irritating ^^

Regarding 3) In the mission templates there exist the flag 'af_override_horse' which determines if you are mounted at a specific scene or not. I am not sure if that gets determined by the 'interior' or 'outdoor' flag too.

I have had a bit a look around and found the Module System Overhaul of Autolykos:
Appearantly he has reactivated there the Four Way Inn too, so you might want to have a look at his linked source.
Rereading it made that clear for me now, at the first read it was a bit irritating ^^

Regarding 3) In the mission templates there exist the flag 'af_override_horse' which determines if you are mounted at a specific scene or not. I am not sure if that gets determined by the 'interior' or 'outdoor' flag too.

I have had a bit a look around and found the Module System Overhaul of Autolykos:
Appearantly he has reactivated there the Four Way Inn too, so you might want to have a look at his linked source.
 
Upvote 0
Solution
Regarding 3) In the mission templates there exist the flag 'af_override_horse' which determines if you are mounted at a specific scene or not. I am not sure if that gets determined by the 'interior' or 'outdoor' flag too.

I have had a bit a look around and found the Module System Overhaul of Autolykos:
Appearantly he has reactivated there the Four Way Inn too, so you might want to have a look at his linked source.
I looked through mod_mission_templates and it seems that the entries there are written only for towns, castles, and villages. Do you think I should add a custom entry for the Four Ways Inn?
I'll check Autolykos' mod system. Thanks!
 
Upvote 0
Back
Top Bottom