---This tutorial allows you to implement a code that lets you recruit troops from both
castles and towns, however you can recruit nobles from castles, and regulars from towns.
first off is module scripts.py-------
-----My take is that this is to set the condition whether or not the player can recruit in this
town/castle. An example might be if negative relation(even if not in war), player
cannot recruit.-----
################################################################################################################
---------IMPORTANT CODE to start it immediately rather than wait for 3 days--------
(try_for_range, ":village_no", villages_begin, villages_end),
(call_script, "script_update_volunteer_troops_in_village", ":village_no"),
(try_end),
----Find this inside module_scripts "game_start" and change the range tocenters_begin, centers_end.----
################################################################################################################
#script_cf_town_recruit_volunteers_cond
# INPUT: none
# OUTPUT: none
("cf_town_recruit_volunteers_cond", #renamed
[(store_faction_of_party, ":town_faction", "$current_town"),
(party_get_slot, ":center_relation", "$current_town", slot_center_player_relation),
(store_relation, ":town_faction_relation", ":town_faction", "fac_player_faction"),
(ge, ":center_relation", 0),
(this_or_next|ge, ":center_relation", 5),
(this_or_next|eq, ":town_faction", "$players_kingdom"),
(this_or_next|ge, ":town_faction_relation", 0),
(this_or_next|eq, ":town_faction", "$supported_pretender_old_faction"),
( eq, "$players_kingdom", 0),
(party_slot_ge, "$current_town", slot_center_volunteer_troop_amount, 0),
(party_slot_ge, "$current_town", slot_center_volunteer_troop_type, 1),
(party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
(ge, ":free_capacity", 1),
]),
################################################################################################################
-----below this----
#script_cf_village_recruit_volunteers_cond
# INPUT: none
# OUTPUT: none
("cf_village_recruit_volunteers_cond",
[
(try_begin),
(eq, "$cheat_mode", 1),
(display_message, "str_checking_volunteer_availability_script"),
(try_end),
(neg|party_slot_eq, "$current_town", slot_village_state, svs_looted),
(neg|party_slot_eq, "$current_town", slot_village_state, svs_being_raided),
(neg|party_slot_ge, "$current_town", slot_village_infested_by_bandits, 1),
(store_faction_of_party, ":village_faction", "$current_town"),
(party_get_slot, ":center_relation", "$current_town", slot_center_player_relation),
(store_relation, ":village_faction_relation", ":village_faction", "fac_player_faction"),
(ge, ":center_relation", 0),
(try_begin),
(eq, "$cheat_mode", 1),
(display_message, "str_center_relation_at_least_zero"),
(try_end),
(this_or_next|ge, ":center_relation", 5),
(this_or_next|eq, ":village_faction", "$players_kingdom"),
(this_or_next|ge, ":village_faction_relation", 0),
(this_or_next|eq, ":village_faction", "$supported_pretender_old_faction"),
(eq, "$players_kingdom", 0),
(try_begin),
(eq, "$cheat_mode", 1),
(display_message, "str_relationfaction_conditions_met"),
(try_end),
(party_slot_ge, "$current_town", slot_center_volunteer_troop_amount, 0),
(party_slot_ge, "$current_town", slot_center_volunteer_troop_type, 1),
(try_begin),
(eq, "$cheat_mode", 1),
(display_message, "str_troops_available"),
(try_end),
(party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
(ge, ":free_capacity", 1),
(try_begin),
(eq, "$cheat_mode", 1),
(display_message, "str_party_has_capacity"),
(try_end),
]),
################################################################################################################
--- scripts 2;
place this code ---
You need to place each code for both nobles and volunteers
(faction_get_slot, ":volunteer_troop", ":cur_faction", slot_faction_tier_1_troop), This indicate the tier of troop being hired.
It's in the scripts so you can edit the troops to be recruited in there
#script_castle_recruit_nobles_recruit
# INPUT: none
# OUTPUT: none
("castle_recruit_nobles_recruit", #link from menu
[(store_faction_of_party, ":cur_faction", "$current_town"),
(faction_get_slot, ":volunteer_troop", ":cur_faction", slot_faction_tier_1_troop), #changed tier so it wouldnt recruit nobles.
(party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
(party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
(val_min, ":volunteer_amount", ":free_capacity"),
(store_troop_gold, ":gold", "trp_player"),
(store_div, ":gold_capacity", ":gold", 200),#200 denars per man
(val_min, ":volunteer_amount", ":gold_capacity"),
(party_add_members, "p_main_party", ":volunteer_troop", ":volunteer_amount"),
(party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
(store_mul, ":cost", ":volunteer_amount", 200),#200 denars per man
(troop_remove_gold, "trp_player", ":cost"),
]),
################################################################################################################
---below this---
#script_village_recruit_volunteers_recruit
# INPUT: none
# OUTPUT: none
("village_recruit_volunteers_recruit",
[(store_faction_of_party, ":cur_faction", "$current_town"),
(faction_get_slot, ":volunteer_troop", ":cur_faction", slot_faction_tier_2_troop),
(party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
(party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
(val_min, ":volunteer_amount", ":free_capacity"),
(store_troop_gold, ":gold", "trp_player"),
(store_div, ":gold_capacity", ":gold", 10),#10 denars per man
(val_min, ":volunteer_amount", ":gold_capacity"),
(party_add_members, "p_main_party", ":volunteer_troop", ":volunteer_amount"),
(party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
(store_mul, ":cost", ":volunteer_amount", 10),#10 denars per man
(troop_remove_gold, "trp_player", ":cost"),
]),
################################################################################################################
-----Now for module game menus, we are going to change it so each tree is specifically
recruited from castle or town.-----
------This is the dialog to recruit troops in town/castle------
################################################################################################################
("recruit_nobles",[(is_between, "$current_town",
castles_begin, castles_end), (call_script,
"script_cf_town_recruit_volunteers_cond"),]
,"Recruit Nobles.",
[
(try_begin),
(call_script, "script_cf_enter_center_location_bandit_check"),
(else_try),
(jump_to_menu, "mnu_recruit_nobles"),
(try_end),
]),
("recruit_normals",[(is_between, "$current_town",
towns_begin, towns_end), (call_script,
"script_cf_town_recruit_volunteers_cond"),]
,"Recruit Volunteers.",
[
(try_begin),
(call_script, "script_cf_enter_center_location_bandit_check"),
(else_try),
(jump_to_menu, "mnu_recruit_normales"),
(try_end),
]),
----Place this below door to the castle from castle_castle-----
----Put at the the last game menu, before the last ] Remember that this code is only
for normales. To include nobles too you'll need to add the same code that recruits
nobles----
----This is the code for the dialog during recruitment, and conditions whether the player
can recruit or not.-----
---- (call_script, "script_town_recruit_nobles_recruit"),Link to script----
################################################################################################################
(
"recruit_normales",0,
"{s18}",
"none",
[(store_faction_of_party, ":cur_faction", "$current_town"),
(faction_get_slot, ":volunteer_troop", ":cur_faction", slot_faction_tier_3_troop),
(party_get_slot, ":volunteer_amount", "$current_town", slot_center_volunteer_troop_amount),
(party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
(store_troop_gold, ":gold", "trp_player"),
(store_div, ":gold_capacity", ":gold", 40),#40 denars per man
(assign, ":party_capacity", ":free_capacity"),
(val_min, ":party_capacity", ":gold_capacity"),
(try_begin),
(gt, ":party_capacity", 0),
(val_min, ":volunteer_amount", ":party_capacity"),
(try_end),
(assign, reg5, ":volunteer_amount"),
(assign, reg7, 0),
(try_begin),
(gt, ":volunteer_amount", ":gold_capacity"),
(assign, reg7, 1), #not enough money
(try_end),
(try_begin),
(eq, ":volunteer_amount", 0),
(str_store_string, s18, "@No one here seems to be willing to join your party."),
(else_try),
(store_mul, reg6, ":volunteer_amount", 40),#40 denars per man
(str_store_troop_name_by_count, s3, ":volunteer_troop", ":volunteer_amount"),
(try_begin),
(eq, reg5, 1),
(str_store_string, s18, "@One {s3} volunteers to follow you."),
(else_try),
(str_store_string, s18, "@{reg5} {s3} volunteer to follow you."),
(try_end),
(set_background_mesh, "mesh_pic_recruits"),
(try_end),
],
[
("continue_not_enough_gold",
[
(eq, reg7, 1),
],
"I don't have enough money...",
[
(jump_to_menu, "mnu_town"),
]),
("continue",
[
(eq, reg7, 0),
(eq, reg5, 0),
], #noone willing to join
"Continue...",
[
(party_set_slot, "$current_town", slot_center_volunteer_troop_amount, -1),
(jump_to_menu, "mnu_town"),
]),
("recruit_them",
[
(eq, reg7, 0),
(gt, reg5, 0),
],
"Recruit them ({reg6} denars).",
[
(call_script, "script_castle_recruit_nobles_recruit"),
(jump_to_menu, "mnu_town"),
]),
("forget_it",
[
(eq, reg7, 0),
(gt, reg5, 0),
],
"Forget it.",
[
(jump_to_menu, "mnu_town"),
]),
],
),
################################################################################################################