[kit][OSP]mercenary escort

Users who are viewing this thread

Ikaguia

Grandmaster Knight
it is already present in BRC but many people don't want to download the source while it is not finished so...

at module_dialogs
Code:
## BRC v2.0
#mercenary escort
  [anyone, "start", [
                     (eq, "$talk_context", tc_tavern_talk),
                     (eq, "$talk_troop", "trp_mercenary_leader"),
					 (try_begin),
                       (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),
####If using Floris Expanded Mod Pack add these back:
#                     (else_try),
#                       (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type_2),
#                       (assign, ":slot", slot_center_mercenary_troop_amount_2),
                     (try_end),
                     (neg|party_slot_eq, "$g_encountered_party", ":slot", 0),
                     (party_set_slot, "$g_encountered_party", ":slot", 0),
					 (set_spawn_radius,1),
					 (spawn_around_party,"$current_town","pt_escort_mercenaries_party"),
					 (party_set_ai_behavior,reg0,ai_bhvr_patrol_party),
					 (party_set_ai_object,reg0,"$current_town"),
					 (store_random_in_range, ":number", 0, 10000),
					 (party_set_helpfulness, reg0, ":number"), #tendency to help friendly parties under attack. (0-10000, 100 default.)
                     (assign, ":mercenary_amount", 0),
					 (assign, ":mercenary_cost", 0),
					 (try_for_range, ":troop", 0, "trp_mercenaries_end"),
					   (party_count_members_of_type,":mercenary_current_amount",reg0,":troop"),
					   (val_add, ":mercenary_amount", ":mercenary_current_amount"),
                       (call_script, "script_game_get_join_cost", ":troop"),
                       (assign, ":join_cost", reg0),
                       (store_mul, ":mercenary_current_cost", ":mercenary_current_amount", ":join_cost"),
					   (val_add, ":mercenary_cost", ":mercenary_current_cost"),
                     (try_end),
                     (gt, ":mercenary_amount", 0),
                     (store_sub, reg3, ":mercenary_amount", 1),
                     (store_sub, reg4, reg3, 1),
					 (assign, reg5, ":mercenary_cost"),
                     ],
   "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 escort 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", [(store_troop_gold, ":gold", "trp_player"),
                                          (ge, ":gold", reg5),],
   "All right. I will hire all of you.", "mercenary_tavern_talk_hire", [(troop_remove_gold,"trp_player",reg5),
                                                                        (party_set_ai_behavior,reg0,ai_bhvr_escort_party),
                                                                        (party_set_ai_object,reg0,"p_main_party"),
                                                                        (store_random_in_range, ":number", 200, 10000),
                                                                        (party_set_helpfulness, reg0, ":number"), #tendency to help friendly parties under attack. (0-10000, 100 default.)
																		]],

  [anyone|plyr, "mercenary_tavern_talk", [],
   "All right. But I can only hire some of you.", "mercenary_tavern_talk_hire", [(change_screen_exchange_members, 1, reg0),]],


  [anyone, "mercenary_tavern_talk_hire", [(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", []],

  [anyone|plyr, "mercenary_tavern_talk", [(ge, ":free_capacity", 1)],
   "That sounds good. But I can't afford to hire any more men right now.", "tavern_mercenary_cant_lead", []],
  
  [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", [(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_lead", []],


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

must be before this:
Code:
  [anyone, "start", [
                     (eq, "$talk_context", tc_tavern_talk),
					 (neg|troop_is_hero, "$g_talk_troop"),
                     (neq, "$talk_troop", "trp_mercenary_leader"),#####add this
                     (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),
                     (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount),

at module_party_templates
Code:
## BRC v2.0
  ("escort_mercenaries_party","Escort Mercenaries",icon_vaegir_knight,0,fac_commoners,soldier_personality,[(trp_mercenary_leader,1,1),(trp_mercenary_watchman,5,20),(trp_mercenary_crossbowman,0,5),(trp_mercenary_veteran_cavalry,0,5),(trp_mercenary_swordsman,0,5),(trp_mercenary_enforcer,0,5),(trp_mercenary_infantry,0,5),(trp_mercenary_aventurier,0,5),(trp_mercenary_gendarme,0,5),(trp_mercenary_skirmisher,0,5),(trp_mercenary_mounted_archer,0,5),(trp_mercenary_axeman,0,5),(trp_mercenary_sergeant,0,5)]),
## BRC v2.0
change all this troops if not using Floris Expanded Mod Pack


at module_troops
Code:
  ["mercenary_leader",					"Mercenary Leader",					"Mercenary Leader",					tf_guarantee_all,0,0,fac_commoners,[itm_leather_gloves,itm_leather_boots,itm_splinted_leather_greaves,itm_tab_shield_round_b,itm_hospitaller_padded_jack,itm_helmet_with_neckguardred,itm_bec_de_corbin,itm_simple_poleaxe,itm_lui_coloredhallberdb,itm_mail_mittens,itm_brass_mittens,itm_mail_gauntlets,itm_mail_chausses,itm_mail_shoes,itm_sw_teutonic_shield_01,itm_sw_teut_shield01,itm_early_transitional_heraldic,itm_crusaderhelm,itm_blackhelm,itm_sugarloaf,itm_sugarloaf_helmet_plain3,itm_reinforced_great_helm,itm_pop_flammarde],													def_attrib|level(25),wp_one_handed(92)|wp_two_handed(100)|wp_polearm(187)|wp_archery(60)|wp_crossbow(90)|wp_throwing(76),		knows_common|knows_riding_2|knows_ironflesh_2|knows_power_strike_3|knows_shield_2|knows_athletics_2|knows_pathfinding_7,	man_face_young_1,		man_face_old_4],
If not using Floris Expanded Mod Pack, delete all items and add new ones.



I'll update this code to the one I'm using once I fix my computer.
 
no, but it can be easily implemented

set a constant:

party_mercenary_contract = XX

simple_triggers:

Code:
(24, [(try_for_parties, ":party"),
        (party_get_template_id,":party_template",":party"),
		(eq, ":party_template", "pt_escort_mercenaries_party"),
		(party_get_slot, ":party_slot", ":party", slot_party_mercenary_contract),
        (val_sub, ":party_slot", 1),
        (try_begin),
          (le, ":party_slot", 0),
          (store_random_in_range, ":object", 0, "p_reserved_5"),
          (party_set_ai_behavior,":party",ai_bhvr_patrol_party),
          (party_set_ai_object,":party",":object"),
		(try_end),
		(try_begin),
		  (store_random_in_range, ":val", 3, 10),
		  (val_mul, ":val", -1),
		  (lt, ":party_slot", ":val"),
		  (remove_party,":party"),
		(try_end),]),

at the code i posted before you have to set the slot to the party.
 
you need create a script:

  ("cf_has_wagon_parts",
    [ (troop_get_inventory_capacity,":capacity","trp_player"),
(assign,":no_sumpter_horses",0),
(assign,":has_tools",0),
(try_for_range,":slot",0,":capacity"),
(troop_get_inventory_slot,":cur_item","trp_player",":slot"),
(eq,":cur_item","itm_sumpter_horse"),
(val_add,":no_sumpter_horses",1),
(try_end),
(try_begin),
(lt,":no_sumpter_horses",2),
(display_message,"@ You need 2 ponies to pull the wagon!!"),
(try_end),
(try_begin),
(player_has_item,"itm_tools"),
(assign,":has_tools",1),
(else_try),
(eq,":has_tools",0),
(display_message,"@ You must have tools in inventory to build a wagon!!"),
(try_end),
(ge,":no_sumpter_horses",2),
(player_has_item,"itm_tools"),
]),


However, my suggestion is to take a look at the great work of Tempered
 
Idibil said:
Sorry by double post.
I was looking code, you have a extra slot_center_mercenary_troop_type_2, and two variables with no use: ':free capacity' and 'talk_troop'

the slot is from floris mod pack, you can comment out that part, it's because floris adds a bunch of new mercs.
you can delete the :free_capacity blocks
and talk troop is the troop you are talking with
 
Idibil said:
you need create a script:

  ("cf_has_wagon_parts",
    [ (troop_get_inventory_capacity,":capacity","trp_player"),
(assign,":no_sumpter_horses",0),
(assign,":has_tools",0),
(try_for_range,":slot",0,":capacity"),
(troop_get_inventory_slot,":cur_item","trp_player",":slot"),
(eq,":cur_item","itm_sumpter_horse"),
(val_add,":no_sumpter_horses",1),
(try_end),
(try_begin),
(lt,":no_sumpter_horses",2),
(display_message,"@ You need 2 ponies to pull the wagon!!"),
(try_end),
(try_begin),
(player_has_item,"itm_tools"),
(assign,":has_tools",1),
(else_try),
(eq,":has_tools",0),
(display_message,"@ You must have tools in inventory to build a wagon!!"),
(try_end),
(ge,":no_sumpter_horses",2),
(player_has_item,"itm_tools"),
]),


However, my suggestion is to take a look at the great work of Tempered

just changed the (eq,":cur_item","itm_sumpter_horse"),
for (is_between,":cur_item","itm_horse_0001", "itm_horse_9999"),


edit:

my actual code is something like this
a menu option:
Code:
      ("make_4_horse_wagon",[(eq, "$brc_camp_inv", 2),
	                         (try_begin),
							   (player_has_item,"itm_heavy_wagon"),
							   (troop_get_inventory_capacity,":capacity","trp_player"),
							   (assign,":horses",0),
							   (try_for_range,":slot",0,":capacity"),
							     (troop_get_inventory_slot,":cur_item","trp_player",":slot"),
							     (is_between, ":cur_item", "itm_horse_0001", "itm_horse_9999"),
							     (val_add,":horses",1),
							   (try_end),
							   (ge, ":horses", 4),
							 (else_try),
							   (disable_menu_option),
							 (try_end),],"Make a new Wagon(1 heavy wagon & 4 diferent horses).",
       [(assign, "$build", 4),
	    (rest_for_hours_interactive, 3, 5, 1), #rest while attackable
        (assign,"$next_menu","mnu_build_inventory"),
        (assign, "$rest_time", 3),
        (change_screen_return),
        ]),
 
Caba`drin said:
Ikaguia said:
is there an operation to check if player has 2 tools or two coursers?
There is a Native script for this already:
(call_script, "script_get_troop_item_amount", ":troop_no", "itm_ITEM"),

The number of a given item a given troop has is returned in reg0.

oh, i thought there would be a operation instead of a script...
 
Back
Top Bottom