module_troops.py
example of troop tuples for merc camp
["mercanary_captain_shved", "Mercenary Captain","Mercenary Captains",tf_hero|tf_guarantee_armor|tf_guarantee_boots|tf_guarantee_horse|tf_guarantee_helmet,0,reserved,fac_commoners,
[itm_infantry_boots,itm_kirasa,itm_morion_good,itm_good_shpaga_b],
def_attrib|level(25),wp(200),knows_common,nord_face_middle_1, nord_face_older_2],
------------------------------------------------------------------------------------------------------------
# ======= 36
["shved_merch_novice_infantry", "European mercenary infantryman (recruit)","European mercenary infantry
(recruit)",tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_helmet|tf_guarantee_shield|tf_guarantee_gloves,no_scene,reserved,fac_commoners,
[],
str_9|agi_7|level(5),wp_melee(7
|wp_crossbow(41)|wp_archery(0),knows_weapon_master_4|knows_ironflesh_2|knows_power_strike_1|knows_riding_1|knows_horse_archery_1,nord_face_middle_1, nord_face_older_2],
["shved_merch_regular_infantry", "European mercenary infantryman (experienced)","European mercenary infantry
(experienced)",tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_helmet|tf_guarantee_shield|tf_guarantee_gloves,no_scene,reserved,fac_commoners,
[],
str_10|agi_8|level(10),wp_melee(93)|wp_crossbow(52)|wp_archery(0),knows_weapon_master_5|knows_ironflesh_3|knows_power_strike_2|knows_riding_1|knows_horse_archery_1,nord_face_middle_1, nord_face_older_2],
["shved_merch_veteran_infantry", "European mercenary infantryman (veteran)","European mercenary infantry
(veteran)",tf_guarantee_boots|tf_guarantee_armor|tf_guarantee_helmet|tf_guarantee_shield|tf_guarantee_gloves,no_scene,reserved,fac_commoners,
[],
str_11|agi_9|level(15),wp_melee(10
|wp_crossbow(63)|wp_archery(0),knows_weapon_master_6|knows_ironflesh_4|knows_power_strike_3|knows_riding_1|knows_horse_archery_1,nord_face_middle_1, nord_face_older_2],
#upgrades
upgrade(troops,"shved_merch_novice_infantry","shved_merch_regular_infantry")
upgrade(troops,"shved_merch_regular_infantry","shved_merch_veteran_infantry")
upgrade(troops,"shved_merch_veteran_infantry","shved_merch_champion_infantry")
upgrade(troops,"shved_merch_novice_archer","shved_merch_regular_archer")
upgrade(troops,"shved_merch_regular_archer","shved_merch_veteran_archer")
upgrade(troops,"shved_merch_veteran_archer","shved_merch_champion_archer")
upgrade(troops,"shved_merch_novice_horse","shved_merch_regular_horse")
upgrade(troops,"shved_merch_regular_horse","shved_merch_veteran_horse")
upgrade(troops,"shved_merch_veteran_horse","shved_merch_champion_horse")
end module_troops.py
---------------------------------------------------------------------------------------------------------------------
module_game_menus.py
(
"training_ground",0,"You approach a mercenary camp... Here you can hire warriors and arm your men.",
"none",
[
(store_add, "$g_training_ground_melee_training_scene", "scn_training_ground_ranged_melee_1", "$g_encountered_party"),
(val_sub, "$g_training_ground_melee_training_scene", training_grounds_begin),
(try_begin),
(ge, "$g_training_ground_training_count", 3),
(assign, "$g_training_ground_training_count", 0),
(rest_for_hours, 1, 5, 1), #rest while attackable
(assign, "$auto_enter_town", "$g_encountered_party"),
(change_screen_return),
(try_end),
],
[
("camp_trainer",
[(eq, 0, 1),],"Speak with the trainer.",
[
(set_jump_mission, "mt_training_ground_trainer_talk"),
(modify_visitors_at_site, "$g_training_ground_melee_training_scene"),
(reset_visitors),
(set_jump_entry, 5),
(jump_to_scene, "$g_training_ground_melee_training_scene"),
(change_screen_mission),
(music_set_situation, 0),
]),
########## This is what I was interested in
("camp_merch",
[],"Find the mercenary captain.",
[
(jump_to_menu, "mnu_capitan_vid"),
(music_set_situation, 0),
]),
######################################### Why isn't the next part right after the training menus?
(
"capitan_vid",mnf_disable_all_keys,"You ask the soldiers at the camp where you may find their commander, and they point out the captain.",
"none",
[
(set_background_mesh, "mesh_pic_recruits"),
],
[
("merch_tatar",
[
(eq, "$g_encountered_party", "p_training_ground_4"),
],"Talk to the captain of the Tatar mercenaries.",
[
(call_script, "script_naem_set_param", 0),
(music_set_situation, 0)
]),
("merch_kozak",
[
(eq, "$g_encountered_party", "p_training_ground_3"),
],"Talk to the captain of the Cossack mercenaries.",
[
(call_script, "script_naem_set_param", 1),
(music_set_situation, 0),
]),
("merch_polyak",
[
(eq, "$g_encountered_party", "p_training_ground_5"),
],"Talk to the captain of the Polish mercenaries.",
[
(call_script, "script_naem_set_param", 2),
(music_set_situation, 0),
]),
("merch_shved",
[
(eq, "$g_encountered_party", "p_training_ground_2"),
],"Talk to the captain of the Swedish mercenaries.",
[
(call_script, "script_naem_set_param", 3),
(music_set_situation, 0),
]),
("merch_moskov",
[
(eq, "$g_encountered_party", "p_training_ground_1"),
],"Talk to the captain of the Muscovite mercenaries.",
[
(call_script, "script_naem_set_param", 4),
(music_set_situation, 0),
]),
("Back_1",[],"Leave...",
[
(change_screen_return),
]),
]
),
end module_game_menus.py
------------------------------------------------------------------------------------------------------------
module_scripts.py
##OiM Code
# Input:
# Output: none
("naem_set_param",
[
(store_script_param, ":nation_num", 1),
(assign, "$g_cur_nation", ":nation_num"),
(store_mul, ":index", "$g_cur_nation", 3),
(store_add, ":infantry_index", ":index", 0),
(store_add, ":musketman_index", ":index", 1),
(store_add, ":cavalry_index", ":index", 2),
(troop_get_slot, ":count_infantry", "trp_week_limit_array", ":infantry_index"),
(troop_get_slot, ":count_musketman", "trp_week_limit_array", ":musketman_index"),
(troop_get_slot, ":count_cavalry", "trp_week_limit_array", ":cavalry_index"),
(store_add, "$g_naem_count_total", ":count_infantry", ":count_musketman"),
(val_add, "$g_naem_count_total", ":count_cavalry"),
#(assign, reg11, "$g_naem_count_total"),
#(display_message, "@OZANDEBUG : g_naem_count_total={reg11}"),
(val_add, ":nation_num", merch_capitan_begin),
(modify_visitors_at_site, "scn_meeting_scene_plain_forest"),
(reset_visitors),
(set_visitor,0,"trp_player"),
(set_visitor,17,":nation_num"),
(jump_to_scene,"scn_meeting_scene_plain_forest"),
(change_screen_map_conversation, ":nation_num"),
]),
# Input: none
# Output: none
("get_mercenary_price",
[
(store_mul, ":troop_displace", "$g_cur_nation", 3),
(val_add, ":troop_displace", "$g_naem_tip"),
(troop_get_slot, ":price", "trp_merch_price_array", ":troop_displace"),
(troop_get_slot, "$g_cur_troop", "trp_merch_array", ":troop_displace"),
(store_mul, ":index", "$g_cur_nation", 3),
(val_add, ":index", "$g_naem_tip"),
(troop_get_slot, ":count", "trp_week_limit_array", ":index"),
(try_begin),
(eq, "$g_naem_tip", 0),
(assign, ":max_count", 40), #5 * 8 (it will reach full capacity in 8 weeks if nobody takes them)
(else_try),
(eq, "$g_naem_tip", 1),
(assign, ":max_count", 40), #5 * 8 (it will reach full capacity in 8 weeks if nobody takes them)
(else_try),
(eq, "$g_naem_tip", 2),
(assign, ":max_count", 32), #4 * 8 (it will reach full capacity in 8 weeks if nobody takes them)
(try_end),
(store_mul, ":count_mul_100", ":count", 100),
(store_div, ":remaining_men_ratio", ":count_mul_100", ":max_count"),
#(assign, reg7, ":count_mul_100"),
#(assign, reg8, ":max_count"),
#(assign, reg9, ":remaining_men_ratio"),
#(display_message, "@OZANDEBUG : count_mul_100={reg7}, max_count={reg8}, remaining_men_ratio={reg9}"),
#price inflation PETEO removed this
# (try_begin), #if less men remained then price will be more... (max 2.4x, min 0.6x)
# (le, ":remaining_men_ratio", 10), #0%..10%
# (val_mul, ":price", 240),
# (val_div, ":price", 100),
# (else_try),
# (le, ":remaining_men_ratio", 20), #11%..20%
# (val_mul, ":price", 190),
# (val_div, ":price", 100),
# (else_try),
# (le, ":remaining_men_ratio", 30), #21%..30%
# (val_mul, ":price", 150),
# (val_div, ":price", 100),
# (else_try),
# (le, ":remaining_men_ratio", 40), #31%..40%
# (val_mul, ":price", 120),
# (val_div, ":price", 100),
# (else_try),
# (le, ":remaining_men_ratio", 50), #41%..50%
# (val_mul, ":price", 100),
# (val_div, ":price", 100),
# (else_try),
# (le, ":remaining_men_ratio", 60), #51%..60%
# (val_mul, ":price", 90),
# (val_div, ":price", 100),
# (else_try),
# (le, ":remaining_men_ratio", 70), #61%..70%
# (val_mul, ":price", 80),
# (val_div, ":price", 100),
# (else_try),
# (le, ":remaining_men_ratio", 80), #71%..80%
# (val_mul, ":price", 70),
# (val_div, ":price", 100),
# (else_try), #81%..100%
# (val_mul, ":price", 60),
# (val_div, ":price", 100),
# (try_end),
(call_script, "script_recalculate_price", ":price"),
(assign, "$g_naem_price", reg10),
(store_troop_gold,"$g_trp_player_gold","trp_player"),
]),
# Input: none
# Output: none
("naem_get_items",
[
(store_script_param, ":item_param", 1),
(store_script_param, ":item_variant", 2),
(store_mul, ":item_displace", "$g_cur_nation", 30),
(store_mul, ":displ", ":item_param", 3),
(val_add, ":item_displace", ":displ"),
(val_add, ":item_displace", "$g_naem_tip"),
(troop_get_slot, "
ld_item", "trp_cur_merch_arms_array", ":item_displace"),
(store_mul, ":displace", "$g_cur_nation", 50),
(store_mul, ":displ", ":item_param", 5),
(val_add, ":displace", ":displ"),
(val_add, ":displace", ":item_variant"),
(troop_get_slot, ":price", "trp_merch_arms_price_array", ":displace"),
(troop_get_slot, ":item", "trp_merch_arms_array", ":displace"),
(try_begin),
(eq, "
ld_item", ":item"),
(assign, reg0, 0),
(else_try),
(str_store_item_name, s20 , ":item"),
(val_mul, ":price", "$g_count_naem"),
(call_script, "script_recalculate_price", ":price"),
(assign, reg1, reg10),
(assign, reg6, reg1),
(str_store_string, s22, "@, {reg6} dinarov "),
(call_script, "script_cf_oim_item_cant_use_mounted_to_s5", ":item"),
(str_store_string, s21, "@ {s20}, {s22} {s5}"),
(store_troop_gold,"$g_trp_player_gold","trp_player"),
(assign, reg0, 0),
(try_begin),
(ge, "$g_trp_player_gold", reg1),
(gt, "$g_count_naem", 0),
(assign, reg0, 1),
(try_end),
(try_end),
]),
# script_set_merch_limit
# Input: no
# Output: no
("set_merch_limit",
[
(try_for_range, ":nation_num", nation_begin, nation_end),
(store_mul, ":index", ":nation_num", 3),
(store_add, ":infantry_index", ":index", 0),
(store_add, ":musketman_index", ":index", 1),
(store_add, ":cavalry_index", ":index", 2),
(troop_get_slot, ":num_infantry", "trp_week_limit_array", ":infantry_index"),
(troop_get_slot, ":num_musketman", "trp_week_limit_array", ":musketman_index"),
(troop_get_slot, ":num_cavalry", "trp_week_limit_array", ":cavalry_index"),
(val_add, ":num_infantry", 5),
(val_clamp,":num_infantry", 0, 40), #5 * 8 (it will reach full capacity in 8 weeks if nobody takes them)
(val_add, ":num_musketman", 5),
(val_clamp,":num_musketman", 0, 40), #5 * 8 (it will reach full capacity in 8 weeks if nobody takes them)
(val_add, ":num_cavalry", 4),
(val_clamp,":num_cavalry", 0, 32), #4 * 8 (it will reach full capacity in 8 weeks if nobody takes them)
(troop_set_slot, "trp_week_limit_array", ":infantry_index", ":num_infantry"),
(troop_set_slot, "trp_week_limit_array", ":musketman_index", ":num_musketman"),
(troop_set_slot, "trp_week_limit_array", ":cavalry_index", ":num_cavalry"),
(try_end),
]),
# script_set_merch_item_parametres
# Input: no
# Output: no
("set_merch_item_parametres",
[
(try_for_range, ":nation_num", nation_begin, nation_end),
(store_mul, ":index", ":nation_num", 3),
(store_add, ":infantry_index", ":index", 0),
(store_add, ":musketman_index", ":index", 1),
(store_add, ":cavalry_index", ":index", 2),
(troop_set_slot, "trp_week_limit_array", ":infantry_index", 15), #3 x 5 (initial starting is like 3 weeks past and nobody took them)
(troop_set_slot, "trp_week_limit_array", ":musketman_index", 15), #3 x 5 (initial starting is like 3 weeks past and nobody took them)
(troop_set_slot, "trp_week_limit_array", ":cavalry_index", 12), #3 x 4 (initial starting is like 3 weeks past and nobody took them)
(try_end),
(troop_set_slot, "trp_merch_type_price_array", 0, 30), #was 10
(troop_set_slot, "trp_merch_type_price_array", 1, 30), #was 12
(troop_set_slot, "trp_merch_type_price_array", 2, 30), #was 17 (horse prices already increased no need to make cavalry men very expensive)
(try_for_range, ":num", 0, 150),
(troop_set_slot, "trp_cur_merch_arms_array", ":num", 0),
(troop_set_slot, "trp_cur_merch_arms_price_array", ":num", 0),
(try_end),
-----------------------------------------
item lists here
removed for message length considerations
-----------------------------------------
(assign, ":start", merch_begin),
(assign, ":cur_nation", 0),
(assign, ":cur_troop_type", 0),
(try_for_range, ":cur_troop_displace", 0, 15),
(try_begin),
(eq, ":cur_troop_type", 3),
(assign, ":cur_troop_type", 0),
(val_add, ":cur_nation", 1),
(try_end),
(troop_set_slot, "trp_merch_array", ":cur_troop_displace", ":start"),
(troop_get_slot, ":total_price", "trp_merch_type_price_array", ":cur_troop_type"),
(store_mul, ":item_displace", ":cur_nation", 30),
(val_add, ":item_displace", ":cur_troop_type"),
(try_for_range, ":unused", 0, 10),
(troop_get_slot, ":new_item", "trp_cur_merch_arms_array", ":item_displace"),
(try_begin),
(gt, ":new_item", 0),
(troop_get_slot, ":new_item_price", "trp_cur_merch_arms_price_array", ":item_displace"),
(val_add, ":total_price", ":new_item_price"),
(try_for_range, ":cur_troop_upgrade", 0, 4),
(store_add, ":troop", ":start", ":cur_troop_upgrade"),
(troop_add_item, ":troop", ":new_item"),
(try_end),
(try_end),
(val_add, ":item_displace", 3),
(try_end),
(troop_set_slot, "trp_merch_price_array", ":cur_troop_displace", ":total_price"),
(val_add, ":start", 4),
(val_add, ":cur_troop_type", 1),
(try_end),
(try_for_range, ":cur_troop_displace", 0, 15),
(troop_get_slot, ":cur_troop", "trp_merch_array", ":cur_troop_displace"),
(try_for_range, ":cur_troop_upgrade", 0, 4),
(store_add, ":troop", ":cur_troop", ":cur_troop_upgrade"),
(troop_equip_items, ":troop"),
(try_end),
(try_end),
]),
# script_remove_merch_count_for_nation
# Input: naem_count
# Output: no
("remove_merch_count_for_nation",
[
(store_script_param, ":naem_count", 1),
(store_mul, ":index", "$g_cur_nation", 3),
(val_add, ":index", "$g_naem_tip"),
(troop_get_slot, ":type_count", "trp_week_limit_array", ":index"),
(val_sub, ":type_count", ":naem_count"),
(troop_set_slot, "trp_week_limit_array", ":index", ":type_count"),
(assign, "$g_naem_count", ":type_count"),
]),
# script_update_items
# Input: slot_itemov, item
# Output: no
("update_items",
[
(store_script_param, ":item_param", 1),
(store_script_param, ":item_variant", 2),
(try_begin),
(eq, ":item_param", 4),
(call_script, "script_update_items_next", 7, ":item_variant"),
(call_script, "script_update_items_next", 4, ":item_variant"),
(else_try),
(call_script, "script_update_items_next", ":item_param", ":item_variant"),
(try_end),
]),
# script_update_items_next
# Input: slot_itemov, item
# Output: no
("update_items_next",
[
(store_script_param, ":item_param", 1),
(store_script_param, ":item_variant", 2),
(store_mul, ":item_displace", "$g_cur_nation", 30),
(store_mul, ":displ", ":item_param", 3),
(val_add, ":item_displace", ":displ"),
(val_add, ":item_displace", "$g_naem_tip"),
(troop_get_slot, "
ld_item", "trp_cur_merch_arms_array", ":item_displace"),
(troop_get_slot, "
ld_price", "trp_cur_merch_arms_price_array", ":item_displace"),
(assign, ":total_old_item_value", 0),
(try_begin),
(gt, "
ld_item", 0),
(try_for_range, ":cur_troop_upgrade", 0, 4),
(store_add, ":troop", "$g_cur_troop", ":cur_troop_upgrade"),
(troop_remove_item, ":troop", "
ld_item"),
(try_end),
(try_end),
(store_mul, ":displace", "$g_cur_nation", 50),
(store_mul, ":displ", ":item_param", 5),
(val_add, ":displace", ":displ"),
(val_add, ":displace", ":item_variant"),
(troop_get_slot, ":new_item", "trp_merch_arms_array", ":displace"),
(troop_get_slot, ":new_price", "trp_merch_arms_price_array", ":displace"),
(try_for_range, ":cur_troop_upgrade", 0, 4),
(store_add, ":troop", "$g_cur_troop", ":cur_troop_upgrade"),
(troop_add_item, ":troop", ":new_item"),
(try_end),
(troop_set_slot, "trp_cur_merch_arms_array", ":item_displace", ":new_item"),
(troop_set_slot, "trp_cur_merch_arms_price_array", ":item_displace", ":new_price"),
(store_mul, ":troop_displace", "$g_cur_nation", 3),
(val_add, ":troop_displace", "$g_naem_tip"),
(troop_get_slot, ":troop_price", "trp_merch_price_array", ":troop_displace"),
(val_sub, ":troop_price", "
ld_price"),
(val_add, ":troop_price", ":new_price"),
(troop_set_slot, "trp_merch_price_array", ":troop_displace", ":troop_price"),
(val_mul, ":new_price", "$g_count_naem"),
(store_mul, ":total_old_item_value", "
ld_price", "$g_count_naem"),
(call_script, "script_recalculate_price", ":total_old_item_value"),
(assign, ":total_old_item_value", reg10),
#(val_div, ":total_old_item_value", 2), #50% of total cost of old equipment is paid back. PETEO
(try_begin),
(gt, ":total_old_item_value", 0),
(troop_add_gold, "trp_player", ":total_old_item_value"),
(try_end),
(call_script, "script_recalculate_price", ":new_price"),
(troop_remove_gold, "trp_player", reg10),
(store_troop_gold,"$g_trp_player_gold","trp_player"),
(try_for_range, ":cur_troop_upgrade", 0, 4),
(store_add, ":troop", "$g_cur_troop", ":cur_troop_upgrade"),
(troop_equip_items, ":troop"),
(try_end),
]),