Keedo420
Knight at Arms
In my mod, I have added the option to work in the Salt Mine as a way to earn some extra gold. It works basically the same as resting in a town, but the player earns gold instead of losing it.
EDIT: With no troops, the player gets 5 gold per day. With 10 troops, the player gets 45 gold per day. The player may randomly find new salt, iron, silver, gold, or mineral deposits, thus increasing his pay for that day. However, while mining you can be attacked and there is the possibility that you and/or your troops may be injured by cave-ins. It is also possible some of your troops may be killed.
EDIT 2: I have now included the option to put your prisoners to work in the Salt Mine. After putting prisoners to work in the salt mine, you will earn gold based on the number of prisoners working.
EDIT 3: There is now a chance that some prisoners will escape, but you can station troops to help prevent it from happening. The script isn't perfect yet, but here is what I have so far:
In module_game_menus:
In module_simple_triggers:
In module_scripts:
EDIT: With no troops, the player gets 5 gold per day. With 10 troops, the player gets 45 gold per day. The player may randomly find new salt, iron, silver, gold, or mineral deposits, thus increasing his pay for that day. However, while mining you can be attacked and there is the possibility that you and/or your troops may be injured by cave-ins. It is also possible some of your troops may be killed.
EDIT 2: I have now included the option to put your prisoners to work in the Salt Mine. After putting prisoners to work in the salt mine, you will earn gold based on the number of prisoners working.
EDIT 3: There is now a chance that some prisoners will escape, but you can station troops to help prevent it from happening. The script isn't perfect yet, but here is what I have so far:
In module_game_menus:
(
"salt_mine",mnf_enable_hot_keys,
"You arrive at a small mining camp.",
"none",
[(reset_price_rates,0),(set_price_rate_for_item,"itm_salt",55)],
[
("enter",[],"Approach the camp.",[(set_jump_mission,"mt_town_center"),(jump_to_scene,"scn_salt_mine"),(change_screen_mission)]),
("talk_merchant",[]
,"Talk to the Mine Merchant.",
[
(assign, "$talk_context", 0),
(assign, "verride_state", af_override_horse),
(mission_tpl_entry_set_override_flags, "mt_town_center", 0, "verride_state"),
(mission_tpl_entry_set_override_flags, "mt_town_center", 2, "verride_state"),
(mission_tpl_entry_set_override_flags, "mt_town_center", 3, "verride_state"),
(mission_tpl_entry_set_override_flags, "mt_town_center", 4, "verride_state"),
(mission_tpl_entry_set_override_flags, "mt_town_center", 5, "verride_state"),
(mission_tpl_entry_set_override_flags, "mt_town_center", 6, "verride_state"),
(mission_tpl_entry_set_override_flags, "mt_town_center", 7, "verride_state"),
(jump_to_scene, "scn_salt_mine"),
(change_screen_map_conversation, "trp_salt_mine_merchant"),
],"Exit to the camp."),
("work_mines",
[
(store_troop_health, "$g_player_health","trp_player", 1),
(str_clear, s1),
(party_get_num_companions, ":num_men", "p_main_party"),
(store_mul, reg1, ":num_men", 4),
(val_add, reg1, 1),
(str_store_string, s1, "@ ({reg1} denars per day)"),
],
"Volunteer to work in the mines{s1}.",
[
(try_begin),
(neg|gt, "$g_player_health", 20),
(display_message, "@You are in no condition to work."),
(jump_to_menu,"mnu_salt_mine"),
(else_try),
(assign, "$g_is_working", 1),
(assign, "$g_last_rest_payment_until", -1),
(rest_for_hours_interactive, 24, 5, 1), #rest while attackable
(change_screen_return),
(try_end),
]),
("add_prisoners",
[
(str_clear, s1),
(party_get_num_prisoners, "$g_num_prisoners", "p_salt_mine"),
(assign, reg1, "$g_num_prisoners"),
(str_store_string, s1, "@ (Currently {reg1} prisoners working)"),
],
"Put prisoners to work in the mines{s1}.",
[
(change_screen_exchange_members, 0),
]),
("add_guards",
[
(str_clear, s1),
(party_get_num_companions, "$g_num_guards", "p_salt_mine"),
(assign, reg1, "$g_num_guards"),
(str_store_string, s1, "@ (Currently {reg1} guards on duty)"),
],
"Station guards to watch over prisoners{s1}.",
[
(change_screen_exchange_members, 0),
]),
("leave",[],"Leave.",[(leave_encounter),(change_screen_return)]),
]
),
(
"slave_labor",mnf_disable_all_keys,
"{s1}",
"none",
[
(str_clear, s1),
(assign, reg1, "$g_earnings"),
(troop_add_gold, "trp_player", "$g_earnings"),
(try_begin),
(gt, "$g_num_escapees", 0),
(str_store_string, s1, "@Some of the prisoners you have working in the mine managed to escape.^The remaining prisoners earned you {reg1} denars this week."),
(else_try),
(str_store_string, s1, "@The prisoners you have working in the mine earned you {reg1} denars this week."),
(try_end),
],
[
("continue",[], "Continue...",
[
(change_screen_return),
]),
],
),
"salt_mine",mnf_enable_hot_keys,
"You arrive at a small mining camp.",
"none",
[(reset_price_rates,0),(set_price_rate_for_item,"itm_salt",55)],
[
("enter",[],"Approach the camp.",[(set_jump_mission,"mt_town_center"),(jump_to_scene,"scn_salt_mine"),(change_screen_mission)]),
("talk_merchant",[]
,"Talk to the Mine Merchant.",
[
(assign, "$talk_context", 0),
(assign, "verride_state", af_override_horse),
(mission_tpl_entry_set_override_flags, "mt_town_center", 0, "verride_state"),
(mission_tpl_entry_set_override_flags, "mt_town_center", 2, "verride_state"),
(mission_tpl_entry_set_override_flags, "mt_town_center", 3, "verride_state"),
(mission_tpl_entry_set_override_flags, "mt_town_center", 4, "verride_state"),
(mission_tpl_entry_set_override_flags, "mt_town_center", 5, "verride_state"),
(mission_tpl_entry_set_override_flags, "mt_town_center", 6, "verride_state"),
(mission_tpl_entry_set_override_flags, "mt_town_center", 7, "verride_state"),
(jump_to_scene, "scn_salt_mine"),
(change_screen_map_conversation, "trp_salt_mine_merchant"),
],"Exit to the camp."),
("work_mines",
[
(store_troop_health, "$g_player_health","trp_player", 1),
(str_clear, s1),
(party_get_num_companions, ":num_men", "p_main_party"),
(store_mul, reg1, ":num_men", 4),
(val_add, reg1, 1),
(str_store_string, s1, "@ ({reg1} denars per day)"),
],
"Volunteer to work in the mines{s1}.",
[
(try_begin),
(neg|gt, "$g_player_health", 20),
(display_message, "@You are in no condition to work."),
(jump_to_menu,"mnu_salt_mine"),
(else_try),
(assign, "$g_is_working", 1),
(assign, "$g_last_rest_payment_until", -1),
(rest_for_hours_interactive, 24, 5, 1), #rest while attackable
(change_screen_return),
(try_end),
]),
("add_prisoners",
[
(str_clear, s1),
(party_get_num_prisoners, "$g_num_prisoners", "p_salt_mine"),
(assign, reg1, "$g_num_prisoners"),
(str_store_string, s1, "@ (Currently {reg1} prisoners working)"),
],
"Put prisoners to work in the mines{s1}.",
[
(change_screen_exchange_members, 0),
]),
("add_guards",
[
(str_clear, s1),
(party_get_num_companions, "$g_num_guards", "p_salt_mine"),
(assign, reg1, "$g_num_guards"),
(str_store_string, s1, "@ (Currently {reg1} guards on duty)"),
],
"Station guards to watch over prisoners{s1}.",
[
(change_screen_exchange_members, 0),
]),
("leave",[],"Leave.",[(leave_encounter),(change_screen_return)]),
]
),
(
"slave_labor",mnf_disable_all_keys,
"{s1}",
"none",
[
(str_clear, s1),
(assign, reg1, "$g_earnings"),
(troop_add_gold, "trp_player", "$g_earnings"),
(try_begin),
(gt, "$g_num_escapees", 0),
(str_store_string, s1, "@Some of the prisoners you have working in the mine managed to escape.^The remaining prisoners earned you {reg1} denars this week."),
(else_try),
(str_store_string, s1, "@The prisoners you have working in the mine earned you {reg1} denars this week."),
(try_end),
],
[
("continue",[], "Continue...",
[
(change_screen_return),
]),
],
),
In module_simple_triggers:
# Pay denars to player while working in mines
(1,
[(try_begin),
(eq, "$g_is_working", 1),
(neg|map_free),
(is_currently_night),
(store_current_hours, ":cur_hours"),
(ge, ":cur_hours", "$g_last_rest_payment_until"),
(store_add, "$g_last_rest_payment_until", ":cur_hours", 24),
(party_get_num_companions, ":num_men", "p_main_party"),
(store_mul, ":total_pay", ":num_men", 4),
(val_add, ":total_pay", 1),
(display_message, "@You are paid for your labor."),
(troop_add_gold, "trp_player", ":total_pay"),
(call_script, "script_mine_work"),
(assign, "$g_is_working", 0),
(try_end),
]),
# Pay slave labor earnings and check for prisoners escaping
(24 * 7,
[
(try_begin),
(gt, "$g_num_prisoners", 0),
(assign, "$g_earnings", 0),
(assign, "$g_num_escapees", 0),
(try_for_range, ":center_no", "p_salt_mine", "p_test_scene"),
(party_get_num_companions,"$g_num_guards",":center_no"),
(party_get_num_prisoners, "$g_num_prisoners", ":center_no"),
(store_sub, ":difference", "$g_num_prisoners", "$g_num_guards"),
(try_begin),
(gt, ":difference", 0),
(store_random_in_range, ":random", 0, ":difference"),
(try_begin),
(gt, ":random", 5),
(store_random_in_range, ":escapees", 0, ":difference"),
(try_begin),
(eq, ":escapees", 0),
(assign, ":escapees", 1),
(try_end),
(assign, "$g_num_escapees", ":escapees"),
(party_get_num_prisoner_stacks, ":num_stacks", ":center_no"),
(try_for_range_backwards, ":troop_iterator", 0, ":num_stacks"),
(party_prisoner_stack_get_troop_id, ":cur_troop_id", ":center_no", ":troop_iterator"),
(party_prisoner_stack_get_size, ":stack_size", ":center_no", ":troop_iterator"),
(try_begin),
(gt, ":escapees", 0),
(try_begin),
(gt, ":stack_size", ":escapees"),
(store_sub, ":stack_sub", ":stack_size", ":escapees"),
(val_sub, ":escapees", ":stack_sub"),
(party_remove_prisoners, ":center_no", ":cur_troop_id", ":stack_sub"),
(try_end),
(try_end),
(try_end),
(try_end),
(try_end),
(party_get_num_prisoners, "$g_num_prisoners", ":center_no"),
(store_mul, ":earnings", 10, "$g_num_prisoners"),
(val_add, "$g_earnings", ":earnings"),
(jump_to_menu,"mnu_slave_labor"),
(try_end),
(try_end),
]),
(1,
[(try_begin),
(eq, "$g_is_working", 1),
(neg|map_free),
(is_currently_night),
(store_current_hours, ":cur_hours"),
(ge, ":cur_hours", "$g_last_rest_payment_until"),
(store_add, "$g_last_rest_payment_until", ":cur_hours", 24),
(party_get_num_companions, ":num_men", "p_main_party"),
(store_mul, ":total_pay", ":num_men", 4),
(val_add, ":total_pay", 1),
(display_message, "@You are paid for your labor."),
(troop_add_gold, "trp_player", ":total_pay"),
(call_script, "script_mine_work"),
(assign, "$g_is_working", 0),
(try_end),
]),
# Pay slave labor earnings and check for prisoners escaping
(24 * 7,
[
(try_begin),
(gt, "$g_num_prisoners", 0),
(assign, "$g_earnings", 0),
(assign, "$g_num_escapees", 0),
(try_for_range, ":center_no", "p_salt_mine", "p_test_scene"),
(party_get_num_companions,"$g_num_guards",":center_no"),
(party_get_num_prisoners, "$g_num_prisoners", ":center_no"),
(store_sub, ":difference", "$g_num_prisoners", "$g_num_guards"),
(try_begin),
(gt, ":difference", 0),
(store_random_in_range, ":random", 0, ":difference"),
(try_begin),
(gt, ":random", 5),
(store_random_in_range, ":escapees", 0, ":difference"),
(try_begin),
(eq, ":escapees", 0),
(assign, ":escapees", 1),
(try_end),
(assign, "$g_num_escapees", ":escapees"),
(party_get_num_prisoner_stacks, ":num_stacks", ":center_no"),
(try_for_range_backwards, ":troop_iterator", 0, ":num_stacks"),
(party_prisoner_stack_get_troop_id, ":cur_troop_id", ":center_no", ":troop_iterator"),
(party_prisoner_stack_get_size, ":stack_size", ":center_no", ":troop_iterator"),
(try_begin),
(gt, ":escapees", 0),
(try_begin),
(gt, ":stack_size", ":escapees"),
(store_sub, ":stack_sub", ":stack_size", ":escapees"),
(val_sub, ":escapees", ":stack_sub"),
(party_remove_prisoners, ":center_no", ":cur_troop_id", ":stack_sub"),
(try_end),
(try_end),
(try_end),
(try_end),
(try_end),
(party_get_num_prisoners, "$g_num_prisoners", ":center_no"),
(store_mul, ":earnings", 10, "$g_num_prisoners"),
(val_add, "$g_earnings", ":earnings"),
(jump_to_menu,"mnu_slave_labor"),
(try_end),
(try_end),
]),
In module_scripts:
# Working in the mines
("mine_work",
[(assign, ":party_no", "p_main_party"),
(party_get_num_companion_stacks, ":num_stacks", ":party_no"),
(store_random_in_range, ":random", 0, 10),
(try_begin),
(le, ":random", 3),
(troop_set_health, "trp_player", 80),
(else_try),
(eq, ":random", 4),
(troop_set_health, "trp_player", 70),
(store_random_in_range, ":random_gold", 0, 10),
(try_begin),
(le, ":random_gold", 5),
(display_message, "@While working in the mine, you found a new salt deposit and are rewarded for the discovery."),
(store_random_in_range, ":random_amount", 10, 100),
(troop_add_gold, "trp_player", ":random_amount"),
(else_try),
(eq, ":random_gold", 6),
(display_message, "@While working in the mine, you found an iron deposit and are rewarded for the discovery."),
(store_random_in_range, ":random_amount", 50, 200),
(troop_add_gold, "trp_player", ":random_amount"),
(else_try),
(eq, ":random_gold", 7),
(display_message, "@While working in the mine, you found a silver deposit and are rewarded for the discovery."),
(store_random_in_range, ":random_amount", 75, 300),
(troop_add_gold, "trp_player", ":random_amount"),
(else_try),
(eq, ":random_gold", 8 ),
(display_message, "@While working in the mine, you found a gold deposit and are rewarded for the discovery."),
(store_random_in_range, ":random_amount", 100, 400),
(troop_add_gold, "trp_player", ":random_amount"),
(else_try),
(eq, ":random_gold", 9),
(display_message, "@While working in the mine, you found a deposit of rare minerals and are rewarded for the discovery."),
(store_random_in_range, ":random_amount", 150, 500),
(troop_add_gold, "trp_player", ":random_amount"),
(try_end),
(else_try),
(eq, ":random", 5),
(troop_set_health, "trp_player", 50),
(display_message, "@While working in the mine, you were injured during a minor cave-in."),
(else_try),
(eq, ":random", 6),
(troop_set_health, "trp_player", 30),
(display_message, "@While working in the mine, you were hurt during a cave-in."),
(else_try),
(eq, ":random", 7),
(troop_set_health, "trp_player", 1),
(display_message, "@While working in the mine, you were nearly killed during a cave-in."),
(else_try),
(eq, ":random", 8 ),
(try_begin),
(gt, ":num_stacks", 0),
(call_script, "script_party_wound_all_members", ":party_no"),
(display_message, "@While working in the mine, you and your troops are wounded during a cave-in."),
(else_try),
(troop_set_health, "trp_player", 1),
(display_message, "@While working in the mine, you were nearly killed during a cave-in."),
(try_end),
(else_try),
(eq, ":random", 9),
(try_begin),
(gt, ":num_stacks", 0),
(troop_set_health, "trp_player", 50),
(store_random_in_range, ":random_deaths", 1, 10),
(inflict_casualties_to_party_group, ":party_no", ":random_deaths", "p_temp_casualties"),
(call_script, "script_print_casualties_to_s0", "p_temp_casualties", 0),
(str_store_string_reg, s8, s0),
(display_message, "@While working in the mine, a massive cave-in caused your party casualties: {s8}"),
(else_try),
(troop_set_health, "trp_player", 1),
(display_message, "@While working in the mine, you were nearly killed during a cave-in."),
(try_end),
(try_end),
]),
("mine_work",
[(assign, ":party_no", "p_main_party"),
(party_get_num_companion_stacks, ":num_stacks", ":party_no"),
(store_random_in_range, ":random", 0, 10),
(try_begin),
(le, ":random", 3),
(troop_set_health, "trp_player", 80),
(else_try),
(eq, ":random", 4),
(troop_set_health, "trp_player", 70),
(store_random_in_range, ":random_gold", 0, 10),
(try_begin),
(le, ":random_gold", 5),
(display_message, "@While working in the mine, you found a new salt deposit and are rewarded for the discovery."),
(store_random_in_range, ":random_amount", 10, 100),
(troop_add_gold, "trp_player", ":random_amount"),
(else_try),
(eq, ":random_gold", 6),
(display_message, "@While working in the mine, you found an iron deposit and are rewarded for the discovery."),
(store_random_in_range, ":random_amount", 50, 200),
(troop_add_gold, "trp_player", ":random_amount"),
(else_try),
(eq, ":random_gold", 7),
(display_message, "@While working in the mine, you found a silver deposit and are rewarded for the discovery."),
(store_random_in_range, ":random_amount", 75, 300),
(troop_add_gold, "trp_player", ":random_amount"),
(else_try),
(eq, ":random_gold", 8 ),
(display_message, "@While working in the mine, you found a gold deposit and are rewarded for the discovery."),
(store_random_in_range, ":random_amount", 100, 400),
(troop_add_gold, "trp_player", ":random_amount"),
(else_try),
(eq, ":random_gold", 9),
(display_message, "@While working in the mine, you found a deposit of rare minerals and are rewarded for the discovery."),
(store_random_in_range, ":random_amount", 150, 500),
(troop_add_gold, "trp_player", ":random_amount"),
(try_end),
(else_try),
(eq, ":random", 5),
(troop_set_health, "trp_player", 50),
(display_message, "@While working in the mine, you were injured during a minor cave-in."),
(else_try),
(eq, ":random", 6),
(troop_set_health, "trp_player", 30),
(display_message, "@While working in the mine, you were hurt during a cave-in."),
(else_try),
(eq, ":random", 7),
(troop_set_health, "trp_player", 1),
(display_message, "@While working in the mine, you were nearly killed during a cave-in."),
(else_try),
(eq, ":random", 8 ),
(try_begin),
(gt, ":num_stacks", 0),
(call_script, "script_party_wound_all_members", ":party_no"),
(display_message, "@While working in the mine, you and your troops are wounded during a cave-in."),
(else_try),
(troop_set_health, "trp_player", 1),
(display_message, "@While working in the mine, you were nearly killed during a cave-in."),
(try_end),
(else_try),
(eq, ":random", 9),
(try_begin),
(gt, ":num_stacks", 0),
(troop_set_health, "trp_player", 50),
(store_random_in_range, ":random_deaths", 1, 10),
(inflict_casualties_to_party_group, ":party_no", ":random_deaths", "p_temp_casualties"),
(call_script, "script_print_casualties_to_s0", "p_temp_casualties", 0),
(str_store_string_reg, s8, s0),
(display_message, "@While working in the mine, a massive cave-in caused your party casualties: {s8}"),
(else_try),
(troop_set_health, "trp_player", 1),
(display_message, "@While working in the mine, you were nearly killed during a cave-in."),
(try_end),
(try_end),
]),