module_party_templates.py
#########################
("looters","Looters",icon_axeman|carries_goods(

,0,fac_outlaws,bandit_personality,[(trp_looter,4,25)]),
#----------------------------------------------------------------------------------
("player_patrol","Patrol",icon_gray_knight,0,fac_player_faction,hold_personality,[]),
#----------------------------------------------------------------------------------
("manhunters","Manhunters",icon_gray_knight,0,fac_manhunters,soldier_personality,[(trp_manhunter,9,40)]),
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#-
module_scripts.py
#################
at the end of module_script.py
#----------------------------------------------------------------------------------
#identify party as patrol
#input: party
#output: reg0
#0 yes, 1 no
("cf_is_patrol",
[
(store_script_param, ":cur_party", 1),
(assign,reg0,0),
(store_faction_of_party,":cur_faction",":cur_party"),
(eq, ":cur_faction", "fac_player_faction"),
(party_stack_get_troop_id,":cur_troop",":cur_party",0),
(neq,":cur_troop","trp_player"),
(try_for_range,":num",companions_begin,heroes_end),
(eq,":cur_troop",":num"),
(assign, reg0,1),
(try_end),
]
),
#find all patrols and count them
#input: none
#output: reg0
#amount of existing patrols
("check_for_patrols",
[
(assign,":num",0),
(try_for_parties,":cur_party"),
(call_script, "script_cf_is_patrol",":cur_party"),
(eq,reg0,0),
(val_add,":num",1),
(try_end),
(assign,reg0,":num"),
]
),
#enforce patrol party size limit
#it is assumed that the party prisoner limit equals zero
#except for npc prisoners
#input: party, mode
#mode 0: delete all troops w/o doing anything else
#mode 1: all deleted troops are being added to the player party
#output: none (it uses reg0, but the information is useless outside of this script and its recursive brother)
("cf_fix_party_size",
[
(store_script_param, ":cur_party", 1),
(store_script_param, ":mode", 2),
(call_script, "script_cf_is_patrol",":cur_party"),
(try_begin),
(eq,reg0,0),
(call_script,"script_game_get_party_companion_limit",3),
(call_script,"script_cf_fix_party_size_recursive",":cur_party",":mode"),
(assign,":bool",0),
(party_get_num_prisoner_stacks, ":num_stacks",":cur_party"),
(try_for_range_backwards,":index",0,":num_stacks"),
(party_prisoner_stack_get_troop_id,":cur_troop",":cur_party",":index"),
(party_prisoner_stack_get_size,":cur_size",":cur_party",":index"),
(try_for_range,":num",companions_begin,heroes_end),
(eq,":cur_troop",":num"),
(assign,":bool",1),
(try_end),
(try_begin),
(neq,":bool",1),
(party_remove_prisoners,":cur_party",":cur_troop",":cur_size"),
(try_end),
(try_end),
(try_end),
]
),
#a while do loop for cf_fix_party_size
#don't use it outside of the previous script
("cf_fix_party_size_recursive", #I am not exactly happy about the recursive
[
(store_script_param, ":cur_party", 1),
(store_script_param, ":mode", 2),
(assign,":reg0_backup",reg0),
(store_party_size_wo_prisoners,":num",":cur_party"),
(try_begin),
(gt,":num",reg0),
(neq,0,reg0),
(store_sub,":delta",":num",reg0),
(party_get_num_companion_stacks,":num_stacks",":cur_party"),
(assign, ":to_del_stack",0),
(assign, ":checker", 100),
(try_for_range,":index",0,":num_stacks"),
(party_stack_get_troop_id,":cur_troop",":cur_party",":index"),
(store_character_level,":cur_level",":cur_troop"),
(le,":cur_level",":checker"),
(assign,":checker",":cur_level"),
(assign,":to_del_stack",":index"),
(try_end),
(party_stack_get_size,":num_troop",":cur_party",":to_del_stack"),
(party_stack_get_troop_id,":cur_troop",":cur_party",":to_del_stack"),
(try_begin),
(le,":num_troop",":delta"),
(assign, ":delta", ":num_troop"),
(try_end),
(party_remove_members,":cur_party",":cur_troop",":delta"),
(try_begin),
(eq,":mode",1),
(party_add_members,"p_main_party",":cur_troop",":delta"),
(try_end),
(assign,reg0,":reg0_backup"),
(call_script,"script_cf_fix_party_size_recursive",":cur_party",":mode"),
(try_end),
]
),
#----------------------------------------------------------------------------------
before the last ]
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#-
in "game_event_simulate_battle"
...
(call_script, "script_clear_party_group", ":root_defeated_party"),
#----------------------------------------------------------------------------------
(call_script,"script_cf_fix_party_size", "p_temp_party",0),
#----------------------------------------------------------------------------------
(try_end),
Note: this is not tested
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#-
in "let_nearby_parties_join_current_battle"
...
(display_message, "str_s1_joined_battle_enemy"),
#----------------------------------------------------------------------------------
(else_try),
(eq, ":besiege_mode", 0),
(lt, ":reln_with_player", 0),
(gt, ":reln_with_enemy", 0),
(store_faction_of_party,":cur_faction","$g_encountered_party"),
(this_or_next|eq,":cur_faction","fac_outlaws"),
(this_or_next|eq,":cur_faction","fac_deserters"),
(this_or_next|eq,":cur_faction","fac_mountain_bandits"),
(eq,":cur_faction","fac_forest_bandits"),
(store_faction_of_party,":cur_faction",":party_no"),
(this_or_next|eq,":cur_faction","fac_outlaws"),
(this_or_next|eq,":cur_faction","fac_deserters"),
(this_or_next|eq,":cur_faction","fac_mountain_bandits"),
(eq,":cur_faction","fac_forest_bandits"),
(party_quick_attach_to_current_battle, ":party_no", ":enemy_side"), #attach as enemy
(str_store_party_name, s1, ":party_no"),
(display_message, "str_s1_joined_battle_enemy"),
(else_try),
(eq, ":dont_add_friends", 0),
(gt, ":reln_with_player", 0),
(lt, ":reln_with_enemy", 0),
(store_faction_of_party,":cur_faction",":party_no"),
(eq,":cur_faction","fac_player_faction"),
(party_quick_attach_to_current_battle, ":party_no", 0), #attach as ally
(str_store_party_name, s1, ":party_no"),
(display_message, "str_s1_joined_battle_friend"),
#----------------------------------------------------------------------------------
(else_try),
(eq, ":dont_add_friends", 0),
Note: this also allows other bandit parties to join the fight if you are fighting a bandit party.
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#-
replace "calculate_player_faction_wage" with this:
#----------------------------------------------------------------------------------
# script_calculate_player_faction_wage
# Input: arg1 = party_no
# Output: reg0 = weekly wage
("calculate_player_faction_wage",
[(assign, ":nongarrison_wages", 0),
(assign, ":garrison_wages", 0),
(try_for_parties, ":party_no"),
(assign, ":garrison_troop", 0),
(assign, ":ungarrison_troop", 0),
(try_begin),
(this_or_next|party_slot_eq, ":party_no", slot_party_type, spt_town),
(party_slot_eq, ":party_no", slot_party_type, spt_castle),
(party_slot_eq, ":party_no", slot_town_lord, "trp_player"),
(assign, ":garrison_troop", 1),
(try_end),
(try_begin),
(call_script, "script_cf_is_patrol",":party_no"),
(eq,reg0,0),
(assign, ":ungarrison_troop", 1),
(try_end),
(this_or_next|eq, ":party_no", "p_main_party"),
(this_or_next|eq, ":garrison_troop", 1),
(eq, ":ungarrison_troop", 1),
(party_get_num_companion_stacks, ":num_stacks",":party_no"),
(try_for_range, ":i_stack", 0, ":num_stacks"),
(party_stack_get_troop_id, ":stack_troop",":party_no",":i_stack"),
(party_stack_get_size, ":stack_size",":party_no",":i_stack"),
(call_script, "script_game_get_troop_wage", ":stack_troop", ":party_no"),
(assign, ":cur_wage", reg0),
(val_mul, ":cur_wage", ":stack_size"),
(try_begin),
(eq, ":garrison_troop", 1),
(val_add, ":garrison_wages", ":cur_wage"),
(else_try),
(try_begin),
(eq,":ungarrison_troop",1),
(val_mul, ":cur_wage",3),
(val_div, ":cur_wage",2),
(try_end),
(val_add, ":nongarrison_wages", ":cur_wage"),
(try_end),
(try_end),
(try_end),
(val_div, ":garrison_wages", 2),#Half payment for garrisons
(store_sub, ":total_payment", 14, "$g_cur_week_half_daily_wage_payments"), #between 0 and 7
(val_mul, ":nongarrison_wages", ":total_payment"),
(val_div, ":nongarrison_wages", 14),
(store_add, reg0, ":nongarrison_wages", ":garrison_wages"),
]),
#----------------------------------------------------------------------------------
Note: Currently patrols got an extra upkeep of +50%, see below (eq,":ungarrison_troop",1),
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#-
module_game_menus.py
####################
in "total_victory"
...
(call_script, "script_party_add_party", "$g_ally_party", "p_temp_party"), #Add remaining prisoners to ally TODO: FIX it.
#----------------------------------------------------------------------------------
(call_script,"script_cf_fix_party_size", "$g_ally_party",0),
#----------------------------------------------------------------------------------
(else_try),
...
(call_script, "script_party_add_party", ":helper_party", "p_temp_party"), #Add remaining prisoners to our reinforcements
#----------------------------------------------------------------------------------
(call_script,"script_cf_fix_party_size", ":helper_party",0),
#----------------------------------------------------------------------------------
(try_end),
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#-
module_dialogs.py
#################
Replace everything:
######################################
# GENERIC MEMBER CHAT
######################################
#----------------------------------------------------------------------------------
[anyone,"member_chat", [], "Your orders {sir/madam}?", "regular_member_talk",[]],
[anyone|plyr,"regular_member_talk", [], "Tell me about yourself", "view_regular_char_requested",[]],
[anyone,"view_regular_char_requested", [], "Aye {sir/madam}. Let me tell you all there is to know about me.", "do_regular_member_view_char",[[change_screen_view_character]]],
[anyone,"do_regular_member_view_char", [], "Anything else?", "regular_member_talk",[]],
[anyone|plyr,"regular_member_talk", [], "Become Party", "mate_check_leadership",[]],
[anyone,"mate_check_leadership", [
(call_script, "script_check_for_patrols"),
(store_skill_level,":max_amount",skl_leadership,"trp_player"),
(troop_get_slot, ":renown", "trp_player", slot_troop_renown),
(val_div, ":renown", 250),
(val_add, ":max_amount",":renown"),
(try_for_range,":num",walled_centers_begin,walled_centers_end),
(party_slot_eq, ":num", slot_town_lord, "trp_player"),
(val_add,":max_amount",1),
(try_end),
(gt,":max_amount",reg0),
],"Very well.","close_window",[
(store_conversation_troop,":soldier"),
(remove_member_from_party,":soldier"),
(spawn_around_party,"p_main_party","pt_player_patrol"),
(party_add_members,reg(0),":soldier",1),
(party_set_ai_behavior,reg(0),ai_bhvr_hold),
]],
[anyone,"mate_check_leadership", [],"I am sorry, but we don't think that you are capable of leading more parties.","member_chat",[]],
[anyone|plyr,"regular_member_talk", [], "Nothing. Keep moving.", "close_window",[]],
[anyone,"start", [(store_encountered_party,"$temp"),
(store_faction_of_party, ":cur_faction", "$temp"),
(eq,":cur_faction","fac_player_faction"),
],
"Yes?", "mate_chat_talk",[(assign, "$g_leave_encounter", 1)]],
[anyone|plyr,"mate_chat_talk",[],"I have a new task for you.", "mate_give_order_ask",[]],
[anyone,"mate_give_order_ask", [],
"What do you wish?", "mate_give_order",[]],
[anyone|plyr,"mate_give_order",[],"Follow me","mate_follow",[]],
[anyone,"mate_follow",[],"All right","close_window",[
(party_set_ai_object,"$temp","p_main_party"),
(party_set_ai_behavior,"$temp",ai_bhvr_escort_party),
]],
[anyone|plyr,"mate_give_order",[],"Stay here","mate_stay",[]],
[anyone,"mate_stay",[],"All right","close_window",[
(party_set_ai_behavior,"$temp",ai_bhvr_hold),
(party_get_position, pos1, "$temp"),
(party_set_ai_target_position,"$temp",pos1),
]],
[anyone|plyr,"mate_give_order",[],"Patrol this area","mate_patrol",[]],
[anyone,"mate_patrol",[],"All right","close_window",[
(party_set_ai_behavior,"$temp",ai_bhvr_patrol_location),
(party_get_position, pos1, "$temp"),
(party_set_ai_target_position,"$temp",pos1),
]],
[anyone|plyr,"mate_give_order", [],"Go to...", "mate_give_order_details_ask",[(assign, "$temp_1", spai_holding_center),]],
[anyone|plyr,"mate_give_order", [],"Patrol around...", "mate_give_order_details_ask",[(assign, "$temp_1", spai_patrolling_around_center),]],
[anyone|plyr,"mate_give_order", [],"Forget it.", "mate_chat_pre_talk",[]],
[anyone,"mate_give_order_details_ask", [],
"Where?", "mate_give_order_details",[]],
[anyone|plyr|repeat_for_parties, "mate_give_order_details",
[
(store_repeat_object, ":party_no"),
(assign, ":continue", 0),
(try_begin),
(eq, "$temp_1", spai_holding_center),
(try_begin),
(this_or_next|party_slot_eq, ":party_no", slot_party_type, spt_castle),
(party_slot_eq, ":party_no", slot_party_type, spt_town),
(assign, ":continue", 1),
(try_end),
(else_try),
(eq, "$temp_1", spai_patrolling_around_center),
(try_begin),
(is_between, ":party_no", centers_begin, centers_end),
(assign, ":continue", 1),
(try_end),
(try_end),
(eq, ":continue", 1),
(neq, ":party_no", "$g_encountered_party"),
(str_store_party_name, s1, ":party_no")],
"{s1}", "mate_give_order_details_done",
[
(store_repeat_object, "$temp_2"),
]],
[anyone,"mate_give_order_details_done", [],"Okay","close_window",[
(try_begin),
(eq,"$temp_1", spai_holding_center),
(party_set_ai_behavior,"$temp",ai_bhvr_travel_to_point),
(party_get_position, pos1, "$temp_2"),
(map_get_land_position_around_position, pos1, pos1,1),
(party_set_ai_target_position,"$temp",pos1),
(try_end),
(try_begin),
(eq,"$temp_1", spai_patrolling_around_center),
(party_set_ai_behavior,"$temp",ai_bhvr_patrol_party),
(party_set_ai_object,"$temp","$temp_2"),
(party_set_ai_patrol_radius ,"$temp",1),
(try_end),
]],
[anyone|plyr,"mate_chat_talk", [], "I want to give you troops.", "mate_give_troops",[(call_script,"script_game_get_party_companion_limit",3),(display_message, "@allowed party size {reg0}"),(change_screen_give_members),]],
[anyone,"mate_give_troops", [], "Yes...", "mate_give_troops_end",[]],
[anyone,"mate_give_troops_end", [], "That are good lads.", "mate_chat_pre_talk",[
(store_encountered_party,":cur_party"),
(call_script,"script_cf_fix_party_size",":cur_party",1),
]],
[anyone,"mate_chat_pre_talk", [], "Anything else?", "mate_chat_talk",[]],
[anyone|plyr,"mate_chat_talk", [], "I want to you to join me again.", "mate_chat_rejoin",[]],
[anyone,"mate_chat_rejoin", [(party_can_join)], "Very Well.", "close_window",[(party_join),]],
[anyone,"mate_chat_rejoin", [(neg|party_can_join)], "We can't follow you, you haven't got enough capacity","mate_chat_talk",[]],
[anyone|plyr,"mate_chat_talk", [], "Nevermind", "close_window",[]],
#----------------------------------------------------------------------------------
######################################
# GENERIC PARTY ENCOUNTER
######################################
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#-
header_parties.py
at the end
hold_personality = aggressiveness_0 | courage_15
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#-
Note: It is not very important, but you might want to change the faction color
replace this line for the current deep blue.
#----------------------------------------------------------------------------------
("player_faction","Player Faction",0, 0.9, [], [],0x000000FF),
#----------------------------------------------------------------------------------