Recruiter Kit Version 1.30
-- Download links: --
Warband:
http://www.mbrepository.com/download.php?id=1931&f=recruiter_mod_1.30.exe
Original Mount & Blade:
http://www.mbrepository.com/download.php?id=1469&f=recruiter_mod_1.20.exe
General Mod Info:
With this cool modification you can hire recruiters to recruit fresh volunteers to your garrisons. After you have chosen the amount of recruits you need and paid the expenses, a recruiter party will appear on the map. The party will then begin to gather volunteers from villages. This is especially useful for all you "bandit kings" out there, as it allows you to effectively garrison all your centers while you fight your numerous adversaries!
Screenshots showing some recruiters:


Current version info:
- Recruiters can be hired from castles and towns. Recruiters can not be sent during a siege. They can return during a siege, however, if they can get past the siegers.
- Recruiters can only recruit from villages.
- You are asked if you would like to have your recruits from a specific faction, or if you'd just like to get some troops of any kind as fast as possible.
- You can specify the amount of recruits the recruiter collects by choosing from preset options 5, 10, 20, 30, 40 and 50. After the recruiter has collected the amount you ordered, he brings the recruits back to the town/castle you hired him from and adds them to the garrison.
- After the recruiter has been sent on his mission, you can go and tell him to change the faction he is recruiting from.
- You can hire 2 recruiters from a castle and 4 recruiters from a town at a time.
- You must pay 20 coins for each recruit (that's double the normal price). 100% advance payment.
Adding recruiters to your module:
Warband:
Download the source code and read the README.txt here:
http://www.mbrepository.com/file.php?id=1932
Original Mount & Blade:
Here are the scripts and info about their placement in the files.
Changelog:
1.30
- Warband compatibility.
1.20
- Change: Recruiters can now be attacked by other parties, and their nationality is visible.
- Change: Recruiters can no longer recruit from villages that have negative relation to player or from villages that belong to hostile kingdom.
- Change: A red message is displayed every time a recruiter is defeated.
- Change: The message that tells that a recruiter has returned home is now colored green.
- Fix: Two minor bugs.
1.10
- Added ability to order recruits of specified nationality.
1.0
- First version.
If you want to use this feature in your mod you don't have to ask my permission to do so. Just inform me with a PM and add as many of us* as possible in the credits.
*Credits go to:
- Hessuu (Coding)
- Stoker (Advicing me on how to implement the recruiter spawning)
- Blankin (Coding the dialogs)
- Alkhadias Master (Doing most of the coding for version 1.10 scripts)
- cdvader (Giving an excellent example on how to implent a feature)
- Janus (Maker of the mod installer script)
Any help, comments, ideas and bug reports are appreciated! Feel free to modify and redistribute the mod at will!
-- Download links: --
Warband:
http://www.mbrepository.com/download.php?id=1931&f=recruiter_mod_1.30.exe
Original Mount & Blade:
http://www.mbrepository.com/download.php?id=1469&f=recruiter_mod_1.20.exe
General Mod Info:
With this cool modification you can hire recruiters to recruit fresh volunteers to your garrisons. After you have chosen the amount of recruits you need and paid the expenses, a recruiter party will appear on the map. The party will then begin to gather volunteers from villages. This is especially useful for all you "bandit kings" out there, as it allows you to effectively garrison all your centers while you fight your numerous adversaries!
Screenshots showing some recruiters:



Current version info:
- Recruiters can be hired from castles and towns. Recruiters can not be sent during a siege. They can return during a siege, however, if they can get past the siegers.
- Recruiters can only recruit from villages.
- You are asked if you would like to have your recruits from a specific faction, or if you'd just like to get some troops of any kind as fast as possible.
- You can specify the amount of recruits the recruiter collects by choosing from preset options 5, 10, 20, 30, 40 and 50. After the recruiter has collected the amount you ordered, he brings the recruits back to the town/castle you hired him from and adds them to the garrison.
- After the recruiter has been sent on his mission, you can go and tell him to change the faction he is recruiting from.
- You can hire 2 recruiters from a castle and 4 recruiters from a town at a time.
- You must pay 20 coins for each recruit (that's double the normal price). 100% advance payment.
Adding recruiters to your module:
Warband:
Download the source code and read the README.txt here:
http://www.mbrepository.com/file.php?id=1932
Original Mount & Blade:
Here are the scripts and info about their placement in the files.
module_constants
- These can be placed anywhere in the file.
- Make sure your mod doesn't conflict with party slots 220, 221, 222 and 224, and spt 12. If this is the case however, you can change the numbers to something non-reserved.
module_dialogs
- Put this at the top of the dialogs list.
- There's a funny debug-command in there that was actually needed in the development.
module_game_menus
- This is the town/castle menu option. I placed it under the "town_leave", but you can put it anywhere within the menu. The town_leave is included below to show you how should it look like. Use your text editor's search function to find the correct spot.
- Put this at the bottom of the file.
module_party_templates
- This can be put anywhere after the hardwired templates.
module_scripts
- Put this at the bottom of the file.
- This is placed inside the script "game_event_simulate_battle".
- I included some of the original native code below to help you to find the correct spot. Copy/paste the stuff between "recruiter kit begin" and "recruiter kit end" to your module the same way as below.
module_simple_triggers
- This is the most important script! I am pretty proud of it.
- You should put this at the bottom of the file.
- NB! The last native's simple trigger in the file does not have a comma after it, so you have to add it yourself. You'll get an error when you try to build otherwise.
module_troops
- This can be anywhere between "mercenaries_end" and "town_walker_1".
That's it! If you have problems, send me a PM or post in the thread. The latter is recommended.
- These can be placed anywhere in the file.
- Make sure your mod doesn't conflict with party slots 220, 221, 222 and 224, and spt 12. If this is the case however, you can change the numbers to something non-reserved.
Code:
### RECRUITER KIT BEGIN
slot_party_recruiter_needed_recruits = 220 # Amount of recruits the employer ordered.
slot_party_recruiter_origin = 221 # Walled center from where the recruiter was hired.
slot_village_reserved_by_recruiter = 222 # This prevents recruiters from going to villages targeted by other recruiters.
slot_party_recruiter_needed_recruits_faction = 224 # Alkhadias Master, you forgot this one from the PM you sent me
spt_recruiter = 12
## RECRUITER KIT END
module_dialogs
- Put this at the top of the dialogs list.
- There's a funny debug-command in there that was actually needed in the development.
Code:
#########################################################################################################
## Recruiter kit begin
#########################################################################################################
[trp_recruiter, "start", [], "Hello {reg65?madame:sir}. If it's ok to you, I would like to get on with my assignment.", "recruiter_talk",[]],
[trp_recruiter|plyr, "recruiter_talk", [], "Ok, keep going.", "close_window",[(assign, "$g_leave_encounter",1)]],
[trp_recruiter|plyr, "recruiter_talk", [], "I want you to recruit different troops.", "recruiter_talk_2",[]],
[trp_recruiter|plyr, "recruiter_talk", [(eq, "$cheat_mode",1)], "eat **** and die", "recruiter_eat_****_and_die", []],
[trp_recruiter, "recruiter_eat_****_and_die", [], "Yes {reg65?madame:sir}.", "close_window",[(remove_member_from_party, "trp_recruiter", "$g_encountered_party"),
(assign, "$g_leave_encounter",1), ]],
[trp_recruiter, "recruiter_talk_2", [
(party_get_slot, reg1, "$g_encountered_party", slot_party_recruiter_needed_recruits),
(party_get_slot, ":recruit_faction", "$g_encountered_party", slot_party_recruiter_needed_recruits_faction),
(try_begin),
(eq, ":recruit_faction",-1),
(str_store_string, s1, "@any kind of"),
(else_try),
(eq, ":recruit_faction", "fac_kingdom_1"),
(str_store_string, s1, "@Swadian"),
(else_try),
(eq, ":recruit_faction", "fac_kingdom_2"),
(str_store_string, s1, "@Vaegir"),
(else_try),
(eq, ":recruit_faction", "fac_kingdom_3"),
(str_store_string, s1, "@Khergit"),
(else_try),
(eq, ":recruit_faction", "fac_kingdom_4"),
(str_store_string, s1, "@Nord"),
(else_try),
(eq, ":recruit_faction", "fac_kingdom_5"),
(str_store_string, s1, "@Rhodok"),
(try_end),
], "My current task is to recruit {reg1} {s1} troops for you. Should I recruit different soldiers from now on?", "recruiter_talk_3",[]],
[trp_recruiter|plyr, "recruiter_talk_3", [], "No, keep going.", "close_window",[(assign, "$g_leave_encounter",1)]],
[trp_recruiter|plyr, "recruiter_talk_3", [], "Recruit Swadians now.", "recruiter_talk_4",[(assign,"$temp","fac_kingdom_1")]],
[trp_recruiter|plyr, "recruiter_talk_3", [], "Recruit Vaegirs now.", "recruiter_talk_4",[(assign,"$temp","fac_kingdom_2")]],
[trp_recruiter|plyr, "recruiter_talk_3", [], "Recruit Khergits now.", "recruiter_talk_4",[(assign,"$temp","fac_kingdom_3")]],
[trp_recruiter|plyr, "recruiter_talk_3", [], "Recruit Nords now.", "recruiter_talk_4",[(assign,"$temp","fac_kingdom_4")]],
[trp_recruiter|plyr, "recruiter_talk_3", [], "Recruit Rhodoks now.", "recruiter_talk_4",[(assign,"$temp","fac_kingdom_5")]],
[trp_recruiter|plyr, "recruiter_talk_3", [], "Recruit any troops now.", "recruiter_talk_4",[(assign,"$temp",-1)]],
[trp_recruiter, "recruiter_talk_4", [(party_set_slot, "$g_encountered_party", slot_party_recruiter_needed_recruits_faction, "$temp")], "Sure {reg65?madame:sir}. I will. Anything else you want?", "recruiter_talk",[]],
##########################################################################################################
## Recruiter kit end
##########################################################################################################
module_game_menus
- This is the town/castle menu option. I placed it under the "town_leave", but you can put it anywhere within the menu. The town_leave is included below to show you how should it look like. Use your text editor's search function to find the correct spot.
Code:
("town_leave",[],"Leave...",[
(assign, "$g_permitted_to_center",0),
(change_screen_return,0),
],"Leave Area."),
############################################################################################################################
## recruiter kit begin
############################################################################################################################
("hire_a_recruiter",
[(neg|party_slot_eq, "$current_town", slot_village_state, svs_under_siege),
(party_slot_eq,"$current_town", slot_town_lord, "trp_player"),
(assign, ":y", 0),
(try_for_parties, ":party_no"),
(party_slot_eq,":party_no", slot_party_type, spt_recruiter),
(party_slot_eq,":party_no", slot_party_recruiter_origin, "$current_town"),
(val_add, ":y", 1),
(try_end),
(assign, reg2, ":y"),
(try_begin),
(party_slot_eq, "$current_town", slot_party_type, spt_castle),
(assign, reg0, 0),
(try_end),
],
"Hire a recruiter. ({reg2}/{reg0?4:2} currently hired.)",
[
(jump_to_menu, "mnu_recruiter_payment"),
]),
############################################################################################################################
## recruiter kit end
############################################################################################################################
- Put this at the bottom of the file.
Code:
############################################################################################################################
## recruiter kit begin
############################################################################################################################
("recruiter_payment",0,
"The recruiter will visit villages and recruit population to your forces. \
After he has collected the amount you ordered he returns to this {reg0?town:castle} and puts the recruits in the garrison. \
There's a limit for recruiters, which is 2 for castles and 4 for towns. \
What kind of recruits do you want?",
"none",
[
(assign, ":recruiter_amount", 0),
(try_begin),
(party_slot_eq, "$current_town", slot_party_type, spt_town),
(assign, ":max_recruiters", 4),
(else_try),
(assign, ":max_recruiters", 2),
(try_end),
(try_for_parties, ":party_no"),
(party_slot_eq,":party_no", slot_party_type, spt_recruiter),
(party_slot_eq, ":party_no", slot_party_recruiter_origin, "$current_town"),
(val_add, ":recruiter_amount", 1),
(try_end),
(try_begin),
(eq, ":recruiter_amount", ":max_recruiters"),
(assign, "$recruiter_amount_check", 1),
(else_try),
(lt, ":recruiter_amount", ":max_recruiters"),
(assign, "$recruiter_amount_check", 0),
(else_try),
(gt, ":recruiter_amount", ":max_recruiters"),
(display_message, "@ERROR IN THE RECRUITER KIT GAME MENUS RECRUITER CALCULATION!",0xFF2222),
(try_end),
(try_begin),
(party_slot_eq, "$current_town", slot_party_type, spt_castle),
(assign, reg0, 0),
(try_end),
],
[("enough_recruiters", [ (eq, "$recruiter_amount_check", 1)],
"You have already hired the maximum amount of {reg0?4:2} recruiters from this {reg0?town:castle}.",[(jump_to_menu, "mnu_town")]),
("recruiter_faction_1", [(eq, "$recruiter_amount_check", 0)],
"Swadian", [(assign,"$temp","fac_kingdom_1"),(jump_to_menu, "mnu_recruiter_payment_2")]),
("recruiter_faction_2", [(eq, "$recruiter_amount_check", 0)],
"Vaegir", [(assign,"$temp","fac_kingdom_2"),(jump_to_menu, "mnu_recruiter_payment_2")]),
("recruiter_faction_3", [(eq, "$recruiter_amount_check", 0)],
"Khergit", [(assign,"$temp","fac_kingdom_3"),(jump_to_menu, "mnu_recruiter_payment_2")]),
("recruiter_faction_4", [(eq, "$recruiter_amount_check", 0)],
"Nord", [(assign,"$temp","fac_kingdom_4"),(jump_to_menu, "mnu_recruiter_payment_2")]),
("recruiter_faction_5", [(eq, "$recruiter_amount_check", 0)],
"Rhodok", [(assign,"$temp","fac_kingdom_5"),(jump_to_menu, "mnu_recruiter_payment_2")]),
("recruiter_faction_6", [(eq, "$recruiter_amount_check", 0)],
"Any troops", [(assign,"$temp",-1), (jump_to_menu, "mnu_recruiter_payment_2")]),
("recruiter_option_cancel", [], "Go back.", [(jump_to_menu, "mnu_town")])]),
("recruiter_payment_2",0,
"You must pay 20 denars for each recruit. How many recruits are you willing to pay for?",
"none",
[],
[("recruiter_option_5", [ (store_troop_gold,":gold","trp_player"), (ge,":gold",100), (eq, "$recruiter_amount_check", 0)],
"5", [ (call_script, "script_send_recruiter", 5, "$temp"), (jump_to_menu, "mnu_town")]),
("recruiter_option_10", [ (store_troop_gold,":gold","trp_player"), (ge,":gold",200), (eq, "$recruiter_amount_check", 0)],
"10", [ (call_script, "script_send_recruiter", 10, "$temp"), (jump_to_menu, "mnu_town")]),
("recruiter_option_20", [ (store_troop_gold,":gold","trp_player"), (ge,":gold",400), (eq, "$recruiter_amount_check", 0)],
"20", [ (call_script, "script_send_recruiter", 20, "$temp"), (jump_to_menu, "mnu_town")]),
("recruiter_option_30", [ (store_troop_gold,":gold","trp_player"), (ge,":gold",600), (eq, "$recruiter_amount_check", 0)],
"30", [ (call_script, "script_send_recruiter", 30, "$temp"), (jump_to_menu, "mnu_town")]),
("recruiter_option_40", [ (store_troop_gold,":gold","trp_player"), (ge,":gold",800), (eq, "$recruiter_amount_check", 0)],
"40", [ (call_script, "script_send_recruiter", 40, "$temp"), (jump_to_menu, "mnu_town")]),
("recruiter_option_50", [ (store_troop_gold,":gold","trp_player"), (ge,":gold",1000),(eq, "$recruiter_amount_check", 0)],
"50", [ (call_script, "script_send_recruiter", 50, "$temp"), (jump_to_menu, "mnu_town")]),
("recruiter_option_cancel", [], "Cancel.", [(jump_to_menu, "mnu_town")])]),
############################################################################################################################
## recruiter kit end
############################################################################################################################
module_party_templates
- This can be put anywhere after the hardwired templates.
Code:
("recruiter","Recruiter",icon_gray_knight|pf_show_faction,0,fac_neutral,merchant_personality,[(trp_recruiter,1,1)]),
module_scripts
- Put this at the bottom of the file.
Code:
############################################################################################################################
## recruiter kit begin
############################################################################################################################
("send_recruiter",
[
(store_script_param, ":number_of_recruits", 1),
#daedalus begin
(store_script_param, ":faction_of_recruits", 2),
#daedalus end
(assign, ":expenses", ":number_of_recruits"),
(val_mul, ":expenses", 20),
(troop_remove_gold, "trp_player", ":expenses"),
(set_spawn_radius, 1),
(spawn_around_party, "$current_town", "pt_recruiter"),
(assign,":spawned_party",reg0),
(party_set_ai_behavior, ":spawned_party", ai_bhvr_hold),
(party_set_slot, ":spawned_party", slot_party_type, spt_recruiter),
(party_set_slot, ":spawned_party", slot_party_recruiter_needed_recruits, ":number_of_recruits"),
#daedalus begin
(party_set_slot, ":spawned_party", slot_party_recruiter_needed_recruits_faction, ":faction_of_recruits"),
#daedalus end
(party_set_slot, ":spawned_party", slot_party_recruiter_origin, "$current_town"),
(store_troop_faction, ":faction", "trp_player"),
(party_set_faction, ":spawned_party", ":faction"),
]),
############################################################################################################################
## recruiter kit end
############################################################################################################################
- This is placed inside the script "game_event_simulate_battle".
- I included some of the original native code below to help you to find the correct spot. Copy/paste the stuff between "recruiter kit begin" and "recruiter kit end" to your module the same way as below.
Code:
(try_begin),
(this_or_next|eq, ":new_attacker_strength", 0),
(eq, ":new_defender_strength", 0),
# Battle concluded! determine winner
(try_begin),
(eq, ":new_attacker_strength", 0),
(eq, ":new_defender_strength", 0),
(assign, ":root_winner_party", -1),
(assign, ":root_defeated_party", -1),
(assign, ":collective_casualties", -1),
(else_try),
(eq, ":new_attacker_strength", 0),
(assign, ":root_winner_party", ":root_defender_party"),
(assign, ":root_defeated_party", ":root_attacker_party"),
(assign, ":collective_casualties", "p_collective_enemy"),
(else_try),
(assign, ":root_winner_party", ":root_attacker_party"),
(assign, ":root_defeated_party", ":root_defender_party"),
(assign, ":collective_casualties", "p_collective_ally"),
(try_end),
############################################################################################################################
## Recruiter kit begin
############################################################################################################################
# This little fella just shows a message when a recruiter is defeated.
(try_begin),
(party_slot_eq, ":root_defeated_party", slot_party_type, spt_recruiter),
(party_get_slot, reg10, ":root_defeated_party", slot_party_recruiter_needed_recruits),
(party_get_slot, ":party_origin", ":root_defeated_party", slot_party_recruiter_origin),
(str_store_party_name_link, s13, ":party_origin"),
(display_log_message, "@Your recruiter who was commissioned to recruit {reg10} recruits to {s13} has been defeated!", 0xFF0000),
(try_end),
############################################################################################################################
## Recruiter kit end
############################################################################################################################
(try_begin),
(ge, ":root_winner_party", 0),
(call_script, "script_get_nonempty_party_in_group", ":root_winner_party"),
(assign, ":nonempty_winner_party", reg0),
(store_faction_of_party, ":faction_receiving_prisoners", ":nonempty_winner_party"),
(store_faction_of_party, ":defeated_faction", ":root_defeated_party"),
(else_try),
(assign, ":nonempty_winner_party", -1),
(try_end),
module_simple_triggers
- This is the most important script! I am pretty proud of it.
- You should put this at the bottom of the file.
- NB! The last native's simple trigger in the file does not have a comma after it, so you have to add it yourself. You'll get an error when you try to build otherwise.
Code:
############################################################################################################################
## Recruiter kit begin
############################################################################################################################
## This trigger keeps the recruiters moving by assigning them targets.
(0.5,
[
(try_for_parties, ":party_no"),
(party_slot_eq,":party_no", slot_party_type, spt_recruiter),
(party_get_slot, ":needed", ":party_no", slot_party_recruiter_needed_recruits),
(party_get_num_companion_stacks, ":stacks", ":party_no"),
(assign, ":destruction", 1),
(assign, ":quit", 0),
(try_for_range, ":stack_no", 0, ":stacks"),
(party_stack_get_troop_id, ":troop_id", ":party_no", ":stack_no"),
(eq, ":troop_id", "trp_recruiter"),
(assign, ":destruction",0),
(try_end),
(try_begin),
(party_get_battle_opponent, ":opponent", ":party_no"),
(lt, ":opponent", 0),
(eq, ":destruction", 1),
(party_get_slot, ":party_origin", ":party_no", slot_party_recruiter_origin),
(str_store_party_name_link, s13, ":party_origin"),
(assign, reg10, ":needed"),
(display_log_message, "@Your recruiter who was commissioned to recruit {reg10} recruits to {s13} has been defeated!", 0xFF0000),
(remove_party, ":party_no"),
(assign, ":quit", 1),
(try_end),
(eq, ":quit", 0),
(party_get_num_companions, ":amount", ":party_no"),
(val_sub, ":amount", 1), #the recruiter himself doesn't count.
#daedalus begin
(party_get_slot, ":recruit_faction", ":party_no", slot_party_recruiter_needed_recruits_faction),
#daedalus end
(lt, ":amount", ":needed"), #If the recruiter has less troops than player ordered, new village will be set as target.
(try_begin),
#(get_party_ai_current_behavior, ":ai_bhvr", ":party_no"),
#(eq, ":ai_bhvr", ai_bhvr_hold),
(get_party_ai_object, ":previous_target", ":party_no"),
(get_party_ai_behavior, ":previous_behavior", ":party_no"),
(try_begin),
(neq, ":previous_behavior", ai_bhvr_hold),
(neq, ":previous_target", -1),
(party_set_slot, ":previous_target", slot_village_reserved_by_recruiter, 0),
(try_end),
(assign, ":min_distance", 999999),
(assign, ":closest_village", -1),
(try_for_range, ":village", villages_begin, villages_end),
(store_distance_to_party_from_party, ":distance", ":party_no", ":village"),
(lt, ":distance", ":min_distance"),
(try_begin),
(store_faction_of_party, ":village_current_faction", ":village"),
(assign, ":faction_relation", 100),
(try_begin),
(neq, ":village_current_faction", "$players_kingdom"), # faction relation will be checked only if the village doesn't belong to the player's current faction
(store_relation, ":faction_relation", "$players_kingdom", ":village_current_faction"),
(try_end),
(ge, ":faction_relation", 0),
(party_get_slot, ":village_relation", ":village", slot_center_player_relation),
(ge, ":village_relation", 0),
(party_get_slot, ":volunteers_in_village", ":village", slot_center_volunteer_troop_amount),
(gt, ":volunteers_in_village", 0),
#daedalus begin
(party_get_slot, ":village_faction", ":village", slot_center_original_faction),
(assign,":stop",1),
(try_begin),
(eq,":recruit_faction",-1),
(assign,":stop",0),
(else_try),
(eq, ":village_faction", ":recruit_faction"),
(assign,":stop",0),
(try_end),
(neq,":stop",1),
#daedalus end
(neg|party_slot_eq, ":village", slot_village_state, svs_looted),
(neg|party_slot_eq, ":village", slot_village_state, svs_being_raided),
(neg|party_slot_ge, ":village", slot_village_infested_by_bandits, 1),
(neg|party_slot_eq, ":village", slot_village_reserved_by_recruiter, 1),
(assign, ":min_distance", ":distance"),
(assign, ":closest_village", ":village"),
(try_end),
(try_end),
(gt, ":closest_village", -1),
(party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_party),
(party_set_ai_object, ":party_no", ":closest_village"),
(party_set_slot, ":party_no", slot_party_ai_object, ":closest_village"),
(party_set_slot, ":closest_village", slot_village_reserved_by_recruiter, 1),
(try_end),
(party_get_slot, ":target", ":party_no", slot_party_ai_object),
(gt, ":target", -1),
(store_distance_to_party_from_party, ":distance_from_target", ":party_no", ":target"),
(try_begin),
(store_faction_of_party, ":target_current_faction", ":target"),
(assign, ":faction_relation", 100),
(try_begin),
(neq, ":target_current_faction", "$players_kingdom"), # faction relation will be checked only if the target doesn't belong to the player's current faction
(store_relation, ":faction_relation", "$players_kingdom", ":target_current_faction"),
(try_end),
(ge, ":faction_relation", 0),
(party_get_slot, ":target_relation", ":target", slot_center_player_relation),
(ge, ":target_relation", 0),
#daedalus begin
(party_get_slot, ":target_faction", ":target", slot_center_original_faction),
(assign,":stop",1),
(try_begin),
(eq,":recruit_faction",-1),
(assign,":stop",0),
(else_try),
(eq, ":target_faction", ":recruit_faction"),
(assign,":stop",0),
(try_end),
(neq,":stop",1),
#daedalus end
(neg|party_slot_eq, ":target", slot_village_state, svs_looted),
(neg|party_slot_eq, ":target", slot_village_state, svs_being_raided),
(neg|party_slot_ge, ":target", slot_village_infested_by_bandits, 1),
(le, ":distance_from_target", 0),
(party_get_slot, ":volunteers_in_target", ":target", slot_center_volunteer_troop_amount),
(party_get_slot, ":target_volunteer_type", ":target", slot_center_volunteer_troop_type),
(assign, ":still_needed", ":needed"),
(val_sub, ":still_needed", ":amount"),
(try_begin),
(gt, ":volunteers_in_target", ":still_needed"),
(assign, ":santas_little_helper", ":volunteers_in_target"),
(val_sub, ":santas_little_helper", ":still_needed"),
(assign, ":amount_to_recruit", ":volunteers_in_target"),
(val_sub, ":amount_to_recruit", ":santas_little_helper"),
(assign, ":new_target_volunteer_amount", ":volunteers_in_target"),
(val_sub, ":new_target_volunteer_amount", ":amount_to_recruit"),
(party_set_slot, ":target", slot_center_volunteer_troop_amount, ":new_target_volunteer_amount"),
(party_add_members, ":party_no", ":target_volunteer_type", ":amount_to_recruit"),
(party_set_ai_behavior, ":party_no", ai_bhvr_hold),
(party_set_slot, ":target", slot_village_reserved_by_recruiter, 0),
(else_try),
(le, ":volunteers_in_target", ":still_needed"),
(gt, ":volunteers_in_target", 0),
(party_set_slot, ":target", slot_center_volunteer_troop_amount, -1),
(party_add_members, ":party_no", ":target_volunteer_type", ":volunteers_in_target"),
(party_set_ai_behavior, ":party_no", ai_bhvr_hold),
(party_set_slot, ":target", slot_village_reserved_by_recruiter, 0),
(else_try),
(le, ":volunteers_in_target", 0),
(party_set_ai_behavior, ":party_no", ai_bhvr_hold),
(party_set_slot, ":target", slot_village_reserved_by_recruiter, 0),
(else_try),
(display_message, "@ERROR IN THE RECRUITER KIT SIMPLE TRIGGERS!",0xFF2222),
(party_set_slot, ":target", slot_village_reserved_by_recruiter, 0),
(try_end),
(try_end),
(try_end),
(try_for_parties, ":party_no"),
(party_slot_eq,":party_no", slot_party_type, spt_recruiter),
(party_get_num_companions, ":amount", ":party_no"),
(val_sub, ":amount", 1), #the recruiter himself doesn't count
(party_get_slot, ":needed", ":party_no", slot_party_recruiter_needed_recruits),
(eq, ":amount", ":needed"),
(party_get_slot, ":party_origin", ":party_no", slot_party_recruiter_origin),
(try_begin),
(neg|party_slot_eq, ":party_no", slot_party_ai_object, ":party_origin"),
(party_set_slot, ":party_no", slot_party_ai_object, ":party_origin"),
(party_set_ai_behavior, ":party_no", ai_bhvr_travel_to_party),
(party_set_ai_object, ":party_no", ":party_origin"),
(try_end),
(store_distance_to_party_from_party, ":distance_from_origin", ":party_no", ":party_origin"),
(try_begin),
(le, ":distance_from_origin", 0),
(party_get_num_companion_stacks, ":stacks", ":party_no"),
(try_for_range, ":stack_no", 1, ":stacks"),
(party_stack_get_size, ":size", ":party_no", ":stack_no"),
(party_stack_get_troop_id, ":troop_id", ":party_no", ":stack_no"),
(party_add_members, ":party_origin", ":troop_id", ":size"),
(try_end),
(str_store_party_name_link, s13, ":party_origin"),
(assign, reg10, ":amount"),
(display_log_message, "@A recruiter has brought {reg10} recruits to {s13}.", 0x00FF00),
(remove_party, ":party_no"),
(try_end),
(try_end),
]),
#This trigger makes sure that no village is left reserved forever.
(12,
[
(try_for_range, ":village", villages_begin, villages_end),
(party_set_slot, ":village", slot_village_reserved_by_recruiter, 0),
(try_end),
]),
############################################################################################################################
## Recruiter kit end
############################################################################################################################
module_troops
- This can be anywhere between "mercenaries_end" and "town_walker_1".
Code:
["recruiter","Recruiter","Recruiter",tf_mounted|tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_gloves|tf_guarantee_horse|tf_guarantee_ranged,0,0,fac_neutral,
[itm_sword_medieval_a,itm_leather_jerkin,itm_leather_boots,itm_courser,itm_leather_gloves,itm_light_crossbow,itm_bolts],
def_attrib|agi_21|int_30|cha_21|level(25),wp(130),knows_common|knows_riding_7|knows_horse_archery_5|knows_leadership_7,swadian_face_young_1, swadian_face_old_2],
That's it! If you have problems, send me a PM or post in the thread. The latter is recommended.
Changelog:
1.30
- Warband compatibility.
1.20
- Change: Recruiters can now be attacked by other parties, and their nationality is visible.
- Change: Recruiters can no longer recruit from villages that have negative relation to player or from villages that belong to hostile kingdom.
- Change: A red message is displayed every time a recruiter is defeated.
- Change: The message that tells that a recruiter has returned home is now colored green.
- Fix: Two minor bugs.
1.10
- Added ability to order recruits of specified nationality.
1.0
- First version.
If you want to use this feature in your mod you don't have to ask my permission to do so. Just inform me with a PM and add as many of us* as possible in the credits.
*Credits go to:
- Hessuu (Coding)
- Stoker (Advicing me on how to implement the recruiter spawning)
- Blankin (Coding the dialogs)
- Alkhadias Master (Doing most of the coding for version 1.10 scripts)
- cdvader (Giving an excellent example on how to implent a feature)
- Janus (Maker of the mod installer script)
Any help, comments, ideas and bug reports are appreciated! Feel free to modify and redistribute the mod at will!