("camp_action",[],"Take an action.",
[(jump_to_menu, "mnu_camp_action"),
]
),
###Camping Moraller
("camp_moraling",[],"Give extra tax to your troops",
[(jump_to_menu, "mnu_camp_moraling"),
]
),
###Camping Moraller ends
###Camping moraller
("camp_moraling",0,
"Give extra tax to your troops for their morales:",
"none",
[
],
[
("big_tax",[(store_troop_gold,":total_money","trp_player"),(gt, ":total_money",1500)],"Give Full tax(a great morale)",
[(troop_remove_gold, "trp_player", 1500),
(party_set_morale, "p_main_party", 40),
]
),
("medium_tax",[(store_troop_gold,":total_money","trp_player"),(gt, ":total_money",750)],"Give Medium tax(middle morale)",
[(troop_remove_gold, "trp_player", 750),
(party_set_morale, "p_main_party", 20),
]
),
("low_tax",[(store_troop_gold,":total_money","trp_player"),(gt, ":total_money",500)],"Give low tax(low morale)",
[(troop_remove_gold, "trp_player", 500),
(party_set_morale, "p_main_party", 10),
]
),
("camp_action_4",[],"Back to camp menu.",
[(jump_to_menu, "mnu_camp"),
]
),
]
),
###Camping moraller Ends
(store_random_in_range, ":morale_increase", 20 * 1, 20 * 2),
(call_script, "script_change_player_party_morale", ":morale_increase"),
(party_set_morale, "p_main_party", 40),
#Belendor - Every killing of a lord or king decreases your relationship with corresponding faction and person himself.
common_lord_trigger = (
ti_on_agent_killed_or_wounded, 0, 0, [],
[
(store_trigger_param_1, ":killed_agent"),
(store_trigger_param_2, ":killer_agent"),
(get_player_agent_no, ":player"),
(agent_is_active, ":killed_agent"),
(agent_is_active, ":killer_agent"),
(agent_is_alive, ":killer_agent"),
(agent_get_troop_id, ":killed_trp", ":killed_agent"),
(troop_is_hero, ":killed_trp"),
(eq, ":killer_agent", ":player"),
(store_random_in_range, ":lord_num", -5, -10),
(store_random_in_range, ":lord_fac_num", -2, -5),
(store_random_in_range, ":king_num", -3, -8),
(store_random_in_range, ":king_fac_num", -1, -3),
(try_begin),
(is_between, ":killed_trp", lords_begin, lords_end),
(assign, ":rep_to_dec", ":lord_num"),
(assign, ":fac_rep_to_dec", ":lord_fac_num"),
(else_try),
(is_between, ":killed_trp", kings_begin, kings_end),
(assign, ":rep_to_dec", ":king_num"),
(assign, ":fac_rep_to_dec", ":king_fac_num"),
(try_end),
(call_script, "script_change_player_relation_with_troop", ":killed_trp", ":fac_rep_to_dec"),
(store_troop_faction, ":killed_trp_fac", ":killed_trp"),
(call_script, "script_change_player_relation_with_faction_ex", ":killed_trp_fac", ":rep_to_dec"),
])
(try_begin),
(ge, ":cur_wealth", 5000),
(assign, ":upgrade_possible", 0),
(call_script, "script_list_clear", "trp_upgrades"),
(try_for_range, ":center_no", centers_begin, centers_end),
(party_slot_eq, ":center_no", slot_town_lord, ":troop_no"),
(party_slot_eq, ":center_no", slot_center_current_improvement, 0),
(call_script, "script_list_add", "trp_upgrades", ":center_no"),
(assign, ":upgrade_possible", 1),
(try_end),
(eq, ":upgrade_possible", 1),
(call_script, "script_list_random", "trp_upgrades"),
(assign, ":center_to_upgrade", reg1),
(try_begin),
(party_slot_eq, ":center_to_upgrade", slot_party_type, spt_village),
(call_script, "script_list_clear", "trp_upgrades"),
(assign, ":upgrade_available", 0),
(try_for_range, ":upgrade", village_improvements_begin, village_improvements_end),
(neg|party_slot_eq, ":center_to_upgrade", ":upgrade", 1), #ignore already built upgrades
(call_script, "script_list_add", "trp_upgrades", ":upgrade"),
(assign, ":upgrade_available", 1),
(try_end),
(else_try),
(party_slot_eq, ":center_to_upgrade", slot_party_type, spt_castle),
(call_script, "script_list_clear", "trp_upgrades"),
(assign, ":upgrade_available", 0),
(try_for_range, ":upgrade", walled_center_improvements_begin, walled_center_improvements_end),
(neg|party_slot_eq, ":center_to_upgrade", ":upgrade", 1),
(call_script, "script_list_add", "trp_upgrades", ":upgrade"),
(assign, ":upgrade_available", 1),
(try_end),
(else_try),
(party_slot_eq, ":center_to_upgrade", slot_party_type, spt_town),
(call_script, "script_list_clear", "trp_upgrades"),
(assign, ":upgrade_available", 0),
(try_for_range, ":upgrade", walled_center_improvements_begin, walled_center_improvements_end),
(neg|party_slot_eq, ":center_to_upgrade", ":upgrade", 1),
(call_script, "script_list_add", "trp_upgrades", ":upgrade"),
(assign, ":upgrade_available", 1),
(try_end),
(try_end),
(eq, ":upgrade_available", 1),
(call_script, "script_list_random", "trp_upgrades"),
(assign, ":new_upgrade", reg1),
(call_script, "script_get_improvement_details", reg1),
(assign, ":improvement_cost", reg0),
(store_div, ":improvement_time", ":improvement_cost", 150),
(party_set_slot, ":center_to_upgrade", slot_center_current_improvement, ":new_upgrade"),
(store_current_hours, ":cur_hours"),
(store_mul, ":hours_takes", ":improvement_time", 24),
(val_add, ":hours_takes", ":cur_hours"),
(party_set_slot, ":center_to_upgrade", slot_center_improvement_end_hour, ":hours_takes"),
(val_sub, ":cur_wealth", ":improvement_cost"),
(str_store_party_name, s0, ":center_to_upgrade"),
# (display_message, "@ {s0} is building an upgrade. Final wealth: {reg7}"),
(try_end),
#### F&B end make AI upgrade their settlements
(val_sub, ":weekly_income", ":cur_weekly_wage"),
(val_add, ":cur_wealth", ":weekly_income"),
(try_begin),
(lt, ":cur_wealth", 0),
(store_sub, ":percent_under", 0, ":cur_wealth"),
(val_mul, ":percent_under", 100),
(val_div, ":percent_under", ":cur_weekly_wage"),
(val_div, ":percent_under", 5), #Max 20 percent
(call_script, "script_party_inflict_attrition", ":party_no", ":percent_under", 1),
(try_end),
#### F&B begin make AI upgrade their settlements
(try_begin),
(ge, ":cur_wealth", 5000),
(assign, ":upgrade_possible", 0),
(call_script, "script_list_clear", "trp_upgrades"),
(try_for_range, ":center_no", centers_begin, centers_end),
(party_slot_eq, ":center_no", slot_town_lord, ":party_no"),
(party_slot_eq, ":center_no", slot_center_current_improvement, 0),
(call_script, "script_list_add", "trp_upgrades", ":center_no"),
(assign, ":upgrade_possible", 1),
(try_end),
(eq, ":upgrade_possible", 1),
(call_script, "script_list_random", "trp_upgrades"),
(assign, ":center_to_upgrade", reg1),
(try_begin),
(party_slot_eq, ":center_to_upgrade", slot_party_type, spt_village),
(call_script, "script_list_clear", "trp_upgrades"),
(assign, ":upgrade_available", 0),
(try_for_range, ":upgrade", village_improvements_begin, village_improvements_end),
(neg|party_slot_eq, ":center_to_upgrade", ":upgrade", 1), #ignore already built upgrades
(call_script, "script_list_add", "trp_upgrades", ":upgrade"),
(assign, ":upgrade_available", 1),
(try_end),
(else_try),
(party_slot_eq, ":center_to_upgrade", slot_party_type, spt_castle),
(call_script, "script_list_clear", "trp_upgrades"),
(assign, ":upgrade_available", 0),
(try_for_range, ":upgrade", walled_center_improvements_begin, walled_center_improvements_end),
(neg|party_slot_eq, ":center_to_upgrade", ":upgrade", 1),
(call_script, "script_list_add", "trp_upgrades", ":upgrade"),
(assign, ":upgrade_available", 1),
(try_end),
(else_try),
(party_slot_eq, ":center_to_upgrade", slot_party_type, spt_town),
(call_script, "script_list_clear", "trp_upgrades"),
(assign, ":upgrade_available", 0),
(try_for_range, ":upgrade", walled_center_improvements_begin, walled_center_improvements_end),
(neg|party_slot_eq, ":center_to_upgrade", ":upgrade", 1),
(call_script, "script_list_add", "trp_upgrades", ":upgrade"),
(assign, ":upgrade_available", 1),
(try_end),
(try_end),
(eq, ":upgrade_available", 1),
(call_script, "script_list_random", "trp_upgrades"),
(assign, ":new_upgrade", reg1),
(call_script, "script_get_improvement_details", reg1),
(assign, ":improvement_cost", reg0),
(store_div, ":improvement_time", ":improvement_cost", 150),
(party_set_slot, ":center_to_upgrade", slot_center_current_improvement, ":new_upgrade"),
(store_current_hours, ":cur_hours"),
(store_mul, ":hours_takes", ":improvement_time", 24),
(val_add, ":hours_takes", ":cur_hours"),
(party_set_slot, ":center_to_upgrade", slot_center_improvement_end_hour, ":hours_takes"),
(val_sub, ":cur_wealth", ":improvement_cost"),
(str_store_party_name, s0, ":center_to_upgrade"),
# (display_message, "@ {s0} is building an upgrade. Final wealth: {reg7}"),
(try_end),
#### F&B end make AI upgrade their settlements
##############################################################################
(val_max, ":cur_wealth", 0),
(troop_set_slot, ":troop_no", slot_troop_wealth, ":cur_wealth"),
]),
#-## List management
## The list's zero slot holds the number of current items in it
# script_list_random
# Returns a random element from the list, along with its index
# INPUT: none
# OUTPUT: reg1 - the value of the item, reg2 - its index
("list_random", [
(store_script_param, ":list_type", 1),
(troop_get_slot, ":num_elements", ":list_type", 0),
(val_add, ":num_elements", 1),
(store_random_in_range, reg2, 1, ":num_elements"),
(troop_get_slot, reg1, ":list_type", reg2),
]),
# script_list_add
# Appends an item to the list
# INPUT: arg1 - the value which we will add to the list
# OUTPUT: none
("list_add", [
(store_script_param, ":list_type", 1),
(store_script_param, ":value", 2),
(troop_get_slot, ":num_elements", ":list_type", 0),
(val_add, ":num_elements", 1),
(troop_set_slot, ":list_type", ":num_elements", ":value"),
(troop_set_slot, ":list_type", 0, ":num_elements"),
]),
# script_list_clear
# Clears all items from the list
# INPUT: ":list_type"
# OUTPUT: none
("list_clear", [
(store_script_param, ":list_type", 1),
(troop_get_slot, ":num_elements", ":list_type", 0),
(val_add, ":num_elements", 1),
(try_for_range, ":slot", 1, ":num_elements"),
(troop_set_slot, ":list_type", ":slot", 0),
(try_end),
(troop_set_slot, ":list_type", 0, 0), # Reset number of elements
]),
["upgrades", "{!}Upgrade list", "{!}List of available upgrades", tf_hero, no_scene, reserved, fac_neutral,[],level(60),wp(800),knight_skills_5,merchant_face_1, merchant_face_2],
Fire_and_Blood said:A script, which makes lords build upgrades in their settlements, if they can afford to.
It expands on the existing wealth pool for lords. If, after paying wages, the lord still has money left over, he will try to build an upgrade.
The script takes all centers which belong to the lord and are not currently building an upgrade, picks a random center from this pool and then builds a random available upgrade in that settlement.
Script expansion: Add the following to script_calculate_hero_weekly_net_income_and_add_to_wealth, and place right it above (val_max, ":cur_wealth", 0)
#### F&B begin make AI upgrade their settlements
(try_begin),
(ge, ":cur_wealth", 5000),
(assign, ":upgrade_possible", 0),
(call_script, "script_list_clear", "trp_upgrades"),
(try_for_range, ":center_no", centers_begin, centers_end),
(party_slot_eq, ":center_no", slot_town_lord, ":party_no"),
(party_slot_eq, ":center_no", slot_center_current_improvement, 0),
(call_script, "script_list_add", "trp_upgrades", ":center_no"),
(assign, ":upgrade_possible", 1),
(try_end),
(eq, ":upgrade_possible", 1),
(call_script, "script_list_random", "trp_upgrades"),
(assign, ":center_to_upgrade", reg1),
(try_begin),
(party_slot_eq, ":center_to_upgrade", slot_party_type, spt_village),
(call_script, "script_list_clear", "trp_upgrades"),
(assign, ":upgrade_available", 0),
(try_for_range, ":upgrade", village_improvements_begin, village_improvements_end),
(neg|party_slot_eq, ":center_to_upgrade", ":upgrade", 1), #ignore already built upgrades
(call_script, "script_list_add", "trp_upgrades", ":upgrade"),
(assign, ":upgrade_available", 1),
(try_end),
(else_try),
(party_slot_eq, ":center_to_upgrade", slot_party_type, spt_castle),
(call_script, "script_list_clear", "trp_upgrades"),
(assign, ":upgrade_available", 0),
(try_for_range, ":upgrade", walled_center_improvements_begin, walled_center_improvements_end),
(neg|party_slot_eq, ":center_to_upgrade", ":upgrade", 1),
(call_script, "script_list_add", "trp_upgrades", ":upgrade"),
(assign, ":upgrade_available", 1),
(try_end),
(else_try),
(party_slot_eq, ":center_to_upgrade", slot_party_type, spt_town),
(call_script, "script_list_clear", "trp_upgrades"),
(assign, ":upgrade_available", 0),
(try_for_range, ":upgrade", walled_center_improvements_begin, walled_center_improvements_end),
(neg|party_slot_eq, ":center_to_upgrade", ":upgrade", 1),
(call_script, "script_list_add", "trp_upgrades", ":upgrade"),
(assign, ":upgrade_available", 1),
(try_end),
(try_end),
(eq, ":upgrade_available", 1),
(call_script, "script_list_random", "trp_upgrades"),
(assign, ":new_upgrade", reg1),
(call_script, "script_get_improvement_details", reg1),
(assign, ":improvement_cost", reg0),
(store_div, ":improvement_time", ":improvement_cost", 150),
(party_set_slot, ":center_to_upgrade", slot_center_current_improvement, ":new_upgrade"),
(store_current_hours, ":cur_hours"),
(store_mul, ":hours_takes", ":improvement_time", 24),
(val_add, ":hours_takes", ":cur_hours"),
(party_set_slot, ":center_to_upgrade", slot_center_improvement_end_hour, ":hours_takes"),
(val_sub, ":cur_wealth", ":improvement_cost"),
(str_store_party_name, s0, ":center_to_upgrade"),
# (display_message, "@ {s0} is building an upgrade. Final wealth: {reg7}"),
(try_end),
#### F&B end make AI upgrade their settlements
##############################################################################(val_sub, ":weekly_income", ":cur_weekly_wage"),
(val_add, ":cur_wealth", ":weekly_income"),
(try_begin),
(lt, ":cur_wealth", 0),
(store_sub, ":percent_under", 0, ":cur_wealth"),
(val_mul, ":percent_under", 100),
(val_div, ":percent_under", ":cur_weekly_wage"),
(val_div, ":percent_under", 5), #Max 20 percent
(call_script, "script_party_inflict_attrition", ":party_no", ":percent_under", 1),
(try_end),
#### F&B begin make AI upgrade their settlements
(try_begin),
(ge, ":cur_wealth", 5000),
(assign, ":upgrade_possible", 0),
(call_script, "script_list_clear", "trp_upgrades"),
(try_for_range, ":center_no", centers_begin, centers_end),
(party_slot_eq, ":center_no", slot_town_lord, ":party_no"),
(party_slot_eq, ":center_no", slot_center_current_improvement, 0),
(call_script, "script_list_add", "trp_upgrades", ":center_no"),
(assign, ":upgrade_possible", 1),
(try_end),
(eq, ":upgrade_possible", 1),
(call_script, "script_list_random", "trp_upgrades"),
(assign, ":center_to_upgrade", reg1),
(try_begin),
(party_slot_eq, ":center_to_upgrade", slot_party_type, spt_village),
(call_script, "script_list_clear", "trp_upgrades"),
(assign, ":upgrade_available", 0),
(try_for_range, ":upgrade", village_improvements_begin, village_improvements_end),
(neg|party_slot_eq, ":center_to_upgrade", ":upgrade", 1), #ignore already built upgrades
(call_script, "script_list_add", "trp_upgrades", ":upgrade"),
(assign, ":upgrade_available", 1),
(try_end),
(else_try),
(party_slot_eq, ":center_to_upgrade", slot_party_type, spt_castle),
(call_script, "script_list_clear", "trp_upgrades"),
(assign, ":upgrade_available", 0),
(try_for_range, ":upgrade", walled_center_improvements_begin, walled_center_improvements_end),
(neg|party_slot_eq, ":center_to_upgrade", ":upgrade", 1),
(call_script, "script_list_add", "trp_upgrades", ":upgrade"),
(assign, ":upgrade_available", 1),
(try_end),
(else_try),
(party_slot_eq, ":center_to_upgrade", slot_party_type, spt_town),
(call_script, "script_list_clear", "trp_upgrades"),
(assign, ":upgrade_available", 0),
(try_for_range, ":upgrade", walled_center_improvements_begin, walled_center_improvements_end),
(neg|party_slot_eq, ":center_to_upgrade", ":upgrade", 1),
(call_script, "script_list_add", "trp_upgrades", ":upgrade"),
(assign, ":upgrade_available", 1),
(try_end),
(try_end),
(eq, ":upgrade_available", 1),
(call_script, "script_list_random", "trp_upgrades"),
(assign, ":new_upgrade", reg1),
(call_script, "script_get_improvement_details", reg1),
(assign, ":improvement_cost", reg0),
(store_div, ":improvement_time", ":improvement_cost", 150),
(party_set_slot, ":center_to_upgrade", slot_center_current_improvement, ":new_upgrade"),
(store_current_hours, ":cur_hours"),
(store_mul, ":hours_takes", ":improvement_time", 24),
(val_add, ":hours_takes", ":cur_hours"),
(party_set_slot, ":center_to_upgrade", slot_center_improvement_end_hour, ":hours_takes"),
(val_sub, ":cur_wealth", ":improvement_cost"),
(str_store_party_name, s0, ":center_to_upgrade"),
# (display_message, "@ {s0} is building an upgrade. Final wealth: {reg7}"),
(try_end),
#### F&B end make AI upgrade their settlements
##############################################################################
(val_max, ":cur_wealth", 0),
(troop_set_slot, ":troop_no", slot_troop_wealth, ":cur_wealth"),
]),
You'll also need a few scripts from Lumos list system. Place them anywhere in module_scripts:
#-## List management
## The list's zero slot holds the number of current items in it
# script_list_random
# Returns a random element from the list, along with its index
# INPUT: none
# OUTPUT: reg1 - the value of the item, reg2 - its index
("list_random", [
(store_script_param, ":list_type", 1),
(troop_get_slot, ":num_elements", ":list_type", 0),
(val_add, ":num_elements", 1),
(store_random_in_range, reg2, 1, ":num_elements"),
(troop_get_slot, reg1, ":list_type", reg2),
]),
# script_list_add
# Appends an item to the list
# INPUT: arg1 - the value which we will add to the list
# OUTPUT: none
("list_add", [
(store_script_param, ":list_type", 1),
(store_script_param, ":value", 2),
(troop_get_slot, ":num_elements", ":list_type", 0),
(val_add, ":num_elements", 1),
(troop_set_slot, ":list_type", ":num_elements", ":value"),
(troop_set_slot, ":list_type", 0, ":num_elements"),
]),
# script_list_clear
# Clears all items from the list
# INPUT: ":list_type"
# OUTPUT: none
("list_clear", [
(store_script_param, ":list_type", 1),
(troop_get_slot, ":num_elements", ":list_type", 0),
(val_add, ":num_elements", 1),
(try_for_range, ":slot", 1, ":num_elements"),
(troop_set_slot, ":list_type", ":slot", 0),
(try_end),
(troop_set_slot, ":list_type", 0, 0), # Reset number of elements
]),
Finally, the troop, which temporarily holds the lists. Place it near the bottom, but before the final "]":
["upgrades", "{!}Upgrade list", "{!}List of available upgrades", tf_hero, no_scene, reserved, fac_neutral,[],level(60),wp(800),knight_skills_5,merchant_face_1, merchant_face_2],
Belendor the Crazy Cheese said:dunde said:enhanced script_initialize_aristocracy of WB 1.143 Native :
- Kings have 1 or 2 sons and daughters.
- Adjust Kings' and lord's Face code according to their age.
- Giving variety of lady's age. (They 're no longer always be 19, 21, or 49 years old anymore)
Code:("initialize_aristocracy", [ #LORD OCCUPATIONS, BLOOD RELATIONSHIPS, RENOWN AND REPUTATIONS #King ages (try_for_range, ":cur_troop", kings_begin, kings_end), (troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_hero), (store_random_in_range, ":age", 50, 60), (try_begin), (eq, ":cur_troop", "trp_kingdom_5_lord"), (assign, ":age", 47), (try_end), (call_script, "script_init_troop_age", ":cur_troop", ":age"), (try_end), #The first thing - family structure #lords 1 to 8 are patriarchs with one live-at-home son and one daughter. They come from one of six possible ancestors, thus making it likely that there will be two sets of siblings #lords 9 to 12 are unmarried landowners with sisters #lords 13 to 20 are sons who still live in their fathers' houses #For the sake of simplicity, we can assume that all male aristocrats in prior generations either married commoners or procured their brides from the Old Country, thus discounting intermarriage (try_for_range, ":cur_troop", kingdom_ladies_begin, kingdom_ladies_end), (troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_lady), (try_end), (assign, ":cur_lady", "trp_kingdom_1_lady_1"), (try_for_range, ":cur_troop", lords_begin, lords_end), (troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_hero), (store_random_in_range, ":father_age_at_birth", 23, 26), # (store_random_in_range, ":mother_age_at_birth", 19, 22), (try_begin), (is_between, ":cur_troop", "trp_knight_1_1", "trp_knight_2_1"), (store_sub, ":npc_seed", ":cur_troop", "trp_knight_1_1"), (assign, ":ancestor_seed", 1), (assign, ":king", "trp_kingdom_1_lord"), (else_try), (is_between, ":cur_troop", "trp_knight_2_1", "trp_knight_3_1"), (store_sub, ":npc_seed", ":cur_troop", "trp_knight_2_1"), (assign, ":ancestor_seed", 7), (assign, ":king", "trp_kingdom_2_lord"), (else_try), (is_between, ":cur_troop", "trp_knight_3_1", "trp_knight_4_1"), (store_sub, ":npc_seed", ":cur_troop", "trp_knight_3_1"), (assign, ":ancestor_seed", 13), (assign, ":king", "trp_kingdom_3_lord"), (else_try), (is_between, ":cur_troop", "trp_knight_4_1", "trp_knight_5_1"), (store_sub, ":npc_seed", ":cur_troop", "trp_knight_4_1"), (assign, ":ancestor_seed", 19), (assign, ":king", "trp_kingdom_4_lord"), (else_try), (is_between, ":cur_troop", "trp_knight_5_1", "trp_knight_6_1"), (store_sub, ":npc_seed", ":cur_troop", "trp_knight_5_1"), (assign, ":ancestor_seed", 25), (assign, ":king", "trp_kingdom_5_lord"), (else_try), (is_between, ":cur_troop", "trp_knight_6_1", "trp_kingdom_1_pretender"), (store_sub, ":npc_seed", ":cur_troop", "trp_knight_6_1"), (assign, ":ancestor_seed", 31), (assign, ":king", "trp_kingdom_6_lord"), (try_end), (try_begin), #NPC seed is the order in the faction (lt, ":npc_seed", 8), #Senior lords (assign, ":reputation", ":npc_seed"), (store_random_in_range, ":age", 45, 64), (store_random_in_range, ":father", 0, 6), #six possible fathers (val_add, ":father", ":ancestor_seed"), (troop_set_slot, ":cur_troop", slot_troop_father, ":father"), # Father is not active npc #wife (troop_set_slot, ":cur_troop", slot_troop_spouse, ":cur_lady"), (troop_set_slot, ":cur_lady", slot_troop_spouse, ":cur_troop"), (store_random_in_range, ":wife_reputation", 20, 26), (try_begin), (eq, ":wife_reputation", 20), (assign, ":wife_reputation", lrep_conventional), (try_end), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":wife_reputation"), (store_random_in_range, ":lady_age", 40, ":age"), (call_script, "script_init_troop_age", ":cur_lady", ":lady_age"), (call_script, "script_add_lady_items", ":cur_lady"), (val_add, ":cur_lady", 1), #daughter (troop_set_slot, ":cur_lady", slot_troop_father, ":cur_troop"), (store_sub, ":mother", ":cur_lady", 1), (store_random_in_range, ":lady_age", 17, 25), (val_max, ":lady_age", 19), (call_script, "script_init_troop_age", ":cur_lady", ":lady_age"), (troop_set_slot, ":cur_lady", slot_troop_mother, ":cur_lady"), (store_random_in_range, ":lady_reputation", lrep_conventional, 34), #33% chance of father-derived (try_begin), (le, ":lady_reputation", 25), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":lady_reputation"), (else_try), (eq, ":lady_reputation", 26), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional), (else_try), (eq, ":lady_reputation", 27), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist), (else_try), (assign, ":guardian_reputation", ":reputation"), (try_begin), (this_or_next|eq, ":guardian_reputation", lrep_martial), (eq, ":guardian_reputation", 0), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional), (else_try), (eq, ":guardian_reputation", lrep_quarrelsome), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_otherworldly), (else_try), (eq, ":guardian_reputation", lrep_selfrighteous), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious), (else_try), (eq, ":guardian_reputation", lrep_cunning), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous), (else_try), (eq, ":guardian_reputation", lrep_goodnatured), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous), (else_try), (eq, ":guardian_reputation", lrep_debauched), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious), (else_try), (eq, ":guardian_reputation", lrep_upstanding), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist), (try_end), (try_end), (call_script, "script_add_lady_items", ":cur_lady"), (val_add, ":cur_lady", 1), #high renown (else_try), #Older unmarried lords (is_between, ":npc_seed", 8, 12), # Dunde gives sons to the kings (store_random_in_range, ":age", 25, 36), (store_random_in_range, ":reputation", 0, 8), (try_begin), (is_between, ":npc_seed", 8, 10), (this_or_next|eq, ":npc_seed", 8), (ge, ":reputation", 6), (troop_set_slot, ":cur_troop", slot_troop_father, ":king"), (val_min, ":age", 28), # we want young princes (try_end), (try_begin), # No Father (troop_slot_lt, ":cur_troop", slot_troop_father, 0), (store_random_in_range, ":sister_reputation", 20, 26), (try_begin), (eq, ":sister_reputation", 20), (assign, ":sister_reputation", lrep_conventional), (try_end), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":sister_reputation"), (troop_set_slot, ":cur_lady", slot_troop_guardian, ":cur_troop"), (else_try), # King's son (try_begin), #50% chance of having father's rep (store_random_in_range, ":reputation", 0, 16), (gt, ":reputation", 7), (troop_get_slot, ":reputation", ":king", slot_lord_reputation_type), (try_end), (troop_set_slot, ":cur_lady", slot_troop_father, ":king"), (store_random_in_range, ":lady_reputation", lrep_conventional, 34), #33% chance of father-derived (try_begin), (le, ":lady_reputation", 25), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":lady_reputation"), (else_try), (eq, ":lady_reputation", 26), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional), (else_try), (eq, ":lady_reputation", 27), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist), (else_try), (assign, ":guardian_reputation", ":reputation"), (try_begin), (this_or_next|eq, ":guardian_reputation", lrep_martial), (eq, ":guardian_reputation", 0), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional), (else_try), (eq, ":guardian_reputation", lrep_quarrelsome), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_otherworldly), (else_try), (eq, ":guardian_reputation", lrep_selfrighteous), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious), (else_try), (eq, ":guardian_reputation", lrep_cunning), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous), (else_try), (eq, ":guardian_reputation", lrep_goodnatured), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous), (else_try), (eq, ":guardian_reputation", lrep_debauched), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious), (else_try), (eq, ":guardian_reputation", lrep_upstanding), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist), (try_end), (try_end), (try_end), (store_random_in_range, ":lady_age", 15, 28), (val_max, ":lady_age", 21), (call_script, "script_init_troop_age", ":cur_lady", ":lady_age"), (call_script, "script_add_lady_items", ":cur_lady"), (val_add, ":cur_lady", 1), (else_try), #Younger unmarried lords #age is father's minus 20 to 25 (store_sub, ":father", ":cur_troop", 12), (troop_set_slot, ":cur_troop", slot_troop_father, ":father"), (troop_get_slot, ":mother", ":father", slot_troop_spouse), (troop_set_slot, ":cur_troop", slot_troop_mother, ":mother"), (troop_get_slot, ":father_age", ":father", slot_troop_age), (store_sub, ":age", ":father_age", ":father_age_at_birth"), (try_begin), #50% chance of having father's rep (store_random_in_range, ":reputation", 0, 16), (gt, ":reputation", 7), (troop_get_slot, ":reputation", ":father", slot_lord_reputation_type), (try_end), (try_end), (try_begin), (eq, ":reputation", 0), (assign, ":reputation", 1), (try_end), (troop_set_slot, ":cur_troop", slot_lord_reputation_type, ":reputation"), (call_script, "script_init_troop_age", ":cur_troop", ":age"), (try_end), (try_begin), (eq, "$cheat_mode", 1), (assign, reg3, "$cheat_mode"), (display_message, "@{!}DEBUG -- Assigned lord reputation and relations"), # (display_message, "str_assigned_lord_reputation_and_relations_cheat_mode_reg3"), #This string can be removed (try_end), (try_for_range, ":cur_troop", pretenders_begin, pretenders_end), (troop_set_slot, ":cur_troop", slot_troop_occupation, slto_inactive_pretender), (store_random_in_range, ":age", 25, 30), #(troop_set_slot, ":cur_troop", slot_troop_age, ":age"), (try_begin), (eq, ":cur_troop", "trp_kingdom_5_pretender"), (assign, ":age", 45), (try_end), (call_script, "script_init_troop_age", ":cur_troop", ":age"), (try_end), ]),
Usable. But, being a son of Monarch should have benefits for good.
(try_for_range, ":scn", 1, "scn_enterprise_oil_press"),
## using a single multiplayer_send_4_int_to_player to send a lot of true-false options to speed up the process
#":val" will have a number ranging from 0 to 511 depending on which values are true
(scene_get_slot, ":val", ":scn", slot_scene_lwbr_available_dm),
(scene_get_slot, ":value", ":scn", slot_scene_lwbr_available_tdm),
(val_mul, ":value", 2),
(val_add, ":val", ":value"),
(scene_get_slot, ":value", ":scn", slot_scene_lwbr_available_hq),
(val_mul, ":value", 4),
(val_add, ":val", ":value"),
(scene_get_slot, ":value", ":scn", slot_scene_lwbr_available_cf),
(val_mul, ":value", 8),
(val_add, ":val", ":value"),
(scene_get_slot, ":value", ":scn", slot_scene_lwbr_available_sg),
(val_mul, ":value", 16),
(val_add, ":val", ":value"),
(scene_get_slot, ":value", ":scn", slot_scene_lwbr_available_bt),
(val_mul, ":value", 32),
(val_add, ":val", ":value"),
(scene_get_slot, ":value", ":scn", slot_scene_lwbr_available_bt),
(val_mul, ":value", 64),
(val_add, ":val", ":value"),
(scene_get_slot, ":value", ":scn", slot_scene_lwbr_available_duel),
(val_mul, ":value", 128),
(val_add, ":val", ":value"),
(scene_get_slot, ":value", ":scn", slot_scene_lwbr_available_rotation),
(val_mul, ":value", 256),
(val_add, ":val", ":value"),
(multiplayer_send_4_int_to_player, ":player_no", multiplayer_event_lwbr_client, lwbr_client_set_scene_slot, ":scn", slot_scene_lwbr_combo, ":val"),
(try_end),
(eq,":type",lwbr_client_set_scene_slot),
(try_begin),
(is_between, ":var", 0, num_of_scenes),
(eq, ":value", slot_scene_lwbr_combo),
## using a single multiplayer_send_4_int_to_player to send a lot of true-false options to speed up the process
#":value2" will have a number ranging from 0 to 511 depending on which values are true
(try_begin),
(ge, ":value2", 256),
(scene_set_slot, ":var", slot_scene_lwbr_available_rotation, 1),
(else_try),
(scene_set_slot, ":var", slot_scene_lwbr_available_rotation, 0),
(try_end),
(try_begin),
(ge, ":value2", 128),
(scene_set_slot, ":var", slot_scene_lwbr_available_duel, 1),
(else_try),
(scene_set_slot, ":var", slot_scene_lwbr_available_duel, 0),
(try_end),
(try_begin),
(ge, ":value2", 64),
(scene_set_slot, ":var", slot_scene_lwbr_available_fd, 1),
(else_try),
(scene_set_slot, ":var", slot_scene_lwbr_available_fd, 0),
(try_end),
(try_begin),
(ge, ":value2", 32),
(scene_set_slot, ":var", slot_scene_lwbr_available_bt, 1),
(else_try),
(scene_set_slot, ":var", slot_scene_lwbr_available_bt, 0),
(try_end),
(try_begin),
(ge, ":value2", 16),
(scene_set_slot, ":var", slot_scene_lwbr_available_sg, 1),
(else_try),
(scene_set_slot, ":var", slot_scene_lwbr_available_sg, 0),
(try_end),
(try_begin),
(ge, ":value2", 8),
(scene_set_slot, ":var", slot_scene_lwbr_available_cf, 1),
(else_try),
(scene_set_slot, ":var", slot_scene_lwbr_available_cf, 0),
(try_end),
(try_begin),
(ge, ":value2", 4),
(scene_set_slot, ":var", slot_scene_lwbr_available_hq, 1),
(else_try),
(scene_set_slot, ":var", slot_scene_lwbr_available_hq, 0),
(try_end),
(try_begin),
(ge, ":value2", 2),
(scene_set_slot, ":var", slot_scene_lwbr_available_tdm, 1),
(else_try),
(scene_set_slot, ":var", slot_scene_lwbr_available_tdm, 0),
(try_end),
(try_begin),
(ge, ":value2", 1),
(scene_set_slot, ":var", slot_scene_lwbr_available_dm, 1),
(else_try),
(scene_set_slot, ":var", slot_scene_lwbr_available_dm, 0),
(try_end),
##
(else_try),
(is_between, ":var", 0, num_of_scenes),
(scene_set_slot, ":var", ":value", ":value2"),
(else_try),
(display_message, "@Invalid scene no from 'lwbr_client_set_scene_slot'"),
(try_end),
from module_troops import troops
item_set = []
troop_items = []
unused_items = []
print ("Grabbing item names and values from ID_items.py")
item_IDs = open("ID_items.py", "r")
for i, line in enumerate(item_IDs):
numberPos = line.find('=') + 2
namePos = numberPos - 3
name = line[4:namePos]
number = line[numberPos:-1]
item_set.append([name, int(number)])
print (str(len(item_set)) + " items found")
print ("Grabbing item values from module_troops.py")
for i, v in enumerate(troops):
for j, b in enumerate(v[7]):
if (troop_items.count(b) == 0):
troop_items.append(b)
print (str(len(troop_items)) + " items used by troops")
item_used = False
for i, v in enumerate(item_set):
item_used = False
for j, b in enumerate(troop_items):
if (b == v[1]):
item_used = True
if (not item_used):
unused_items.append(v[0])
print (str(len(unused_items)) + " unused item names saved to unused_items.txt")
file = open("unused_items.txt", "w")
for i, v in enumerate(unused_items):
file.write(unused_items[i] + '\n')
file.close()
print ("Finished")
Zephilinox said:save it as unused_items.py and place it in the same directory as all of your ID, Header, and Module python files.
keinPlan86m said:Zephilinox said:save it as unused_items.py and place it in the same directory as all of your ID, Header, and Module python files.
Done that, but nothing happens after compile or running it with python... i'm not into python, so could you tell me what i'm missing out?
python unused_items.py
Lav said:Anyway, here's an updated version of the script. Context menus are used to select the party to move. TFGH buttons are used to move party around, instead of WASD, so no more conflicts with normal map scrolling. Finally, terrain restrictions apply - you cannot move party over water or mountains (but you can move Praven over a bridge ).
Code:(0, [ (map_free), (neq, "$g_controlled_party", 0), (party_is_active, "$g_controlled_party"), (set_fixed_point_multiplier, 1000), (party_get_position, pos60, "$g_controlled_party"), (position_get_x, ":dx", pos60), (position_get_y, ":dy", pos60), (assign, ":movement", 0), (assign, ":d", 200), (try_begin), (this_or_next|key_is_down, key_left_control), (key_is_down, key_right_control), (val_div, ":d", 10), (else_try), (this_or_next|key_is_down, key_left_shift), (key_is_down, key_right_shift), (val_mul, ":d", 5), (try_end), (try_begin), (key_is_down, key_t), (val_add, ":dy", ":d"), (assign, ":movement", 1), (try_end), (try_begin), (key_is_down, key_g), (val_sub, ":dy", ":d"), (assign, ":movement", 1), (try_end), (try_begin), (key_is_down, key_f), (val_sub, ":dx", ":d"), (assign, ":movement", 1), (try_end), (try_begin), (key_is_down, key_h), (val_add, ":dx", ":d"), (assign, ":movement", 1), (try_end), (eq, ":movement", 1), (init_position, pos61), (position_set_x, pos61, ":dx"), (position_set_y, pos61, ":dy"), (party_set_position, "$g_controlled_party", pos61), (try_begin), (party_get_current_terrain, ":terrain", "$g_controlled_party"), (this_or_next|eq, ":terrain", 0), (this_or_next|eq, ":terrain", 1), (this_or_next|eq, ":terrain", 8), (eq, ":terrain", 9), (party_set_position, "$g_controlled_party", pos60), (try_end), (set_camera_follow_party, "$g_controlled_party"), ] ),
Code:#script_game_context_menu_get_buttons: # This script is called from the game engine when the player clicks the right mouse button over a party on the map. # INPUT: arg1 = party_no # OUTPUT: none, fills the menu buttons ("game_context_menu_get_buttons", [ (store_script_param, ":party_no", 1), (try_begin), (neq, ":party_no", "p_main_party"), (context_menu_add_item, "@Move here", cmenu_move), (try_end), (try_begin), (is_between, ":party_no", centers_begin, centers_end), (context_menu_add_item, "@View notes", 1), (else_try), (party_get_num_companion_stacks, ":num_stacks", ":party_no"), (gt, ":num_stacks", 0), (party_stack_get_troop_id, ":troop_no", ":party_no", 0), (is_between, ":troop_no", active_npcs_begin, active_npcs_end), (context_menu_add_item, "@View notes", 2), (try_end), (try_begin), (eq, ":party_no", "$g_controlled_party"), (context_menu_add_item, "@Accept this position", 3), (else_try), (context_menu_add_item, "@Manipulate this party", 3), (try_end), (try_begin), (neq, ":party_no", "p_main_party"), (store_faction_of_party, ":party_faction", ":party_no"), (this_or_next|eq, ":party_faction", "$players_kingdom"), (this_or_next|eq, ":party_faction", "fac_player_supporters_faction"), (party_slot_eq, ":party_no", slot_party_type, spt_kingdom_caravan), (neg|is_between, ":party_no", centers_begin, centers_end), (context_menu_add_item, "@Accompany", cmenu_follow), (try_end), ]), #script_game_event_context_menu_button_clicked: # This script is called from the game engine when the player clicks on a button at the right mouse menu. # INPUT: arg1 = party_no, arg2 = button_value # OUTPUT: none ("game_event_context_menu_button_clicked", [(store_script_param, ":party_no", 1), (store_script_param, ":button_value", 2), (try_begin), (eq, ":button_value", 1), (change_screen_notes, 3, ":party_no"), (else_try), (eq, ":button_value", 2), (party_stack_get_troop_id, ":troop_no", ":party_no", 0), (change_screen_notes, 1, ":troop_no"), (else_try), (eq, ":button_value", 3), (try_begin), (eq, ":party_no", "$g_controlled_party"), (assign, "$g_controlled_party", 0), (display_message, "@New party coordinates set."), (else_try), (assign, "$g_controlled_party", ":party_no"), (display_message, "@Party manipulation started, move it using TFGH keys."), (try_end), (try_end), ]),
There isn't a single line of Python in there, God damn it! The game uses a custom scripting language that gets processed through Python; this allows for limited Python usage, chiefly for compile-time code generation. One usually ends up not using real Python for almost absolutely everything that's related to modding this game.Sorenerv said:Hello, I came across this while looking for a different map editor choice. I am only intermediate with python and am curious how would I go about using this piece of script to actually edit the map in a live environment? Like do I need to make it draw a box on the screen in order to use a GUI? Obviously im very lost here, please help lol
module_scripts