add another type of mercenary to the tavern

Users who are viewing this thread

A few days ago I saw a thread to add more visitors to the tavern, but it was not what I wanted.
I want to add another type of mercenary and I was investigating and following the constants and I modified several things in several modules, in dialog, in script, in game_menu, in constants, in troop and in simple_trigger ... it worked but halfway, the 2 appear types of mercenary, but I can only hire one (although the hiring options appear in the 2 types in the dialog menu). When I hire one, the other tells me he's ready to go, sometimes the first appears on my list of soldiers, sometimes the second. And the worst thing is that I leave the tavern and try to re-enter from the city menu and it does not allow it, only from the streets, but when I enter, there is no one, only the tavern keeper
the modifications I made are the following:
In module_constant
i added these under the constant slot_center_tavern_minstrel
Code:
slot_center_mercenary_troop_type_2  = 101
slot_center_mercenary_troop_amount_2= 102
and this
mercenary_troops_begin2 = "trp_hired_blade"
mercenary_troops_end2 = mercenary_troops_end
in game_menu
in the menu "Visit the tavern" I repeated the following code:
Code:
(party_get_slot, ":mercenary_troop", "$current_town", slot_center_mercenary_troop_type_2),
            (party_get_slot, ":mercenary_amount", "$current_town", slot_center_mercenary_troop_amount_2),
            (try_begin),
              (gt, ":mercenary_troop", 0),
              (gt, ":mercenary_amount", 0),
              (set_visitor, ":cur_entry", ":mercenary_troop"),
              (val_add, ":cur_entry", 1),
            (try_end),
in dialogue, I repeated all this changing the constants
Code:
############################### mercenario 2 ##############
  [anyone, "start", [
                     (eq, "$talk_context", tc_tavern_talk),
                     (neg|troop_is_hero, "$g_talk_troop"),
                     (neg|is_between, "$g_talk_troop", "trp_swadian_merchant", "trp_startup_merchants_end"),
                     (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type_2), # mauro
                     (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount_2),
                     (gt, ":mercenary_amount", 0),
                     (store_sub, reg3, ":mercenary_amount", 1),
                     (store_sub, reg4, reg3, 1),
                     (call_script, "script_game_get_join_cost", ":mercenary_troop"),
                     (assign, ":join_cost", reg0),
                     (store_mul, reg5, ":mercenary_amount", reg0),
                     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
                     (val_min, ":mercenary_amount", ":free_capacity"),
                     (store_troop_gold, ":cur_gold", "trp_player"),
                     (try_begin),
                       (gt, ":join_cost", 0),
                       (val_div, ":cur_gold", ":join_cost"),
                       (val_min, ":mercenary_amount", ":cur_gold"),
                     (try_end),
                     (assign, "$temp", ":mercenary_amount"),
                     ],
   "Do you have a need for mercenaries, {sir/madam}?\
{reg3?Me and {reg4?{reg3} of my mates:one of my mates} are:I am} looking for a master.\
We'll join you for {reg5} denars.", "mercenary_tavern_talk2", []],

  [anyone, "start", [
  (eq, "$talk_context", tc_tavern_talk),
  ],
   "Any orders, {sir/madam}?", "mercenary_after_recruited2", []],

  [anyone|plyr, "mercenary_after_recruited2", [],
   "Make your preparations. We'll be moving at dawn.", "mercenary_after_recruited2_2", []],
  [anyone|plyr, "mercenary_after_recruited2", [],
   "Take your time. We'll be staying in this town for a while.", "mercenary_after_recruited2_2", []],

  [anyone, "mercenary_after_recruited2_2", [], "Yes {sir/madam}. We'll be ready when you tell us to leave.", "close_window", []],

  [anyone|plyr, "mercenary_tavern_talk2", [(party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount_2),
                                          (eq, ":mercenary_amount", "$temp"),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type_2),
                                          (call_script, "script_game_get_join_cost", ":mercenary_troop"),
                                          (store_mul, reg5, "$temp", reg0),
                                          ],
   "All right. I will hire all of you. Here is {reg5} denars.", "mercenary_tavern_talk_hire2", []],

  [anyone|plyr, "mercenary_tavern_talk2", [(party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount_2),
                                          (lt, "$temp", ":mercenary_amount"),
                                          (gt, "$temp", 0),
                                          (assign, reg6, "$temp"),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type_2),
                                          (call_script, "script_game_get_join_cost", ":mercenary_troop"),
                                          (store_mul, reg5, "$temp", reg0),
                                          ],
   "All right. But I can only hire {reg6} of you. Here is {reg5} denars.", "mercenary_tavern_talk_hire2", []],


  [anyone, "mercenary_tavern_talk_hire2", [(store_random_in_range, ":rand", 0, 4),
                                          (try_begin),
                                            (eq, ":rand", 0),
                                            (gt, "$temp", 1),
                                            (str_store_string, s17,
                                             "@You chose well, {sir/madam}. My lads know how to keep their word and earn their pay."),
                                          (else_try),
                                            (eq, ":rand", 1),
                                            (str_store_string, s17,
                                             "@Well done, {sir/madam}. Keep the money and wine coming our way, and there's no foe in Calradia you need fear."),
                                          (else_try),
                                            (eq, ":rand", 2),
                                            (str_store_string, s17,
                                             "@We are at your service, {sir/madam}. Point us in the direction of those who need hurting, and we'll do the rest."),
                                          (else_try),
                                            (str_store_string, s17,
                                             "str_you_will_not_be_disappointed_sirmadam_you_will_not_find_better_warriors_in_all_calradia"),
                                          (try_end),],
   "{s17}", "close_window", [
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type_2),
                                          (call_script, "script_game_get_join_cost", ":mercenary_troop"),
                                          (store_mul, ":total_cost", "$temp", reg0),
                                          (troop_remove_gold, "trp_player", ":total_cost"),
                                          (party_add_members, "p_main_party", ":mercenary_troop", "$temp"),
                                          (party_set_slot, "$g_encountered_party", slot_center_mercenary_troop_amount_2, 0),
                                          ]],

  [anyone|plyr, "mercenary_tavern_talk2", [(eq, "$temp", 0),
                                          (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
                                          (ge, ":free_capacity", 1)],
   "That sounds good. But I can't afford to hire any more men right now.", "tavern_mercenary_cant_lead2", []],

  [anyone, "tavern_mercenary_cant_lead2", [], "That's a pity. Well, {reg3?we will:I will} be lingering around here for a while,\
if you need to hire anyone.", "close_window", []],

  [anyone|plyr, "mercenary_tavern_talk2", [(eq, "$temp", 0),
                                          (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
                                          (eq, ":free_capacity", 0)],
   "That sounds good. But I can't lead any more men right now.", "tavern_mercenary_cant_lead2", []],


  [anyone|plyr, "mercenary_tavern_talk2", [],
   "Sorry. I don't need any other men right now.", "close_window", []],
################################# fin #####################
in module_script in Game_start (almost at the end) under this (call_script, "script_update_mercenary_units_of_towns"), i put this (call_script, "script_update_mercenary_units_of_towns2")

then i repeated that script
Code:
("update_mercenary_units_of_towns2", #mauro
[(try_for_range, ":town_no", towns_begin, towns_end),
(store_random_in_range, ":troop_no", mercenary_troops_begin2, mercenary_troops_end2),
(party_set_slot, ":town_no", slot_center_mercenary_troop_type_2, ":troop_no"),
(store_random_in_range, ":amount", 3, 10),#3-8 mauro
(party_set_slot, ":town_no", slot_center_mercenary_troop_amount_2, ":amount"),
(try_end),
]),
en module_simple_triggers
under this (call_script, "script_update_mercenary_units_of_towns"), i put this (call_script, "script_update_mercenary_units_of_towns2"),

and the last thing was to add 2 more types of mercenaries, before the end line in module_troop
Code:
["corsario","Corsario","corsarios",tf_guarantee_armor|tf_guarantee_helmet|tf_guarantee_ranged,no_scene,reserved,fac_commoners,
    [itm_cartridges,itm_sword_khergit_1,itm_butchering_knife,itm_pistola2,itm_pistola3,itm_jefe_pirata1,itm_jefe_pirata2,itm_jefe_pirata3,itm_botas_huaso1,
    itm_gorro14y,itm_gorro15y,itm_gorro16y,itm_gorro17y],
    def_attrib|level(24),wp(110),knows_ironflesh_2|knows_power_strike_2|knows_power_draw_3|knows_power_throw_2|knows_riding_1|knows_athletics_2,mercenary_face_1, mercenary_face_2],
  ["veterano_mapuche","veterano mapuche","veteranos mapuche",tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_horse|tf_guarantee_ranged|tf_mounted,no_scene,reserved,fac_commoners,
    [itm_bodkin_arrows,itm_khergit_arrows,itm_khergit_bow,itm_strong_bow,itm_javelin,itm_lanza1,itm_hatchet,itm_cartridges,itm_nomad_sabre,itm_knife,itm_acha1,
    itm_acha2,itm_throwing_knives,itm_escopeta,itm_saddle_horse,itm_steppe_horse,itm_lanza_grande,itm_lanza_mapu2,itm_lanza_mapu3,itm_lanza_mapu4,
    itm_manta1,itm_manta2,itm_morral1,itm_morral2,itm_morral3,itm_morral4,itm_trarilonko1,itm_trarilonko2,itm_trarilonko3,itm_trarilonko4,itm_trarilonko5,itm_trarilonko6,itm_trarilonko7,itm_chalas],
    def_attrib|level(12),wp(100)|wp_firearm(100)|wp_melee(100)|wp_archery(100),knows_riding_4|knows_horse_archery_3|knows_power_draw_3|knows_power_throw_2,khergit_face_young_1, khergit_face_old_2],
   ["mercenaries_end","mercenaries_end","mercenaries_end",0,no_scene,reserved,fac_commoners,
   [],

what else am I missing?
please help
 
Last edited:
I think you missed a new dialog. Does this thread help you?

I wrote down this thread here, it collects information snippets from the whole Forge which might be useful for you :wink:
Yes, I had already seen it, great what you have done, I was reviewing almost everything, in fact, from there I followed the thread of the new mercenary and it did not work, that's why I started making changes on my own
 
Upvote 0
the thread that you passed me,
https://forums.taleworlds.com/index.php?threads/more-mercenaries-to-the-tavern-scene.85391/
It is almost the same with what I had .... everything compiles well, there are no errors but the second mercenary, after hiring the first one tells me that he has men but no menu appears below and after clicking, I tell him I'm sorry I can't hire more men, but there's no problem in going back to the tavern and of course I have money to hire. All this with a game just started
jrl8jlvwvrdle6n6g.jpg
gs8uucvl9cskitr6g.jpg
 
Upvote 0
Back
Top Bottom