Script and analysis - one banner per faction

Started by Jubal, December 14, 2008, 09:41:44 AM

Previous topic - Next topic

Jubal

Fron Grailknighthero, the modding machine that is...

Find this section of module_scripts.py;
(assign, ":num_khergit_lords_assigned", 0),            (try_for_range, ":kingdom_hero", kingdom_heroes_begin, kingdom_heroes_end),        (store_troop_faction, ":kingdom_hero_faction", ":kingdom_hero"),        (try_begin),          (eq, ":kingdom_hero_faction", "fac_kingdom_3"), #Khergit Khanate          (store_add, ":kingdom_3_banners_begin", banner_scene_props_begin, khergit_banners_begin_offset),          (store_add, ":banner_id", ":kingdom_3_banners_begin", ":num_khergit_lords_assigned"),          (troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, ":banner_id"),          (val_add, ":num_khergit_lords_assigned", 1),        (else_try),          (store_sub, ":hero_offset", ":kingdom_hero", kingdom_heroes_begin),          (val_sub, ":hero_offset", ":num_khergit_lords_assigned"),#Remove khergits from offset since their banners are assigned above here          (try_begin),            (gt, ":hero_offset", khergit_banners_begin_offset),#Do not add khergit banners to non-khergit lords            (val_add, ":hero_offset", khergit_banners_end_offset),            (val_sub, ":hero_offset", khergit_banners_begin_offset),          (try_end),          (store_add, ":banner_id", banner_scene_props_begin, ":hero_offset"),          (troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, ":banner_id"),        (try_end),        (store_character_level, ":level", ":kingdom_hero"),        (store_mul, ":renown", ":level", ":level"),        (val_div, ":renown", 2),        (try_begin),          (faction_slot_eq, ":kingdom_hero_faction", slot_faction_leader, ":kingdom_hero"),          (troop_set_slot, ":kingdom_hero", slot_troop_loyalty, 100),          (store_random_in_range, ":random_renown", 250, 400),        (else_try),          (store_random_in_range, ":random_loyalty", 50, 100),          (troop_set_slot, ":kingdom_hero", slot_troop_loyalty, ":random_loyalty"),          (store_random_in_range, ":random_renown", 100, 200),        (try_end),        (val_add, ":renown", ":random_renown"),        (troop_set_slot, ":kingdom_hero", slot_troop_renown, ":renown"),        (store_random_in_range, ":random_readiness", 0, 100),        (troop_set_slot, ":kingdom_hero", slot_troop_readiness_to_join_army, ":random_readiness"),        (troop_set_slot, ":kingdom_hero", slot_troop_readiness_to_follow_orders, 100),        (troop_set_slot, ":kingdom_hero", slot_troop_player_order_state, spai_undefined),        (troop_set_slot, ":kingdom_hero", slot_troop_player_order_object, -1),      (try_end),#Correcting banners according to the player banner      (troop_get_slot, ":selected_banner_spr", "trp_player", slot_troop_banner_scene_prop),      (assign, ":end_cond", kingdom_heroes_end),      (try_for_range, ":cur_troop", kingdom_heroes_begin, ":end_cond"),        (troop_slot_eq, ":cur_troop", slot_troop_banner_scene_prop, ":selected_banner_spr"),        (troop_set_slot, ":cur_troop", slot_troop_banner_scene_prop, banner_scene_props_end_minus_one),        (assign, ":end_cond", 0),      (try_end),

Replace with the following;
    (try_for_range, ":kingdom_hero", kingdom_heroes_begin, kingdom_heroes_end),        (store_troop_faction, ":kingdom_hero_faction", ":kingdom_hero"),        (try_begin),          (eq, ":kingdom_hero_faction", "fac_kingdom_1"), #Swadia          (troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, "spr_BANNER_ID"),        (else_try),          (eq, ":kingdom_hero_faction", "fac_kingdom_2"), #Vaegir          (troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, "spr_BANNER_ID"),        (else_try),          (eq, ":kingdom_hero_faction", "fac_kingdom_3"), #Khergit Khanate          (troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, "spr_BANNER_ID"),        (else_try),          (eq, ":kingdom_hero_faction", "fac_kingdom_4"), #Nord(troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, "spr_BANNER_ID"),        (else_try),          (eq, ":kingdom_hero_faction", "fac_kingdom_5"), #Rhodok          (troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, "spr_BANNER_ID"),         (try_end),        (store_character_level, ":level", ":kingdom_hero"),        (store_mul, ":renown", ":level", ":level"),        (val_div, ":renown", 2),        (try_begin),          (faction_slot_eq, ":kingdom_hero_faction", slot_faction_leader, ":kingdom_hero"),          (troop_set_slot, ":kingdom_hero", slot_troop_loyalty, 100),          (store_random_in_range, ":random_renown", 250, 400),        (else_try),          (store_random_in_range, ":random_loyalty", 50, 100),          (troop_set_slot, ":kingdom_hero", slot_troop_loyalty, ":random_loyalty"),          (store_random_in_range, ":random_renown", 100, 200),        (try_end),        (val_add, ":renown", ":random_renown"),        (troop_set_slot, ":kingdom_hero", slot_troop_renown, ":renown"),        (store_random_in_range, ":random_readiness", 0, 100),        (troop_set_slot, ":kingdom_hero", slot_troop_readiness_to_join_army, ":random_readiness"),        (troop_set_slot, ":kingdom_hero", slot_troop_readiness_to_follow_orders, 100),        (troop_set_slot, ":kingdom_hero", slot_troop_player_order_state, spai_undefined),        (troop_set_slot, ":kingdom_hero", slot_troop_player_order_object, -1),      (try_end),

Now go to module_scene_props, find the banners you want (you may need to dig into the BRF files to find which is which, it's not totally intuitive), and replace in where it says BANNER_ID with... shock... the id of the banner.

Commenting out the following, in module_presentations, helps things not mess up (thanks to hokie_bt)
         (troop_set_slot, ":cur_troop", slot_troop_banner_scene_prop, banner_scene_props_end_minus_one),
         (party_set_banner_icon, ":cur_party", banner_map_icons_end_minus_one),
         (party_set_banner_icon, ":cur_center", banner_map_icons_end_minus_one),
The duke, the wanderer, the philosopher, the mariner, the warrior, the strategist, the storyteller, the wizard, the wayfarer...