More mercenaries mod. Problem with dialog code

正在查看此主题的用户

Tintai

Recruit
Hello,

I'm using Floris which have 2 mercenaries at tavern.
So I made a mod which adds mercenaries camps to the map and you can walk at the camp and recruit them.

Everything is fine but I have problem with module_dialog. I can talk with mercenary, he will tell me about cost etc. But when I click option to hire him nothing happens.
I think I miss something in my code.

Can you take a look please?
Code is taking me to "mercenary_tavern_talk_hire" but I have no idea what I should change here.
插入代码块:
#Tavern Talk (with troops)

  [anyone, "start", [
                     (eq, "$talk_context", tc_tavern_talk),
					 (neg|troop_is_hero, "$g_talk_troop"),
					 (assign, ":mercenary_amount", -1),
                     #(party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type),
                     #(party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount),
                     (try_begin),
						 (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type),
						 (eq, "$g_talk_troop", ":mercenary_troop"),
						 (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount),
                     (else_try),
						(party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type_2),
						(eq, "$g_talk_troop", ":mercenary_troop"),
						(party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount_2),
					(else_try),
			     		(party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_1),
						(eq, "$g_talk_troop", ":mercenary_troop"),
						(party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_camp_troop_amount_1),
					(else_try),
						(party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_2),
						(eq, "$g_talk_troop", ":mercenary_troop"),
						(party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_camp_troop_amount_2),
					(else_try),
						(party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_3),
						(eq, "$g_talk_troop", ":mercenary_troop"),
						(party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_camp_troop_amount_3),
					(else_try),
						(party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_4),
						(eq, "$g_talk_troop", ":mercenary_troop"),
						(party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_camp_troop_amount_4),
					(else_try),
						(party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_5),
						(eq, "$g_talk_troop", ":mercenary_troop"),
						(party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_camp_troop_amount_5),
                     (try_end),                                              #Tavern end
                     (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_talk", []],

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

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

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

  [anyone|plyr, "mercenary_tavern_talk", [(try_begin),     #More Mercaneries Tavern
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type),
                                          (eq, "$g_talk_troop", ":mercenary_troop"),                     
                                          (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount),
                                          (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type_2),
										  (eq, "$g_talk_troop", ":mercenary_troop"), 
                                          (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount_2),
										  (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_1),
										  (eq, "$g_talk_troop", ":mercenary_troop"), 
                                          (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_camp_troop_amount_1),
										  (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_2),
										  (eq, "$g_talk_troop", ":mercenary_troop"), 
                                          (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_camp_troop_amount_2),
										  (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_3),
										  (eq, "$g_talk_troop", ":mercenary_troop"), 
                                          (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_camp_troop_amount_3),
										  (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_4),
										  (eq, "$g_talk_troop", ":mercenary_troop"), 
                                          (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_camp_troop_amount_4),
										  (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_5),
										  (eq, "$g_talk_troop", ":mercenary_troop"), 
                                          (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_camp_troop_amount_5),
                                          (try_end),
                                          (eq, ":mercenary_amount", "$temp"),
                                         #(party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type),
                                          (call_script, "script_game_get_join_cost", ":mercenary_troop"),
                                          (store_mul, reg5, "$temp", reg0), #Tavern End
                                          ],
   "All right. I will hire all of you. Here is {reg5} denars.", "mercenary_tavern_talk_hire", []],

  [anyone|plyr, "mercenary_tavern_talk", [(try_begin),     #More Mercaneries Tavern
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type),
                                          (eq, "$g_talk_troop", ":mercenary_troop"),                     
                                          (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount),
                                          (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type_2),
										  (eq, "$g_talk_troop", ":mercenary_troop"), 
                                          (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount_2),
										  (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_1),
										  (eq, "$g_talk_troop", ":mercenary_troop"), 
                                          (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_camp_troop_amount_1),
										  (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_2),
										  (eq, "$g_talk_troop", ":mercenary_troop"), 
                                          (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_camp_troop_amount_2),
										  (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_3),
										  (eq, "$g_talk_troop", ":mercenary_troop"), 
                                          (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_camp_troop_amount_3),
										  (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_4),
										  (eq, "$g_talk_troop", ":mercenary_troop"), 
                                          (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_camp_troop_amount_4),
										  (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_5),
										  (eq, "$g_talk_troop", ":mercenary_troop"), 
                                          (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_camp_troop_amount_5),
                                          (try_end),
                                          (lt, "$temp", ":mercenary_amount"),
                                          (gt, "$temp", 0),
                                          (assign, reg6, "$temp"),
                                          #(party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type),
                                          (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_hire", []],


  [anyone, "mercenary_tavern_talk_hire", [(store_random_in_range, ":rand", 0, 4),
                                          (try_begin),
                                            (eq, ":rand", 0),
                                            (gt, "$temp", 1),
											##diplomacy start+ lads -> {reg65?companions:lads}; {sir/madame} -> {s0}
											(call_script, "script_dplmc_print_subordinate_says_sir_madame_to_s0"),
                                            (str_store_string, s17,
                                             "@You chose well, {s0}. My {reg65?companions:lads} know how to keep their word and earn their pay."),
											 ##diplomacy end+
                                          (else_try),
                                            (eq, ":rand", 1),
											##diplomacy start+ {sir/madame} -> {s0}
											(call_script, "script_dplmc_print_subordinate_says_sir_madame_to_s0"),
                                            (str_store_string, s17,
                                             "@Well done, {s0}. Keep the money and wine coming our way, and there's no foe in Calradia you need fear."),
											 ##diplomacy end+
                                          (else_try),
                                            (eq, ":rand", 2),
											##diplomacy start+ {sir/madame} -> {s0}
											(call_script, "script_dplmc_print_subordinate_says_sir_madame_to_s0"),
                                            (str_store_string, s17,
                                             "@We are at your service, {s0}. Point us in the direction of those who need hurting, and we'll do the rest."),
											 ##diplomacy end+
                                          (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),
                                          (try_begin),     #More Mercaneries Tavern
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type),
                                          (eq, "$g_talk_troop", ":mercenary_troop"),                     
                                          (assign, ":slot", slot_center_mercenary_troop_amount),
                                          (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type_2),
                                          (assign, ":slot", slot_center_mercenary_troop_amount_2),
										  (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_1),
                                          (assign, ":slot", slot_center_mercenary_camp_troop_amount_1),
										  (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_2),
                                          (assign, ":slot", slot_center_mercenary_camp_troop_amount_2),
										  (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_3),
                                          (assign, ":slot", slot_center_mercenary_camp_troop_amount_3),
										  (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_4),
                                          (assign, ":slot", slot_center_mercenary_camp_troop_amount_4),
										  (else_try),
                                          (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_camp_troop_type_5),
                                          (assign, ":slot", slot_center_mercenary_camp_troop_amount_5),
                                          (try_end),
                                          (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, 0),
										  (party_set_slot, "$g_encountered_party", ":slot", 0),
                                          ]],

  [anyone|plyr, "mercenary_tavern_talk", [(eq, "$temp", 0),
                                          (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
                                          (ge, ":free_capacity", 1)],
##diplomacy start+ Gender-check to avoid accidental absurdities if there are female mercenaries
   "That sounds good. But I can't afford to hire any more {reg65?soldiers:men} right now.", "tavern_mercenary_cant_lead", []],
##diplomacy end+

  [anyone, "tavern_mercenary_cant_lead", [], "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_talk", [(eq, "$temp", 0),
                                          (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
                                          (eq, ":free_capacity", 0)],
##diplomacy start+ Gender-check to avoid accidental absurdities if there are female mercenaries
   "That sounds good. But I can't lead any more {reg65?soldiers:men} right now.", "tavern_mercenary_cant_lead", []],
##diplomacy end+

  [anyone|plyr, "mercenary_tavern_talk", [],
   "Sorry. I don't need any other men right now.", "close_window", []],

@Edit:
i think its an issue with my module_game_menus.py.
Can someone give me a code of menu which sets $current_town value when I enter to my camp?


or issue with g_talk_troop/:mercenary_troop. That value looks empty in dialogs. amount is ok but type not.

Thanks
Tintai
 
后退
顶部 底部