Un banner por faccion MS

    Rafalongo
    Rafalongo
    Modder
    Modder


    Mensajes : 694
    Facción : Imperio Calrádico del Sur

    Un banner por faccion MS Empty Un banner por faccion MS

    Mensaje por Rafalongo Vie Ago 21, 2015 12:40 am

    Script para que el banner del rey se asigne a todos sus vasallos

    En Module_script, presionamos ctrl+f para que se abra el buscador y ponemos "banner", lo primero que aparece no es, daamos a buscar nueavemnte y en la segunda busqueda sustituimos esto:

    Código:
         (try_for_range, ":cur_faction", npc_kingdoms_begin, npc_kingdoms_end),
            (faction_get_slot, ":cur_faction_king", ":cur_faction", slot_faction_leader),
            (faction_get_slot, ":cur_faction_banner", ":cur_faction", slot_faction_banner),
            (val_sub, ":cur_faction_banner", banner_meshes_begin),
            (val_add, ":cur_faction_banner", banner_scene_props_begin),
            (troop_set_slot, ":cur_faction_king", slot_troop_banner_scene_prop, ":cur_faction_banner"),
          (try_end),
          (assign, ":num_khergit_lords_assigned", 0),
          (assign, ":num_sarranid_lords_assigned", 0),
          (assign, ":num_other_lords_assigned", 0),

          (try_for_range, ":kingdom_hero", active_npcs_begin, active_npcs_end),
            (this_or_next|troop_slot_eq, ":kingdom_hero", slot_troop_occupation, slto_kingdom_hero),
            (troop_slot_eq, ":kingdom_hero", slot_troop_occupation, slto_inactive_pretender),

            (store_troop_faction, ":kingdom_hero_faction", ":kingdom_hero"),
            (neg|faction_slot_eq, ":kingdom_hero_faction", slot_faction_leader, ":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),
              (eq, ":kingdom_hero_faction", "fac_kingdom_6"), #Sarranid Sultanate
              (store_add, ":kingdom_6_banners_begin", banner_scene_props_begin, sarranid_banners_begin_offset),
              (store_add, ":banner_id", ":kingdom_6_banners_begin", ":num_sarranid_lords_assigned"),
              (troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, ":banner_id"),
              (val_add, ":num_sarranid_lords_assigned", 1),
            (else_try),
              (assign, ":hero_offset", ":num_other_lords_assigned"),
              (try_begin),
                (gt, ":hero_offset", khergit_banners_begin_offset),#Do not add khergit banners to other lords
                (val_add, ":hero_offset", khergit_banners_end_offset),
                (val_sub, ":hero_offset", khergit_banners_begin_offset),
              (try_end),
              (try_begin),
                (gt, ":hero_offset", sarranid_banners_begin_offset),#Do not add sarranid banners to other lords
                (val_add, ":hero_offset", sarranid_banners_end_offset),
                (val_sub, ":hero_offset", sarranid_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"),
              (val_add, ":num_other_lords_assigned", 1),
            (try_end),
            (try_begin),
              (this_or_next|lt, ":banner_id", banner_scene_props_begin),
              (gt, ":banner_id", banner_scene_props_end_minus_one),
              (display_message, "@{!}ERROR: Not enough banners for heroes!"),
            (try_end),

    por esto:

    Código:
         (try_for_range, ":cur_faction", npc_kingdoms_begin, npc_kingdoms_end),
            (faction_get_slot, ":cur_faction_king", ":cur_faction", slot_faction_leader),
            (faction_get_slot, ":cur_faction_banner", ":cur_faction", slot_faction_banner),
            (val_sub, ":cur_faction_banner", banner_meshes_begin), # These two lines translate the banner mesh ID above
            (val_add, ":cur_faction_banner", banner_scene_props_begin), # to scene prop mesh ID used as troop banner
            (troop_set_slot, ":cur_faction_king", slot_troop_banner_scene_prop, ":cur_faction_banner"),
          (try_end),
        
         # Lords
          (try_for_range, ":kingdom_hero", active_npcs_begin, active_npcs_end),
            (this_or_next|troop_slot_eq, ":kingdom_hero", slot_troop_occupation, slto_kingdom_hero),
            (troop_slot_eq, ":kingdom_hero", slot_troop_occupation, slto_inactive_pretender),
          
            (store_troop_faction, ":kingdom_hero_faction", ":kingdom_hero"), # Assume that you set the correct faction in module_troops
            (neg|faction_slot_eq, ":kingdom_hero_faction", slot_faction_leader, ":kingdom_hero"), # Not the leader
          
          (faction_get_slot, ":cur_kingdom_king", ":kingdom_hero_faction", slot_faction_leader), # get the leader of the faction
          (troop_get_slot, ":cur_kingdom_king_banner", ":cur_kingdom_king", slot_troop_banner_scene_prop), # Get the banner ID of the leader
          (troop_set_slot, ":kingdom_hero", slot_troop_banner_scene_prop, ":cur_kingdom_king_banner"), # assign to lord.
        
          # This message error is left to mark the end of the modded code
            (try_begin),
              #(this_or_next|lt, ":banner_id", banner_scene_props_begin),
              #(gt, ":banner_id", banner_scene_props_end_minus_one),
              (display_message, "@{!}ERROR: Not enough banners for heroes!"),
            (try_end),

    y ya esta!

      Fecha y hora actual: Vie Abr 19, 2024 1:47 pm