OSP Kit SP Top-Tier-Troop-to-Hero Script (Fully working but still needs a few tweaks)

Users who are viewing this thread

Here is the finnished(ish) "Top-Tier-Troop-to-Hero Script" thanks to Dunde:

First, define 10 new heroes on module_troops.py , put between "merchant20" and #Seneschals :
Code:
##  ["merchant_20","merchant_20_F","merchant_20_F",tf_hero|tf_female, 0,0, fac_merchants,[itm_courser,            itm_arming_sword,       itm_padded_leather,         itm_leather_boots,                          ],              def_attrib|level(15),wp(100),knows_inventory_management_10, 0x000000000010500401f6837d27688212],


###########################################################################
  ["hero1","Swadian Warrior","Swadian Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero2","Vaegir Warrior","Vaegir Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero3","Kerghit Warrior","Kerghit Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero4","Nord Warrior","Nord Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero5","Rodhok Warrior","Rodhok Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero6","Swadian Patriot","Swadian Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero7","Vaegir Patriot","Vaegir Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero8","Kerghit Patriot","Kerghit Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero9","Nord Patriot","Nord Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero10","Rodhok Patriot","Rodhok Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
###########################################################################
 
#Seneschals
I only copy "trp_npc1" form native. Please feel free to modify the stats and rename them, and it will be better if hero1 and hero6 are given swadian face,
hero2 and hero7 are vaegir faces, etc.

Define new constants on module_constants.py :
Code:
additional_heroes_begin = "trp_hero1"
additional_heroes_end = "trp_town_1_seneschal"

module_scripts.py's change :
Add these lines on "game_start" script :
Code:
  ("game_start",
   [
      ##################################################################
     (troop_set_slot,"trp_hero1", slot_troop_occupation, "trp_swadian_knight"),   # Hero1's occupation before upgraded is Swadian Knight
     (troop_set_slot,"trp_hero2", slot_troop_occupation, "trp_vaegir_knight"),   
     (troop_set_slot,"trp_hero3", slot_troop_occupation, "trp_khergit_lancer"),
     (troop_set_slot,"trp_hero4", slot_troop_occupation, "trp_nord_champion"),   
     (troop_set_slot,"trp_hero5", slot_troop_occupation, "trp_rhodok_sergeant"),   
     (troop_set_slot,"trp_hero6", slot_troop_occupation, "trp_swadian_knight"),
     (troop_set_slot,"trp_hero7", slot_troop_occupation, "trp_vaegir_knight"),   
     (troop_set_slot,"trp_hero8", slot_troop_occupation, "trp_khergit_lancer"),
     (troop_set_slot,"trp_hero9", slot_troop_occupation, "trp_nord_champion"),   
     (troop_set_slot,"trp_hero10", slot_troop_occupation, "trp_rhodok_sergeant"),
     (assign, "$g_upgrade_time", 336), # 2 weeks for 1st upgrade call
     ##################################################################
     ## TEST ONLY : COMMENT for farther use
     (assign, "$g_upgrade_time", 10), # 24 hours for 1st call
     (party_add_members,"p_main_party","trp_swadian_knight",2),
     (party_add_members,"p_main_party","trp_vaegir_knight",2),
     (party_add_members,"p_main_party","trp_khergit_lancer",2),
     (party_add_members,"p_main_party","trp_nord_champion",2),
     (party_add_members,"p_main_party","trp_rhodok_sergeant",2),
     (add_xp_to_troop, 100000, "trp_player"),
     ##################################################################

Main Script, I make it slimmer, taking away all checking removing the cf(can fail), assumed that this script only called from our menu.
Put before last ]
Code:
   # ##script_upgrade_troop_to_hero
   # ##usage   : (call_script,"script_upgrade_troop_to_hero",<troop_ID>,<hero_ID>),
   # ##Input 1 : <troop_ID> should be one of troop_id of top tier troop
   # ##Input 2 : <hero_ID> should be one of troop_id of inactive hero on module_troops.py
   # ##This must be passed.  The code block calling this script should have already checked if there is that troop.
   # ##Output: None, will adjust p_main_party
   # ##May call a dialog to communicate this happening
   ("upgrade_troop_to_hero",
      [(store_script_param,":troop_id",1),
       (store_script_param,":hero_id",2),
       (try_begin),
          (main_party_has_troop, ":troop_id"),
          (troop_slot_eq, ":hero_id", slot_troop_occupation, ":troop_id"),
          (troop_set_slot,":hero_id", slot_troop_occupation, slto_player_companion),
          (party_remove_members,"p_main_party",":troop_id",1),      # ##remove the regular troop
          (party_add_members,"p_main_party",":hero_id",1),          # ##Add the hero found
       (try_end),
      ]),

The Menu, called by trigger
on module_game_menus.py, before last ] :
Code:
###########################################################################
  ("upgrade_to_hero",0,
   "You notice that one or more of your warriors exceeds your expectations in battle. ^You walk towards the lines of your troops, and ...",
   "none",
   [
       (assign, reg11, 0), # sub menu 1
       (assign, reg12, 0), # sub menu 2
       (assign, reg13, 0), # sub menu 3
       (assign, reg14, 0), # sub menu 4
       (assign, "$g_upgrade_talk", 0),
     ],
    [
      ("hero_1",
      [        
         (assign, ":limit", reg10),
         (assign, ":found", 0),
         (try_for_range, ":hero_id", ":limit", additional_heroes_end),
            (eq, ":found", 0),
            (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
            (gt, ":hero_ocu", 0),
            (neq, ":hero_ocu",slto_kingdom_hero),
            (neq, ":hero_ocu",slto_player_companion),
            (main_party_has_troop, ":hero_ocu"),
            (assign, ":found", 1),
            (assign, reg11, ":hero_id"),
         (try_end),
         (eq, ":found", 1),
         (str_store_troop_name,s1,reg11),
      ],"stop to talk to {s1}",
       [
           (assign, ":hero_id", reg11),
           (troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
           (assign, reg20, ":troop_id"),
           (assign, reg21, ":hero_id"),
           (assign, "$g_upgrade_talk", 1),
           (start_map_conversation, ":troop_id"),
           (change_screen_return),
        ]
       ),
      ("hero_2",
      [        
         (ge, reg11, reg10),
         (store_add, ":limit", reg11, 1),
         (assign, ":found", 0),        
         (try_for_range, ":hero_id", ":limit", additional_heroes_end),
            (eq, ":found", 0),
            (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
            (gt, ":hero_ocu", 0),
            (neq, ":hero_ocu",slto_kingdom_hero),
            (neq, ":hero_ocu",slto_player_companion),
            (main_party_has_troop, ":hero_ocu"),
            (assign, ":found", 1),
            (assign, reg12, ":hero_id"),
         (try_end),
         (eq, ":found", 1),
         (str_store_troop_name,s1,reg12),
      ],"stop to talk to {s1}",
       [
           (assign, ":hero_id", reg12),
           (troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
           (assign, reg20, ":troop_id"),
           (assign, reg21, ":hero_id"),
           (assign, "$g_upgrade_talk", 1),
           (start_map_conversation, ":troop_id"),
           (change_screen_return),
        ]
       ),
      ("hero_3",
      [        
         (gt, reg12, reg11),
         (store_add, ":limit", reg12, 1),
         (assign, ":found", 0),        
         (try_for_range, ":hero_id", ":limit", additional_heroes_end),
            (eq, ":found", 0),
            (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
            (gt, ":hero_ocu", 0),
            (neq, ":hero_ocu",slto_kingdom_hero),
            (neq, ":hero_ocu",slto_player_companion),
            (main_party_has_troop, ":hero_ocu"),
            (assign, ":found", 1),
            (assign, reg13, ":hero_id"),
         (try_end),
         (eq, ":found", 1),
         (str_store_troop_name,s1,reg13),
      ],"stop to talk to {s1}",
       [
           (assign, ":hero_id", reg13),
           (troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
           (assign, reg20, ":troop_id"),
           (assign, reg21, ":hero_id"),
           (assign, "$g_upgrade_talk", 1),
           (start_map_conversation, ":troop_id"),
           (change_screen_return),
        ]
       ),
      ("hero_4",
      [        
         (gt, reg13, reg12),
         (store_add, ":limit", reg13, 1),
         (assign, ":found", 0),        
         (try_for_range, ":hero_id", ":limit", additional_heroes_end),
            (eq, ":found", 0),        
            (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
            (gt, ":hero_ocu", 0),
            (neq, ":hero_ocu",slto_kingdom_hero),
            (neq, ":hero_ocu",slto_player_companion),
            (main_party_has_troop, ":hero_ocu"),
            (assign, ":found", 1),
            (assign, reg14, ":hero_id"),
         (try_end),
         (eq, ":found", 1),
         (str_store_troop_name,s1,reg14),
      ],"stop to talk to {s1}",
       [
           (assign, ":hero_id", reg14),
           (troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
           (assign, reg20, ":troop_id"),
           (assign, reg21, ":hero_id"),
           (assign, "$g_upgrade_talk", 1),
           (start_map_conversation, ":troop_id"),
           (change_screen_return),
        ]
       ),
      ("prev",
      [
          (gt, reg10, additional_heroes_begin),
          (assign, ":limit", reg10),
          (assign, ":found", 0),        
          (try_for_range_backwards, ":hero_id", ":limit", additional_heroes_begin),
             (lt, ":found", 4),        
             (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
             (gt, ":hero_ocu", 0),
             (neq, ":hero_ocu",slto_kingdom_hero),
             (neq, ":hero_ocu",slto_player_companion),
             (main_party_has_troop, ":hero_ocu"),
             (assign, reg15, ":hero_id"),
             (val_add, ":found", 1),
         (try_end),
         (gt, ":found", 0),        
      ],"go to the previous lines",
       [
          (assign, reg10, reg15),
          (jump_to_menu, "mnu_upgrade_to_hero"),
        ]
       ),
      ("next",
      [
          (gt, reg14, reg13),
          (store_add, ":limit", reg14, 1),
          (assign, ":found", 0),        
          (try_for_range, ":hero_id", ":limit", additional_heroes_end),
             (eq, ":found", 0),        
             (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
             (gt, ":hero_ocu", 0),
             (neq, ":hero_ocu",slto_kingdom_hero),
             (neq, ":hero_ocu",slto_player_companion),
             (main_party_has_troop, ":hero_ocu"),
             (assign, ":found", 1),
         (try_end),
         (eq, ":found", 1),        
      ],"go to the next lines",
       [
           (store_add, reg10, reg14, 1),
           (jump_to_menu, "mnu_upgrade_to_hero"),
        ]
       ),
      ("close",
      [
       ],"close",
       [
          (assign, "$g_upgrade_talk", 1),
          (change_screen_map),
       ]
      ),
    ]
  ),

###########################################################################

Here you are your dialogs. Put it under dialog = [ on module_dialogs.py. I'm not sure about the initial state. Is it "start" or "event_triggered", I'll test it when I have module_system.
Code:
dialogs = [
###########################################################################
   [anyone,
      "event_triggered",
      [
         (store_conversation_troop,"$g_talk_troop"),
         #(is_between,"$g_talk_troop", additional_heroes_begin, additional_heroes_end),
                        (eq, "$g_talk_troop", reg20),
         (eq, "$g_upgrade_talk", 1),
                        (troop_get_type, reg65, "trp_player"),
                        (str_store_string,s65,"@{reg65?my Lady:my Lord}"),
                        (str_store_troop_name,s21,reg21),
      ],
      "Yes, {s65}?",
      "upgrade_talk",
      []
   ],
       [anyone|plyr,
      "upgrade_talk",
      [],
      "I have seen you fight well in battles, soldier.",
      "upgrade_talk_1",
      []
   ],
        [anyone,
      "upgrade_talk_1",
      [
      ],
      "I only do my duty to {s65}, sire.",
      "upgrade_talk_2",
      []
         ],
         [anyone|plyr,
      "upgrade_talk_2",
      [],
      "And well, too. The only time I've heard someone with such skills in battle, it has been in sagas. You are a hero!",
      "upgrade_talk_3a",
      []
         ],        
         [anyone|plyr,
      "upgrade_talk_2",
      [],
      "I just wanted you to know that I take notice in such skills in battle. Now fall back in line!",
      "upgrade_talk_3b",
      []
         ],
   [anyone,
      "upgrade_talk_3a",
      [
      ],
      "You honour me with your words. I will do my utter best to honour them.",
      "upgrade_talk_4a",
      []
         ],
         [anyone|plyr,
      "upgrade_talk_4a",
      [],
      "From now on you shall be remembered as a {s21}",
      "upgrade_talk_5",
      []
         ],
   [anyone,
      "upgrade_talk_5",
      [
                    (call_script,"script_upgrade_troop_to_hero", reg20, reg21),
      ],
      "I will defend my new title to my death, and I will not let you down. I promise you this; The blood on my steel will never dry!",
      "close_window",
      []
         ],        
   [anyone,
      "upgrade_talk_3b",
      [
      ],
      "Yes, {s65}",
      "close_window",
      []
   ],
 
###########################################################################

Ok,I follow your way, I make it called by timed trigger, but I make the interval is not fixed 14 days, but random 14-21 days.
Then, optional from me, I think it will be more balanced if we put more limitation, only player reached 15 level can recruit new hero
on module_simple_triggers.py :
Code:
  (24,
   [
      #################################################################
      ## LEVEL CHECK BEGIN
      ## Comment to disable LEVEL CHECK
      (store_character_level, ":level", "trp_player"),  
      (ge, ":level", 15),
      ## LEVEL CHECK END
      #################################################################
      (store_current_hours,":now"), 
      (ge, ":now", "$g_upgrade_time"),
      (store_random_in_range, ":rand", 14, 22),         ## Next Call 14 - 21 days ahead   
      (val_mul, ":rand", 24),
      (val_add, ":rand", ":now"),
      (assign, "$g_upgrade_time"),
      (assign, reg10, additional_heroes_begin),
      (jump_to_menu, "mnu_upgrade_to_hero"),
    ]),

Admin note:
Following thread builds up on this OSP code and might be interesting for some:
 
Last edited by a moderator:
No one?
Doesn't anyone know how to make this work with the native module?


The main concern is the script. It has some things I know are not necessary to use. The p_bus, leader_seat, free_seat. These things were to make sure that the troops would have a spot on the bus that we used. But I don't know how to remove these things now that we don't need it anymore.
 
[itm_jacket_open_b,itm_leather_boots,itm_leather_gloves,itm_baseball_bat_3],

Native don't have item like those above. So you need to define them on module_items.py and you shold have the models, and textures for them too. If you don't have them, you can take the code only, and apply the code for your own made troops with standard item.
 
I know that. Those are the OSP clothing from Hokie_BT. I could replace those with.... nothing, just to make them naked and let the modder chose for himself.
I'll get to it to get a start.


EDIT

There we go. Now it's modified a bit in the right direction.


Also, I was thinking if a simple trigger like this would do it make the script run once every day?

Code:
(24,
   [
       (call_script, "cf_upgrade_hero"),
    ]),

Is this enough?
 
The script needs a param, target's Heroes ID, I think.
  (store_script_param,":id",1),

So if you want to call it every 24 hours :
Code:
(24,
   [
       (try_for_range, ":id", h_locator, h_end),
           (call_script, "cf_upgrade_hero", ":id"),
       (try_end),
    ]),

BTW,  I think you must make the script slimmer, comment any part you don't need on your module.


 
This is where you guys come in :grin:
I actually don't know exactly what parts I need to keep and what part I don't need.

Here is the script with the things I THINK that I can remove:
("cf_upgrade_hero",
[(store_script_param,":id",1),
(assign,":h_start",0),
(party_count_members_of_type,":hero_count","p_main_party",":id"),
                (ge,":hero_count",1), # ##Must have at least 1 to upgrade
      --->##(assign,":leader_seat",0), # ##Cannot be 0 after this check
(try_begin), # ##Find out which troop type has been passed
(eq,":id","trp_locator"),
    --->##(assign,":leader_seat",h_locator), # ##get thier seat on the bus ready
(assign,":h_start","trp_locator_hero_1"),
(str_store_string,s13,"@locators"),
(else_try),
(eq,":id","trp_cleaner"),
--->##(assign,":leader_seat",h_cleaner), # ##get thier seat on the bus ready
(assign,":h_start","trp_cleaner_hero_1"),
(str_store_string,s13,"@cleaners"),
(else_try),
(eq,":id","trp_producer"),
--->##(assign,":leader_seat",h_producer), # ##get thier seat on the bus ready
(assign,":h_start","trp_producer_hero_1"),
(str_store_string,s13,"@producers"),
(else_try),
(eq,":id","trp_engineer"),
--->##(assign,":leader_seat",h_engineer), # ##get thier seat on the bus ready
(assign,":h_start","trp_engineer_hero_1"),
(str_store_string,s13,"@engineers"),
(else_try),
(eq,":id","trp_tech_master"),
--->##(assign,":leader_seat",h_techmaster), # ##get thier seat on the bus ready
(assign,":h_start","trp_techmaster_hero_1"),
(str_store_string,s13,"@techmasters"),
(else_try),
(eq,":id","trp_scientist"),
--->##(assign,":leader_seat",h_scientist), # ##get thier seat on the bus ready
(assign,":h_start","trp_scientist_hero_1"),
(str_store_string,s13,"@scientists"),
(else_try),
(le,":id",0), # ##no param passed!
(dialog_box,"@No troop ID was passed","@ERROR - BAD TROOP ID"),
(else_try),
(str_store_troop_name,s1,":id"),
(dialog_box,"@{s1} is not listed as one of the top tiers to upgrade to hero","@ERROR - BAD TROOP ID"),
(try_end),
(neq,":h_start",0), # ##Make sure that the proper troop was passed
--->##(neq,":leader_seat",0),
(party_get_slot,":free_seat","p_bus",":leader_seat"),
(lt,":free_seat",99), # ##At 100 there is already a hero present, don't continue
# ##increase the seat number by how many top tier troops you have.  The more, the better your chances of an upgrade
(call_script,"script_party_slot_add","p_bus",":leader_seat",":hero_count"),
(store_random_in_range,":h_chance",1,91),
(try_begin),
(party_slot_ge,"p_bus",":leader_seat",":h_chance"), # ##if roll you less than the seat number
(party_set_slot,"p_bus",":leader_seat",100), # ##then you found a hero!
(store_add,":h_end",":h_start",6), # ##Mark the last of the heros - at this time there is just 5
(assign,":hero",0), # ##this will not be 0 if a new hero are left alive (at the time max is 5 of each)
(try_for_range,":new_hero",":h_start",":h_end"), # ##loop to check if any heros of this type are alive
(try_begin),
(troop_slot_eq,":new_hero",hero_inplay,0), # ##0 means the hero has not been used yet
(assign,":hero",":new_hero"), # ##this is the next hero to be used
(assign,":h_end",":h_start"), # ##found a hero, force this loop to end
(try_end),
(assign,reg13,":new_hero"), # ##avoid the warning of not using :new_hero
(try_end),
(neq,":hero",0), # ##Only continue if a possible hero/leader is found
(str_store_troop_name,s1,":hero"),
(str_store_troop_name_plural,s2,":id"),
#(display_message,"@{s1} has been upgraded from the {s2} to the Team leader"),
(troop_set_slot,":hero",hero_inplay,1), # ##mark him/her as used
(party_remove_members,"p_main_party",":id",1), # ##remove the regular troop
(party_add_members,"p_main_party",":hero",1), # ##Add the hero found
(tutorial_box,"@You noticed one of your {s13} standing out in thier performance.  Looks like you might have found a team leader.  You call him over...","@Team Leader Upgrade"),
(assign,"$hero_up",":hero"), # ##Used to mark the dialog for the new hero script
(assign,"$g_talk_troop",":hero"), # ##for the conversation
(start_map_conversation,":hero"), # ##Start a dialog with him/her
# ##At this point you can add a call to a dialog, or any other way to inform the player that
# ##They now have a hero added to thier party.  This script will prevent more than one of any
# ##hero type in the party (including if the memeber is left else where by use of the bus array
# ##Will have to free up the spot if the hero dies...
(try_end),
]
),

I also think that I have to replace p_bus with p_main_party or am I wrong? But I have no idea of what leader_seat is thou. But I think that it's since he's a hero, he should be guaranteed a seat on the bus. Could leader_seat ju be removed or should it be replaced by something else?
 
Exactly!

But the code has been created to fit my zombie mod, and JIK isn't around anymore. So I thought that I should contribute the codes that I have to the community.
And as it is right now, I don't think that the code could work in a native module. I have to clean it up first, with your help.
 
OK, let me try..
I need the script like this too for my module. Thanks for sharring this, so I have a blueprint script to start.
Here's my modification. I make it a little different. The input param I use is heroes ID.
I want to implement this on my mod, adding new companion from top tier troop is a good idea. Then combining with berserker's kingdom management to make the hero become lord is also great.
I'm poor in English, I hope you can make the dialog for me.

  # ##script_cf_upgrade_hero
  # ##This script will check if there is a hero of the given type left, then remove a top tier troop and put in the hero
  # ##usage  : (call_script,"script_cf_upgrade_hero",<hero_ID>),
  # ##Input  : <hero_ID> should be one of troop_id of inactive hero on module_troops.py
  # ##This must be passed.  The code block calling this script should have already checked if there is that troop.
  # ##Output: None, will adjust p_main_party
  # ##May call a dialog to communicate this happening
  ("cf_upgrade_hero",
      [(store_script_param,":hero_id",1),
      (troop_get_slot, ":eek:ccupation", ":hero_id", slot_troop_occupation),
      (neq, ":eek:ccupation", slto_kingdom_hero),                                                      # not a kingdom hero
      (neq, ":eek:ccupation", slto_player_companion),                                                # not a companion
      (party_get_num_companions, ":stack", "p_main_party"),                              # so the id is not used yet
      (assign, ":count", 0),
      (try_for_range, ":stack_no",1, ":stack"),
          (party_stack_get_troop_id,":troop_id","p_main_party",":stack_no"),
          (this_or_next|eq, ":troop_id", "trp_swadian_knight"),
          (this_or_next|eq, ":troop_id", "trp_vaegir_knight"),
          (this_or_next|eq, ":troop_id", "trp_khergit_lancer"),
          (this_or_next|eq, ":troop_id", "trp_nord_champion"),
          (eq, ":troop_id", "trp_rhodok_sergeant"),
          (val_add, ":count", 1),
      (end_try),
      (gt, ":count", 0),
      (store_add, ":limit", ":count", 1),
      (store_random_in_range, ":rand", 1, ":limit"),
      (assign, ":count", 0),
      (assign, ":found", 0),
      (try_for_range, ":stack_no",1, ":stack"),
          (eq, ":found", 0),
          (party_stack_get_troop_id,":troop_id","p_main_party",":stack_no"),
          (this_or_next|eq, ":troop_id", "trp_swadian_knight"),
          (this_or_next|eq, ":troop_id", "trp_vaegir_knight"),
          (this_or_next|eq, ":troop_id", "trp_khergit_lancer"),
          (this_or_next|eq, ":troop_id", "trp_nord_champion"),
          (eq, ":troop_id", "trp_rhodok_sergeant"),
          (val_add, ":count", 1),
          (eq, ":count", ":rand"),
          (assign, ":found", 1),
          (assign, ":upgraded_troop", ":troop_id"),
      (end_try),
        (troop_set_slot,  ":hero_id", slot_troop_occupation, slto_player_companion),
        (str_store_troop_name,s1,":hero_id"),
        (str_store_troop_name_plural,s2,":upgraded_troop"),
        #(display_message,"@{s1} has been upgraded from the {s2} to the Team leader"),
        (troop_set_slot,":hero_id",hero_inplay,1),            # ##mark him/her as used
        (party_remove_members,"p_main_party",":upgraded_troop",1),      # ##remove the regular troop
        (party_add_members,"p_main_party",":hero_id",1),      # ##Add the hero found
        (tutorial_box,"@You noticed one of your {s13} named {s1} standing out in performance.  Looks like you might have found a companion.  You call him over...","@Team Leader Upgrade"),
        (assign,"$hero_up",":hero_d"),                  # ##Used to mark the dialog for the new hero script
        (assign,"$g_talk_troop",":hero_id"),              # ##for the conversation
        (start_map_conversation,":hero_id"),              # ##Start a dialog with him/her
        # ##At this point you can add a call to a dialog, or any other way to inform the player that
        # ##They now have a hero added to thier party.  This script will prevent more than one of any
        # ##hero type in the party (including if the member is left else where by use of the bus array
        # ##Will have to free up the spot if the hero dies...
      (try_end),
      ]
  ), 

I want to call the script from camp menu, so you inspect the troops and find someone goods, and give him an honor as your new companion.
 
It looks good. But I can't see how you can pick out a swadian hero after the swadian knight has been choosen to be upgraded?

Is it:
Code:
         (troop_set_slot,":hero_id",hero_inplay,1),            # ##mark him/her as used
         (party_remove_members,"p_main_party",":upgraded_troop",1),      # ##remove the regular troop
         (party_add_members,"p_main_party",":hero_id",1),      # ##Add the hero found


I'll make the dialogue, no problem. I don't know how to make a dialogue thou. Just tell me how and I'll give it a shot.
But do you think it would be better to call the script from the camp menu?This way you could get the hero any time you wan't and not once every day. The time could be increased to a week too.

But that can be edited by those who uses it.



EDIT:

I found something else that JIK made that could be useful for when testing this code. It was found in game_menus.py

Code:
##################TESTING MENUS########################################################
	("mod_action",0,   ##Use this menu to test events, mission_templates, scenes, etc.
	 "This MENU is for doing mod testing only.  Should be disabled on release","none",[],
	 [##option Choices
		("search_0",[(set_show_messages, 1)],"City Searching tests",
			[
			 (jump_to_menu, "mnu_search_city"),
			]
		),
		("add_xp",[],"Add XP to fighting troops",
			[(set_show_messages,1),
			 (jump_to_menu, "mnu_xp_test"),
			]
		),
		("cheat0",[(eq,1,1)],"Toggle Mod Cheat",
			[(try_begin),
				(eq,"$mod_cheat",0),
				(assign,"$mod_cheat",1),
				(display_message,"@mod_cheat toggle ON"),
			 (else_try),
				(eq,"$mod_cheat",1),
				(assign,"$mod_cheat",0),
				(display_message,"@mod_cheat toggle OFF"),
			 (try_end),
			]
		),
		("music0",[(eq,1,1)],"Stop Music",
			[(stop_all_sounds,1),
			]
		),
		("music1",[(eq,1,1)],"Play random track",
			[(call_script,"script_fight_music"),
			]
		),
		("back",[(eq,1,1)],"Return to CAMP Menu",
			[
			 (jump_to_menu, "mnu_camp"),
			]
		),
	 

	 ]
	),





	("xp_test",0,
	 "Add XP to the fighting troops","none",[],
	 [##option Choices
		("add_2000",[(eq,1,2)],"Give 2000 XP to Cleaners Class",
			[(call_script,"script_group_xp",2000,"trp_fighter","trp_tinker",1),
			]
		),
		("add_10000",[(eq,1,1)],"Give 10,000 XP to stack 1",
			[(party_add_xp_to_stack, "p_main_party", 1, 10000),
			 (party_stack_get_troop_id,":id","p_main_party",1),
			 (call_script,"script_cf_upgrade_hero",":id"),
			]
		),
		("back",[(eq,1,1)],"Return to Mod Menu",
			[
			 (jump_to_menu, "mnu_mod_action"),
			]
		),
	 

	 ]
	),

Perhaps it can be of any help, too.
 
On the script I sent, I haven't included mechanism to chose troops upgraded based on hero's cultural. It just search if there is any top tier troops and choose randomly to be upgraded. I only make it to be replacement of highlander's kingdom management menu to recruit new lord. So, I make it under kingdom management menu. Yes, you re right. It will be strange if we get a rodhok hero from a swadian knight. Ok, I'll add the feature on my next post.
Offcourse, not every day we can upgrade a troops. There 3 things to limit it:
1. heroes id avaibility
  on module_troops.py, I add several troops, flagged as tf_hero, and slot_troop_occupation = 0. Positioned before kingdom_heroes_end. So in upgrade menu, we must choose, which hero we will 'recruit'. If a hero 's recruited already, then his occupation slot will be player_companion. His name will not appears again in the menu. If all predefined hero 's recruited already, then we can't upgrade anymore. Ok, assumed we then apply a 'permanent dead script' for the heroes, so we can recycle again, reseting his state and make the id available again, but I still havent found a way to remame him.
2. A global variable to save the game hours' last time we 'recruit' the hero, then disable the menu until several weeks.
3. Max compaion/lord that player faction have. I think, highlander's way, limiting lord recruited number according to the fief is good example.

About the dialog, if you have trouble making dialog in module system, it's ok. You only need to make the dialog, I will make them to fits on module_dialogs.py.
Please, make the line like this:
player : hi (name), i saw you doing well on the last battle
troop : thanks, my (lord/lady)
player : ....

Mmm, the last Jik's code you post. Yeah, It's good template to make a master menu to call any menu or script. It can be usefull to modder to test his code. I think you can post the link to transavio's The Guide of Useful Script too.
Ok, I hope I can finish and post the code soon. 
 
dunde said:
On the script I sent, I haven't included mechanism to chose troops upgraded based on hero's cultural. It just search if there is any top tier troops and choose randomly to be upgraded. I only make it to be replacement of highlander's kingdom management menu to recruit new lord. So, I make it under kingdom management menu. Yes, you re right. It will be strange if we get a rodhok hero from a swadian knight. Ok, I'll add the feature on my next post.
Offcourse, not every day we can upgrade a troops. There 3 things to limit it:
1. heroes id avaibility
  on module_troops.py, I add several troops, flagged as tf_hero, and slot_troop_occupation = 0. Positioned before kingdom_heroes_end. So in upgrade menu, we must choose, which hero we will 'recruit'. If a hero 's recruited already, then his occupation slot will be player_companion. His name will not appears again in the menu. If all predefined hero 's recruited already, then we can't upgrade anymore. Ok, assumed we then apply a 'permanent dead script' for the heroes, so we can recycle again, reseting his state and make the id available again, but I still havent found a way to remame him.
2. A global variable to save the game hours' last time we 'recruit' the hero, then disable the menu until several weeks.
3. Max compaion/lord that player faction have. I think, highlander's way, limiting lord recruited number according to the fief is good example.

About the dialog, if you have trouble making dialog in module system, it's ok. You only need to make the dialog, I will make them to fits on module_dialogs.py.
Please, make the line like this:
player : hi (name), i saw you doing well on the last battle
troop : thanks, my (lord/lady)
player : ....

Mmm, the last Jik's code you post. Yeah, It's good template to make a master menu to call any menu or script. It can be usefull to modder to test his code. I think you can post the link to transavio's The Guide of Useful Script too.
Ok, I hope I can finish and post the code soon.


1:
A simple thing is to just name the hero "Legendary Hero/ Warrior". This way you never get a name from the hero but, then again, it wouldn't be fitting if you were to make the hero into a lord :grin:
How ever, if you were not to make the hero into a lord, then you wouldn't have to worry about the name. Just make 5-10 different Culture heroes and make them to be available even if they die. The faces will all be different so I don't think that you'll remember the hero if you don't make some very strange faces :grin:

2.
This is a good idea. Since the hero should be very powerful, you don't want it to be casual to have one. Otherwise, you could just make a trigger to make the script run once every 2 weeks. Then if you already have one hero, add a check to make sure the dialogue won't come up.

3.
You should only be able to have one hero from every faction, or only one special hero over all. To edit the cost for them will be vital, too. They should be expensive to have in your party.

Should the player be the only one to have such a hero,or should every party (Lords) be able to have one?



Dialogue:
(Explanation) When trigger runs and it finds a suitable top tier troop:
Tutorial box: You notice that one of your warriors exceeds your expectations in battle and call him over. ((Explanation)move on to dialogue)

Player: I have seen you fight well in battles, warrior.

Top Tier Troop: I only do my duty to my lord, sire.

Player (Option 1): And well, too. The only time I've heard someone with such skills in battle, it has been in sagas. You are a hero!
Player (Option 2): I just wanted you to know that I take notice in such skills in battle. Now fall back in line! (Return to map)

TTT (Answer to option 1): You honour me with your words. From now on I will do my utter best to honour you words.
TTT (Answer to option 2): Yes Sir! ((Explanation)Return to map)

Player: From now on you shall be remembered as a (Example: Legendary Hero)!

TTT: I will defend my new title to my death and I will not let you down. I promise you this; the the blood on my steel will never dry!

((Explanation)Remove top tier troop and replace with a Culture Hero that matches the correct culture)

The dialogue can be modified by the user if he feels that it's not good enough. But it's a start atleast :grin:
And dunde... Thanks for your help. It's very appreciated.
 
I write this code on my work place with notepad, no module system and MnB to check. So please anybody help me to debug.


First, define 10 new heroes on module_troops.py , put between "merchant20" and #Seneschals :
Code:
##  ["merchant_20","merchant_20_F","merchant_20_F",tf_hero|tf_female, 0,0, fac_merchants,[itm_courser,            itm_arming_sword,       itm_padded_leather,         itm_leather_boots,                          ],              def_attrib|level(15),wp(100),knows_inventory_management_10, 0x000000000010500401f6837d27688212],


###########################################################################
  ["hero1","Swadian Warrior","Swadian Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero2","Vaegir Warrior","Vaegir Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero3","Kerghit Warrior","Kerghit Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero4","Nord Warrior","Nord Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero5","Rodhok Warrior","Rodhok Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero6","Swadian Patriot","Swadian Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero7","Vaegir Patriot","Vaegir Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero8","Kerghit Patriot","Kerghit Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero9","Nord Patriot","Nord Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
  ["hero10","Rodhok Patriot","Rodhok Warriors",tf_hero|tf_unmoveable_in_party_window, 0, reserved, fac_commoners,[itm_khergit_armor,itm_nomad_boots,itm_knife],
   str_8|agi_7|int_12|cha_7|level(3),wp(60),knows_tracker_npc|
   knows_ironflesh_1|knows_power_strike_1|knows_pathfinding_3|knows_athletics_2|knows_tracking_1|knows_riding_2, #skills 2/3 player at that level
   0x00000004bf086143259d061a9046e23500000000001db52c0000000000000000],
###########################################################################
  
#Seneschals
I only copy "trp_npc1" form native. Please feel free to modify the stats and rename them, and it will be better if hero1 and hero6 are given swadian face,
hero2 and hero7 are vaegir faces, etc.

Define new constants on module_constants.py :
Code:
additional_heroes_begin = "trp_hero1"
additional_heroes_end = "trp_town_1_seneschal"

module_scripts.py's change :
Add these lines on "game_start" script :
Code:
  ("game_start",
   [
      ##################################################################
     (troop_set_slot,"trp_hero1", slot_troop_occupation, "trp_swadian_knight"),   # Hero1's occupation before upgraded is Swadian Knight
     (troop_set_slot,"trp_hero2", slot_troop_occupation, "trp_vaegir_knight"),    
     (troop_set_slot,"trp_hero3", slot_troop_occupation, "trp_khergit_lancer"),
     (troop_set_slot,"trp_hero4", slot_troop_occupation, "trp_nord_champion"),    
     (troop_set_slot,"trp_hero5", slot_troop_occupation, "trp_rhodok_sergeant"),    
     (troop_set_slot,"trp_hero6", slot_troop_occupation, "trp_swadian_knight"),
     (troop_set_slot,"trp_hero7", slot_troop_occupation, "trp_vaegir_knight"),    
     (troop_set_slot,"trp_hero8", slot_troop_occupation, "trp_khergit_lancer"),
     (troop_set_slot,"trp_hero9", slot_troop_occupation, "trp_nord_champion"),    
     (troop_set_slot,"trp_hero10", slot_troop_occupation, "trp_rhodok_sergeant"),
     (assign, "$g_upgrade_time", 336), # 2 weeks for 1st upgrade call
     ##################################################################
     ## TEST ONLY : COMMENT for farther use
     (assign, "$g_upgrade_time", 10), # 24 hours for 1st call
     (party_add_members,"p_main_party","trp_swadian_knight",2),
     (party_add_members,"p_main_party","trp_vaegir_knight",2),
     (party_add_members,"p_main_party","trp_khergit_lancer",2),
     (party_add_members,"p_main_party","trp_nord_champion",2),
     (party_add_members,"p_main_party","trp_rhodok_sergeant",2),
     (add_xp_to_troop, 100000, "trp_player"),
     ##################################################################

Main Script, I make it slimmer, taking away all checking removing the cf(can fail), assumed that this script only called from our menu.
Put before last ]
Code:
   # ##script_upgrade_troop_to_hero
   # ##usage   : (call_script,"script_upgrade_troop_to_hero",<troop_ID>,<hero_ID>),
   # ##Input 1 : <troop_ID> should be one of troop_id of top tier troop
   # ##Input 2 : <hero_ID> should be one of troop_id of inactive hero on module_troops.py
   # ##This must be passed.  The code block calling this script should have already checked if there is that troop.
   # ##Output: None, will adjust p_main_party
   # ##May call a dialog to communicate this happening
   ("upgrade_troop_to_hero",
      [(store_script_param,":troop_id",1),
       (store_script_param,":hero_id",2),
       (try_begin),
          (main_party_has_troop, ":troop_id"),
          (troop_slot_eq, ":hero_id", slot_troop_occupation, ":troop_id"),
          (troop_set_slot,":hero_id", slot_troop_occupation, slto_player_companion),
          (party_remove_members,"p_main_party",":troop_id",1),      # ##remove the regular troop
          (party_add_members,"p_main_party",":hero_id",1),          # ##Add the hero found
       (try_end),
      ]),

The Menu, called by trigger
on module_game_menus.py, before last ] :
Code:
###########################################################################
  ("upgrade_to_hero",0,
   "You notice that one or more of your warriors exceeds your expectations in battle. ^You 're walking to the lines of your troops, and ...",
   "none",
   [
       (assign, reg11, 0), # sub menu 1
       (assign, reg12, 0), # sub menu 2
       (assign, reg13, 0), # sub menu 3
       (assign, reg14, 0), # sub menu 4
       (assign, "$g_upgrade_talk", 0),
     ],
    [
      ("hero_1",
      [         
         (assign, ":limit", reg10), 
         (assign, ":found", 0),
         (try_for_range, ":hero_id", ":limit", additional_heroes_end),
            (eq, ":found", 0),
            (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
            (gt, ":hero_ocu", 0),
            (neq, ":hero_ocu",slto_kingdom_hero),
            (neq, ":hero_ocu",slto_player_companion),
            (main_party_has_troop, ":hero_ocu"),
            (assign, ":found", 1),
            (assign, reg11, ":hero_id"),
         (try_end),
         (eq, ":found", 1),
         (str_store_troop_name,s1,reg11),
      ],"stop, talking to {s1}",
       [
           (assign, ":hero_id", reg11), 
           (troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
           (assign, reg20, ":troop_id"),
           (assign, reg21, ":hero_id"),
           (assign, "$g_upgrade_talk", 1),
           (start_map_conversation, ":troop_id"),
           (change_screen_return),
        ]
       ),
      ("hero_2",
      [         
         (ge, reg11, reg10),
         (store_add, ":limit", reg11, 1),
         (assign, ":found", 0),         
         (try_for_range, ":hero_id", ":limit", additional_heroes_end),
            (eq, ":found", 0),
            (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
            (gt, ":hero_ocu", 0),
            (neq, ":hero_ocu",slto_kingdom_hero),
            (neq, ":hero_ocu",slto_player_companion),
            (main_party_has_troop, ":hero_ocu"),
            (assign, ":found", 1),
            (assign, reg12, ":hero_id"),
         (try_end),
         (eq, ":found", 1),
         (str_store_troop_name,s1,reg12),
      ],"stop, talking to {s1}",
       [
           (assign, ":hero_id", reg12), 
           (troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
           (assign, reg20, ":troop_id"),
           (assign, reg21, ":hero_id"),
           (assign, "$g_upgrade_talk", 1),
           (start_map_conversation, ":troop_id"),
           (change_screen_return),
        ]
       ),
      ("hero_3",
      [         
         (gt, reg12, reg11),
         (store_add, ":limit", reg12, 1),
         (assign, ":found", 0),         
         (try_for_range, ":hero_id", ":limit", additional_heroes_end),
            (eq, ":found", 0),
            (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
            (gt, ":hero_ocu", 0),
            (neq, ":hero_ocu",slto_kingdom_hero),
            (neq, ":hero_ocu",slto_player_companion),
            (main_party_has_troop, ":hero_ocu"),
            (assign, ":found", 1),
            (assign, reg13, ":hero_id"),
         (try_end),
         (eq, ":found", 1),
         (str_store_troop_name,s1,reg13),
      ],"stop, talking to {s1}",
       [
           (assign, ":hero_id", reg13), 
           (troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
           (assign, reg20, ":troop_id"),
           (assign, reg21, ":hero_id"),
           (assign, "$g_upgrade_talk", 1),
           (start_map_conversation, ":troop_id"),
           (change_screen_return),
        ]
       ),
      ("hero_4",
      [         
         (gt, reg13, reg12),
         (store_add, ":limit", reg13, 1),
         (assign, ":found", 0),         
         (try_for_range, ":hero_id", ":limit", additional_heroes_end),
            (eq, ":found", 0),         
            (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
            (gt, ":hero_ocu", 0),
            (neq, ":hero_ocu",slto_kingdom_hero),
            (neq, ":hero_ocu",slto_player_companion),
            (main_party_has_troop, ":hero_ocu"),
            (assign, ":found", 1),
            (assign, reg14, ":hero_id"),
         (try_end),
         (eq, ":found", 1),
         (str_store_troop_name,s1,reg14),
      ],"stop, talking to {s1}",
       [
           (assign, ":hero_id", reg14), 
           (troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
           (assign, reg20, ":troop_id"),
           (assign, reg21, ":hero_id"),
           (assign, "$g_upgrade_talk", 1),
           (start_map_conversation, ":troop_id"),
           (change_screen_return),
        ]
       ),
      ("prev",
      [
          (gt, reg10, additional_heroes_begin),
          (assign, ":limit", reg10),
          (assign, ":found", 0),         
          (try_for_range_backwards, ":hero_id", ":limit", additional_heroes_begin),
             (lt, ":found", 4),          
             (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
             (gt, ":hero_ocu", 0),
             (neq, ":hero_ocu",slto_kingdom_hero),
             (neq, ":hero_ocu",slto_player_companion),
             (main_party_has_troop, ":hero_ocu"),
             (assign, reg15, ":hero_id"), 
             (val_add, ":found", 1),
         (try_end),
         (gt, ":found", 0),          
      ],"go to prev lines",
       [
          (assign, reg10, reg15),
          (jump_to_menu, "mnu_upgrade_to_hero"),
        ]
       ),
      ("next",
      [
          (gt, reg14, reg13),
          (store_add, ":limit", reg14, 1),
          (assign, ":found", 0),         
          (try_for_range, ":hero_id", ":limit", additional_heroes_end),
             (eq, ":found", 0),          
             (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
             (gt, ":hero_ocu", 0),
             (neq, ":hero_ocu",slto_kingdom_hero),
             (neq, ":hero_ocu",slto_player_companion),
             (main_party_has_troop, ":hero_ocu"),
             (assign, ":found", 1),
         (try_end),
         (eq, ":found", 1),          
      ],"go to next lines",
       [
           (store_add, reg10, reg14, 1),
           (jump_to_menu, "mnu_upgrade_to_hero"),
        ]
       ),
      ("close",
      [
       ],"close",
       [
          (assign, "$g_upgrade_talk", 1), 
          (change_screen_map),
       ]
      ),
    ]  
  ),
###########################################################################

Here you are your dialogs. Put it under dialog = [ on module_dialogs.py. I'm not sure about the initial state. Is it "start" or "event_triggered", I'll test it when I have module_system.
Code:
dialogs = [
###########################################################################
	[anyone,
		"event_triggered",
		[
			(store_conversation_troop,"$g_talk_troop"),
			#(is_between,"$g_talk_troop", additional_heroes_begin, additional_heroes_end),
                        (eq, "$g_talk_troop", reg20),
			(eq, "$g_upgrade_talk", 1),
                        (troop_get_type, reg65, "trp_player"),
                        (str_store_string,s65,"@{reg65?my Lady:my Lord}"),
                        (str_store_troop_name,s21,reg21),
		],
		"Yes, {s65}?",
		"upgrade_talk",
		[]
	],
       [anyone|plyr,
		"upgrade_talk",
		[],
		"I have seen you fight well in battles, soldier.",
		"upgrade_talk_1",
		[]
	],
        [anyone,
		"upgrade_talk_1",
		[
		],
		"I only do my duty to {s65}, sire.",
		"upgrade_talk_2",
		[]
      	],
         [anyone|plyr,
		"upgrade_talk_2",
		[],
		"And well, too. The only time I've heard someone with such skills in battle, it has been in sagas. You are a hero!",
		"upgrade_talk_3a",
		[]
      	],          
         [anyone|plyr,
		"upgrade_talk_2",
		[],
		"I just wanted you to know that I take notice in such skills in battle. Now fall back in line!",
		"upgrade_talk_3b",
		[]
      	],
	[anyone,
		"upgrade_talk_3a",
		[
		],
		"You honour me with your words. From now on I will do my utter best to honour you words.",
		"upgrade_talk_4a",
		[]
      	],
         [anyone|plyr,
		"upgrade_talk_4a",
		[],
		"From now on you shall be remembered as a {s21}",
		"upgrade_talk_5",
		[]
      	],
	[anyone,
		"upgrade_talk_5",
		[
                    (call_script,"script_upgrade_troop_to_hero", reg20, reg21),
		],
		"I will defend my new title to my death and I will not let you down. I promise you this; the the blood on my steel will never dry!",
		"close_window",
		[]
      	],         
	[anyone,
		"upgrade_talk_3b",
		[
		],
		"Yes, {s65}",
		"close_window",
		[]
	],      
###########################################################################

Ok,I follow your way, I make it called by timed trigger, but I make the interval is not fixed 14 days, but random 14-21 days.
Then, optional from me, I think it will be more balanced if we put more limitation, only player reached 15 level can recruit new hero
on module_simple_triggers.py :
Code:
  (24,
   [
      #################################################################
      ## LEVEL CHECK BEGIN 
      ## Comment to disable LEVEL CHECK 
      (store_character_level, ":level", "trp_player"),   
      (ge, ":level", 15),
      ## LEVEL CHECK END
      #################################################################
      (store_current_hours,":now"),  
      (ge, ":now", "$g_upgrade_time"),
      (store_random_in_range, ":rand", 14, 22),         ## Next Call 14 - 21 days ahead    
      (val_mul, ":rand", 24),
      (val_add, ":rand", ":now"),
      (assign, "$g_upgrade_time"),
      (assign, reg10, additional_heroes_begin),
      (jump_to_menu, "mnu_upgrade_to_hero"),
    ]), 
 
This code is untested. I'll test it soon, and update if there's error on it.
       
 
I tried out the code, but it gave me some errors:

Initializing...
Traceback (most recent call last):
  File "process_global_variables.py", line 5, in <module>
    from module_triggers import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_triggers.py", line 9, in <module>
    from module_constants import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_constants.py", line 1059, in <module>
    additional_heroes_end = last_hero + 1
TypeError: cannot concatenate 'str' and 'int' objects
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Traceback (most recent call last):
  File "process_map_icons.py", line 3, in <module>
    from module_map_icons import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_map_icons.py", line 2, in <module>
    from module_constants import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_constants.py", line 1059, in <module>
    additional_heroes_end = last_hero + 1
TypeError: cannot concatenate 'str' and 'int' objects
Exporting faction data...
Traceback (most recent call last):
  File "process_items.py", line 4, in <module>
    from module_items import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_items.py", line 1, in <module>
    from module_constants import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_constants.py", line 1059, in <module>
    additional_heroes_end = last_hero + 1
TypeError: cannot concatenate 'str' and 'int' objects
Traceback (most recent call last):
  File "process_scenes.py", line 2, in <module>
    from module_scenes import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_scenes.py", line 5, in <module>
    from module_constants import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_constants.py", line 1059, in <module>
    additional_heroes_end = last_hero + 1
TypeError: cannot concatenate 'str' and 'int' objects
Exporting troops data
Exporting particle data...
Traceback (most recent call last):
  File "process_scene_props.py", line 4, in <module>
    from module_scene_props import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_scene_props.py", line 6, in <module>
    from module_constants import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_constants.py", line 1059, in <module>
    additional_heroes_end = last_hero + 1
TypeError: cannot concatenate 'str' and 'int' objects
Traceback (most recent call last):
  File "process_tableau_materials.py", line 5, in <module>
    from module_tableau_materials import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_tableau_materials.py", line 6, in <module>
    from module_constants import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_constants.py", line 1059, in <module>
    additional_heroes_end = last_hero + 1
TypeError: cannot concatenate 'str' and 'int' objects
Traceback (most recent call last):
  File "process_presentations.py", line 4, in <module>
    from module_presentations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_presentations.py", line 7, in <module>
    from module_constants import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_constants.py", line 1059, in <module>
    additional_heroes_end = last_hero + 1
TypeError: cannot concatenate 'str' and 'int' objects
Exporting party_template data...
Traceback (most recent call last):
  File "process_parties.py", line 4, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 9986
    ],"stop, talking to {s1}",,
                              ^
SyntaxError: invalid syntax
Exporting quest data...
Traceback (most recent call last):
  File "process_scripts.py", line 4, in <module>
    from module_scripts import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_scripts.py", line 4, in <module>
    from module_constants import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_constants.py", line 1059, in <module>
    additional_heroes_end = last_hero + 1
TypeError: cannot concatenate 'str' and 'int' objects
Traceback (most recent call last):
  File "process_mission_tmps.py", line 5, in <module>
    from module_mission_templates import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_mission_templates.py", line 7, in <module>
    from module_constants import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_constants.py", line 1059, in <module>
    additional_heroes_end = last_hero + 1
TypeError: cannot concatenate 'str' and 'int' objects
Traceback (most recent call last):
  File "process_game_menus.py", line 5, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 9986
    ],"stop, talking to {s1}",,
                              ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_simple_triggers.py", line 2, in <module>
    from module_simple_triggers import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_simple_triggers.py", line 10, in <module>
    from module_constants import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_constants.py", line 1059, in <module>
    additional_heroes_end = last_hero + 1
TypeError: cannot concatenate 'str' and 'int' objects
Traceback (most recent call last):
  File "process_dialogs.py", line 5, in <module>
    from module_triggers import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_triggers.py", line 9, in <module>
    from module_constants import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_constants.py", line 1059, in <module>
    additional_heroes_end = last_hero + 1
TypeError: cannot concatenate 'str' and 'int' objects
Traceback (most recent call last):
  File "process_global_variables_unused.py", line 3, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 13, in <module>
    from module_items import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_items.py", line 1, in <module>
    from module_constants import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_constants.py", line 1059, in <module>
    additional_heroes_end = last_hero + 1
TypeError: cannot concatenate 'str' and 'int' objects

______________________________

Script processing has ended.
Press any key to exit. . .

Perhaps it will work if I removed the + 1 in module constants?
I'll try and see what it gives me.



EDIT:

Didn't work out. I gives me alot of syntax errors. At first it gave me this:
Initializing...
Traceback (most recent call last):
  File "process_global_variables.py", line 6, in <module>
    from module_dialogs import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_dialogs.py", line 12550

    ^
SyntaxError: invalid syntax
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Traceback (most recent call last):
  File "process_map_icons.py", line 6, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10040
    ],"stop, talking to {s1}",,
                              ^
SyntaxError: invalid syntax
Exporting faction data...
Exporting item data...
Traceback (most recent call last):
  File "process_items.py", line 59, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10040
    ],"stop, talking to {s1}",,
                              ^
SyntaxError: invalid syntax
Exporting scene data...
Traceback (most recent call last):
  File "process_scenes.py", line 15, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10040
    ],"stop, talking to {s1}",,
                              ^
SyntaxError: invalid syntax
Exporting troops data
Exporting particle data...
Traceback (most recent call last):
  File "process_scene_props.py", line 7, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10040
    ],"stop, talking to {s1}",,
                              ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_tableau_materials.py", line 8, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10040
    ],"stop, talking to {s1}",,
                              ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_presentations.py", line 8, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10040
    ],"stop, talking to {s1}",,
                              ^
SyntaxError: invalid syntax
Exporting party_template data...
Traceback (most recent call last):
  File "process_parties.py", line 4, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10040
    ],"stop, talking to {s1}",,
                              ^
SyntaxError: invalid syntax
Exporting quest data...
Traceback (most recent call last):
  File "process_scripts.py", line 7, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10040
    ],"stop, talking to {s1}",,
                              ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_mission_tmps.py", line 8, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10040
    ],"stop, talking to {s1}",,
                              ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_game_menus.py", line 5, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10040
    ],"stop, talking to {s1}",,
                              ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_simple_triggers.py", line 2, in <module>
    from module_simple_triggers import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_simple_triggers.py", line 2639, in <module>
    (jump_to_menu, "mnu_upgrade_to_hero"),
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_dialogs.py", line 6, in <module>
    from module_dialogs import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_dialogs.py", line 12550

    ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_global_variables_unused.py", line 3, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10040
    ],"stop, talking to {s1}",,
                              ^
SyntaxError: invalid syntax

______________________________

Script processing has ended.
Press any key to exit. . .
So I looked it up and removed a (,) in:

Code:
      ("hero_4",
      [         
         (gt, reg13, reg12),
         (store_add, ":limit", reg13, 1),
         (assign, ":found", 0),         
         (try_for_range, ":hero_id", ":limit", additional_heroes_end),
            (eq, ":found", 0),         
            (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
            (gt, ":hero_ocu", 0),
            (neq, ":hero_ocu",slto_kingdom_hero),
            (neq, ":hero_ocu",slto_player_companion),
            (main_party_has_troop, ":hero_ocu"),
            (assign, ":found", 1),
            (assign, reg14, ":hero_id"),
         (try_end),
         (eq, ":found", 1),
         (str_store_troop_name,s1,reg14),
      ],"stop, talking to {s1}",,                                    <-----------------------------------
       [
           (assign, ":hero_id", reg14),
           (troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
           (assign, reg20, ":troop_id"),
           (assign, reg21, ":hero_id"),
           (assign, "$g_upgrade_talk", 1),
           (start_map_conversation, ":troop_id"),
        ]
       ),

Then when I removed it it gave me:
Initializing...
Traceback (most recent call last):
  File "process_global_variables.py", line 6, in <module>
    from module_dialogs import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_dialogs.py", line 12550

    ^
SyntaxError: invalid syntax
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Traceback (most recent call last):
  File "process_map_icons.py", line 6, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10055
    (try_for_range_backwards ":hero_id", ":limit", additional_hero_begin),
                                      ^
SyntaxError: invalid syntax
Exporting faction data...
Exporting item data...
Traceback (most recent call last):
  File "process_items.py", line 59, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10055
    (try_for_range_backwards ":hero_id", ":limit", additional_hero_begin),
                                      ^
SyntaxError: invalid syntax
Exporting scene data...
Traceback (most recent call last):
  File "process_scenes.py", line 15, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10055
    (try_for_range_backwards ":hero_id", ":limit", additional_hero_begin),
                                      ^
SyntaxError: invalid syntax
Exporting troops data
Exporting particle data...
Traceback (most recent call last):
  File "process_scene_props.py", line 7, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10055
    (try_for_range_backwards ":hero_id", ":limit", additional_hero_begin),
                                      ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_tableau_materials.py", line 8, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10055
    (try_for_range_backwards ":hero_id", ":limit", additional_hero_begin),
                                      ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_presentations.py", line 8, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10055
    (try_for_range_backwards ":hero_id", ":limit", additional_hero_begin),
                                      ^
SyntaxError: invalid syntax
Exporting party_template data...
Traceback (most recent call last):
  File "process_parties.py", line 4, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10055
    (try_for_range_backwards ":hero_id", ":limit", additional_hero_begin),
                                      ^
SyntaxError: invalid syntax
Exporting quest data...
Traceback (most recent call last):
  File "process_scripts.py", line 7, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10055
    (try_for_range_backwards ":hero_id", ":limit", additional_hero_begin),
                                      ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_mission_tmps.py", line 8, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10055
    (try_for_range_backwards ":hero_id", ":limit", additional_hero_begin),
                                      ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_game_menus.py", line 5, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10055
    (try_for_range_backwards ":hero_id", ":limit", additional_hero_begin),
                                      ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_simple_triggers.py", line 2, in <module>
    from module_simple_triggers import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_simple_triggers.py", line 2639, in <module>
    (jump_to_menu, "mnu_upgrade_to_hero"),
TypeError: 'tuple' object is not callable
Traceback (most recent call last):
  File "process_dialogs.py", line 6, in <module>
    from module_dialogs import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_dialogs.py", line 12550

    ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File "process_global_variables_unused.py", line 3, in <module>
    from process_operations import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\proc
ess_operations.py", line 22, in <module>
    from module_game_menus import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_game_menus.py", line 10055
    (try_for_range_backwards ":hero_id", ":limit", additional_hero_begin),
                                      ^
SyntaxError: invalid syntax

______________________________

Script processing has ended.
Press any key to exit. . .

But it looks like this in the build:
    (try_for_range_backwards ":hero_id", ":limit", additional_hero_begin),
                                                            ^

At this point I have no idea of what to do. It's a native module and a clean one. Maybe the (") should be moved to another place?
Like :"hero_id",  -    ":hero_id,"
 
I'm sorry for some syntax errors and missing ].
I have fixed them all and compiled it at my PC. But I have no internet connection at home, only from very slow gprs, so I can't upload now.
I ll upload it tomorrow.

The edited version works perfectly, I hope my gprs signal is strong enough to modify my prev post now.


EDIT :
OK, I update it. Working version uploaded. And confirmed, it is "event_triggered" state for dialogs.
 
Tried it but it still gives me some errors.

Initializing...
Traceback (most recent call last):
  File "process_global_variables.py", line 7, in <module>
    from module_simple_triggers import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_simple_triggers.py", line 2639, in <module>
    (jump_to_menu, "mnu_upgrade_to_hero"),
TypeError: 'tuple' object is not callable
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Exporting map icons...
Creating new tag_uses.txt file...
Creating new quick_strings.txt file...
Exporting faction data...
Exporting item data...
Exporting scene data...
Exporting troops data
Exporting particle data...
Exporting scene props...
Exporting tableau materials data...
Exporting presentations...
Exporting party_template data...
Exporting parties
Exporting quest data...
Exporting scripts...
WARNING: Usage of unassigned global variable: $g_upgrade_time
WARNING: Usage of unassigned global variable: $g_upgrade_time
Exporting mission_template data...
Exporting game menus data...
WARNING: Usage of unassigned global variable: $g_upgrade_talk
WARNING: Usage of unassigned global variable: $g_upgrade_talk
WARNING: Usage of unassigned global variable: $g_upgrade_talk
WARNING: Usage of unassigned global variable: $g_upgrade_talk
WARNING: Usage of unassigned global variable: $g_upgrade_talk
WARNING: Usage of unassigned global variable: $g_upgrade_talk
Traceback (most recent call last):
  File "process_simple_triggers.py", line 2, in <module>
    from module_simple_triggers import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_simple_triggers.py", line 2639, in <module>
    (jump_to_menu, "mnu_upgrade_to_hero"),
TypeError: 'tuple' object is not callable
exporting triggers...
exporting dialogs...
WARNING: Usage of unassigned global variable: $g_upgrade_talk
Checking global variable usages...
WARNING: Global variable never used: $g_upgrade_time
WARNING: Global variable never used: $g_upgrade_time
WARNING: Global variable never used: $g_upgrade_talk
WARNING: Global variable never used: $g_upgrade_talk
WARNING: Global variable never used: $g_upgrade_talk
WARNING: Global variable never used: $g_upgrade_talk
WARNING: Global variable never used: $g_upgrade_talk
WARNING: Global variable never used: $g_upgrade_talk
WARNING: Global variable never used: $g_upgrade_talk

______________________________

Script processing has ended.
Press any key to exit. . .

I did exactly like you said. I'll check it out again, just to make sure thou.
 
What comma, at what line?



I get it now. I read to fast.
You mean that I have forgotten a comma on the line before, right?


Code:
  (24,
   [
      #################################################################
      ## LEVEL CHECK BEGIN
      ## Comment to disable LEVEL CHECK
      (store_character_level, ":level", "trp_player"),   
      (ge, ":level", 15),
      ## LEVEL CHECK END
      #################################################################
      (store_current_hours,":now"), 
      (ge, ":now", "$g_upgrade_time"),
      (store_random_in_range, ":rand", 14, 22),         ## Next Call 14 - 21 days ahead   
      (val_mul, ":rand", 24),
      (val_add, ":rand", ":now"),
      (assign, "$g_upgrade_time"),
      (assign, reg10, additional_heroes_begin),  <------------- on this line right? But I can't see where the comma should go.
      (jump_to_menu, "mnu_upgrade_to_hero"),
    ]), 
 
I updated the code on 1st page. No, not at the point, but on (try_for_range_backwards,
And so many missing ] on menu and dialog.
Fixed now.
Error on what you point caused by invalid constants.
 
Hmm, still the same error. I dont get it.


Traceback (most recent call last):
  File "process_global_variables.py", line 7, in <module>
    from module_simple_triggers import *
  File "C:\Program\Mount&Blade\Modules\Kopia av Native\ModuleSystem\Pyfiles\modu
le_simple_triggers.py", line 2639, in <module>
    (jump_to_menu, "mnu_upgrade_to_hero"),
TypeError: 'tuple' object is not callable



What does that mean? That it can't jump to the menu? Why should that be a problem? The only thing that I can see that doesn't make sense is:


  ("upgrade_to_hero",0,
  "You notice that one or more of your warriors exceeds your expectations in battle. ^You 're walking to the lines of your troops, and ...",
  "none",
  [
      (assign, reg11, 0), # sub menu 1
      (assign, reg12, 0), # sub menu 2
      (assign, reg13, 0), # sub menu 3
      (assign, reg14, 0), # sub menu 4
      (assign, "$g_upgrade_talk", 0),
    ],
    [
      ("hero_1",
      [       
        (assign, ":limit", reg10),
        (assign, ":found", 0),
        (try_for_range, ":hero_id", ":limit", additional_heroes_end),
            (eq, ":found", 0),
            (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
            (gt, ":hero_ocu", 0),
            (neq, ":hero_ocu",slto_kingdom_hero),
            (neq, ":hero_ocu",slto_player_companion),
            (main_party_has_troop, ":hero_ocu"),
            (assign, ":found", 1),
            (assign, reg11, ":hero_id"),
        (try_end),
        (eq, ":found", 1),
        (str_store_troop_name,s1,reg11),
      ],"stop, talking to {s1}",
      [
          (assign, ":hero_id", reg11),
          (troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
          (assign, reg20, ":troop_id"),
          (assign, reg21, ":hero_id"),
          (assign, "$g_upgrade_talk", 1),
          (start_map_conversation, ":troop_id"),
          (change_screen_return),
        ]
      ),
      ("hero_2",
      [       
        (ge, reg11, reg10),
        (store_add, ":limit", reg11, 1),
        (assign, ":found", 0),       
        (try_for_range, ":hero_id", ":limit", additional_heroes_end),
            (eq, ":found", 0),
            (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
            (gt, ":hero_ocu", 0),
            (neq, ":hero_ocu",slto_kingdom_hero),
            (neq, ":hero_ocu",slto_player_companion),
            (main_party_has_troop, ":hero_ocu"),
            (assign, ":found", 1),
            (assign, reg12, ":hero_id"),
        (try_end),
        (eq, ":found", 1),
        (str_store_troop_name,s1,reg12),
      ],"stop, talking to {s1}",
      [
          (assign, ":hero_id", reg12),
          (troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
          (assign, reg20, ":troop_id"),
          (assign, reg21, ":hero_id"),
          (assign, "$g_upgrade_talk", 1),
          (start_map_conversation, ":troop_id"),
          (change_screen_return),
        ]
      ),
      ("hero_3",
      [       
        (gt, reg12, reg11),
        (store_add, ":limit", reg12, 1),
        (assign, ":found", 0),       
        (try_for_range, ":hero_id", ":limit", additional_heroes_end),
            (eq, ":found", 0),
            (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
            (gt, ":hero_ocu", 0),
            (neq, ":hero_ocu",slto_kingdom_hero),
            (neq, ":hero_ocu",slto_player_companion),
            (main_party_has_troop, ":hero_ocu"),
            (assign, ":found", 1),
            (assign, reg13, ":hero_id"),
        (try_end),
        (eq, ":found", 1),
        (str_store_troop_name,s1,reg13),
      ],"stop, talking to {s1}",
      [
          (assign, ":hero_id", reg13),
          (troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
          (assign, reg20, ":troop_id"),
          (assign, reg21, ":hero_id"),
          (assign, "$g_upgrade_talk", 1),
          (start_map_conversation, ":troop_id"),
          (change_screen_return),
        ]
      ),
      ("hero_4",
      [       
        (gt, reg13, reg12),
        (store_add, ":limit", reg13, 1),
        (assign, ":found", 0),       
        (try_for_range, ":hero_id", ":limit", additional_heroes_end),
            (eq, ":found", 0),       
            (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
            (gt, ":hero_ocu", 0),
            (neq, ":hero_ocu",slto_kingdom_hero),
            (neq, ":hero_ocu",slto_player_companion),
            (main_party_has_troop, ":hero_ocu"),
            (assign, ":found", 1),
            (assign, reg14, ":hero_id"),
        (try_end),
        (eq, ":found", 1),
        (str_store_troop_name,s1,reg14),
      ],"stop, talking to {s1}",
      [
          (assign, ":hero_id", reg14),
          (troop_get_slot, ":troop_id", ":hero_id", slot_troop_occupation),
          (assign, reg20, ":troop_id"),
          (assign, reg21, ":hero_id"),
          (assign, "$g_upgrade_talk", 1),
          (start_map_conversation, ":troop_id"),
          (change_screen_return),
        ]
      ),
      ("prev",
      [
          (gt, reg10, additional_heroes_begin),
          (assign, ":limit", reg10),
          (assign, ":found", 0),       
          (try_for_range_backwards, ":hero_id", ":limit", additional_heroes_begin),
            (lt, ":found", 4),       
            (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
            (gt, ":hero_ocu", 0),
            (neq, ":hero_ocu",slto_kingdom_hero),
            (neq, ":hero_ocu",slto_player_companion),
            (main_party_has_troop, ":hero_ocu"),
            (assign, reg15, ":hero_id"),
            (val_add, ":found", 1),
        (try_end),
        (gt, ":found", 0),       
      ],"go to prev lines",
      [
          (assign, reg10, reg15),
          (jump_to_menu, "mnu_upgrade_to_hero"),
        ]
      ),
      ("next",
      [
          (gt, reg14, reg13),
          (store_add, ":limit", reg14, 1),
          (assign, ":found", 0),       
          (try_for_range, ":hero_id", ":limit", additional_heroes_end),
            (eq, ":found", 0),       
            (troop_get_slot, ":hero_ocu", ":hero_id", slot_troop_occupation),
            (gt, ":hero_ocu", 0),
            (neq, ":hero_ocu",slto_kingdom_hero),
            (neq, ":hero_ocu",slto_player_companion),
            (main_party_has_troop, ":hero_ocu"),
            (assign, ":found", 1),
        (try_end),
        (eq, ":found", 1),       
      ],"go to next lines",
      [
          (store_add, reg10, reg14, 1),
          (jump_to_menu, "mnu_upgrade_to_hero"),
        ]
      ),
      ("close",
      [
      ],"close",
      [
          (assign, "$g_upgrade_talk", 1),
          (change_screen_map),
      ]
      ),
    ]
  ),


Why call the menu from the menu you are in? I don't see a reason to call the menu from the menu. That means that you can't leave it, right?
 
Back
Top Bottom