OSP Code QoL Dynamic Kingdom Troop Tree Presentation

Users who are viewing this thread

Why don't you add more faction in this code, like: outlaws faction, player faction (maybe this's impossible),... :grin:
 
NewBie-BR said:
Why don't you add more faction in this code, like: outlaws faction, player faction (maybe this's impossible),... :grin:
You can do it just by copy pasting the script, and set the lowest tier troops of other faction here :
  # lowest troop tiers initialization BEGIN
  (troop_set_slot, "trp_temp_array_a", 0, 1),          # Number of Lowest Tier Troop
  (troop_set_slot, "trp_temp_array_a", 1, 1),          # 1 for 1st troop
  (troop_set_slot, "trp_temp_array_b", 1, ":troop_no"), # 1st troop id
  # lowest troop tiers initialization END

The limitation is that the code doesn't support trees with merging upgrade lines like camp follower that natively is upgraded target from peasant woman and refugee.
 
dunde said:
NewBie-BR said:
Why don't you add more faction in this code, like: outlaws faction, player faction (maybe this's impossible),... :grin:
You can do it just by copy pasting the script, and set the lowest tier troops of other faction here :
  # lowest troop tiers initialization BEGIN
  (troop_set_slot, "trp_temp_array_a", 0, 1),          # Number of Lowest Tier Troop
  (troop_set_slot, "trp_temp_array_a", 1, 1),          # 1 for 1st troop
  (troop_set_slot, "trp_temp_array_b", 1, ":troop_no"), # 1st troop id
  # lowest troop tiers initialization END

The limitation is that the code doesn't support trees with merging upgrade lines like camp follower that natively is upgraded target from peasant woman and refugee.
Thank you pro
 
Thanks again for the great code/system dunde. I was looking for something to tinker with, so I tried thinking through the merging lines problem. This is what I've come up with. (NOTE - This is under the assumption that the 'merge' happens in and from the same tiers--that merged troop is Tier X and the two troops that upgrade into the same troop are both Tier X-1 ; I've not found a good way to loosen this assumption, but I think it holds true in most trees I have seen that have 'merging' lines.)

See lines/blocks marked "#Caba"
You'll also note I tried to add some rough comments/explanations as I was thinking through your code...for whatever those are worth
Code:
("prsnt_culture_troop_tree",
 [(store_script_param_1, ":culture"),
  (store_sub, ":num", ":culture", fac_culture_1), (val_mod, ":num", 6),
  (store_add, ":slot",  ":num","mesh_pic_arms_swadian"),
  (create_mesh_overlay, reg0, ":slot"),
  (store_add, ":slot", ":num", "mesh_pic_swad"),
  (create_mesh_overlay, reg1, ":slot"),
  (position_set_x, pos1, 180),(position_set_y, pos1, 560),
  (position_set_x, pos2, 500),(position_set_y, pos2, 25),      
  (position_set_x, pos3, 500),(position_set_y, pos3, 500),
  (overlay_set_position, reg0, pos1), (overlay_set_size, reg0, pos3),      
  (overlay_set_position, reg1, pos2), (overlay_set_size, reg1, pos3),       
  (try_for_range, ":slot", 0, 61),
     (troop_set_slot, "trp_temp_array_a", ":slot", 0),
     (troop_set_slot, "trp_temp_array_b", ":slot", 0),
     (troop_set_slot, "trp_temp_array_c", ":slot", 0),
     (store_add, ":num", ":slot", 100), #Caba - was missing ":slot"
     (troop_set_slot, "trp_temp_array_b", ":num", -1),
     (troop_set_slot, "trp_temp_array_c", ":num", -1),
  (try_end),
  #try-else block here to get 'troop-no' (or above) for non-kingdom trees
  (faction_get_slot, ":troop_no", ":culture", slot_faction_tier_1_troop),
  # lowest troop tiers initialization BEGIN 
  (troop_set_slot, "trp_temp_array_a", 0, 1),           # Number of Lowest Tier Troop
  (troop_set_slot, "trp_temp_array_a", 1, 1),           # 1 for 1st troop
  (troop_set_slot, "trp_temp_array_b", 1, ":troop_no"), # 1st troop id
  # lowest troop tiers initialization END 
  (assign, ":max_tier", 0), (assign, ":no_tier", 0),
  ## Calculates number of tiers--":max_tiers" and number of branches (more or less)
  (try_for_range, ":tier", 1, 10),                      # Asuming that you wont make troop tree more than 10 tiers
     (eq, ":no_tier", 0),
     (assign, ":no_tier", 1),
     (store_sub, ":prev_tier", ":tier", 1),
     (store_mul, ":slot_for_prev_num", ":prev_tier", 10),
     (store_mul, ":slot_for_num", ":tier", 10),
     (assign, ":num", 0),
     (troop_get_slot, ":prev_num", "trp_temp_array_a", ":slot_for_prev_num"),
     (gt, ":prev_num", 0),
     (val_add, ":prev_num", 1),
     (try_for_range, ":tree_no",  1,  ":prev_num"),     
        (store_add, ":prev_slot", ":tree_no", ":slot_for_prev_num"),
        (troop_get_slot, ":troop_no", "trp_temp_array_b", ":prev_slot"),
        (gt, ":troop_no", 0),
        #Caba - check for duplication
        (assign, ":end", ":tree_no"),
        (try_for_range, ":i", 1, ":end"), #check troops of this prev_tier previously looped over, be sure this troop hasn't been checked
            (store_add, ":other_prev_slot", ":i", ":slot_for_prev_num"),
            (neq, ":prev_slot", ":other_prev_slot"), #just to be sure
            (troop_slot_eq, "trp_temp_array_b", ":other_prev_slot", ":troop_no"),
            (assign, ":end", 0), #break loop, found in checked list
        (try_end),
        (neq, ":end", 0),
        #Caba - end
        (troop_get_upgrade_troop, ":next_troop", ":troop_no", 0),
        (gt, ":next_troop", 0),
        (assign, ":no_tier", 0), 
        (val_add, ":num", 1),
        (troop_set_slot, "trp_temp_array_a", ":slot_for_num", ":num"),
        (store_add, ":slot", ":slot_for_num", ":num"),
        (troop_set_slot, "trp_temp_array_a", ":slot", ":tree_no"),
        (troop_set_slot, "trp_temp_array_b", ":slot", ":next_troop"),
        (troop_get_upgrade_troop, ":next_troop", ":troop_no", 1),
        (gt, ":next_troop", 0),
        (val_add, ":num", 1),
        (troop_set_slot, "trp_temp_array_a", ":slot_for_num", ":num"),
        (store_add, ":slot", ":slot_for_num", ":num"),
        (troop_set_slot, "trp_temp_array_a", ":slot", ":tree_no"),
        (troop_set_slot, "trp_temp_array_b", ":slot", ":next_troop"),
     (try_end),
     (eq, ":no_tier", 0),
     (val_add, ":max_tier", 1),
  (try_end),
  (store_mul, ":max_num_tier", ":max_tier", 10), (val_add, ":max_tier", 1),
  (troop_get_slot, ":num", "trp_temp_array_a", ":max_num_tier"),
  (val_add, ":num", 1),
  #Calculate Y Position of last tier's branches?
  (try_for_range, ":tree_no", 1, ":num"),
     (store_add, ":slot", ":max_num_tier", ":tree_no"),
     (store_mul, ":subs", ":tree_no", troop_tree_space_y),
     (store_sub, ":pos", working_pos_y + 35, ":subs"),
     (troop_set_slot, "trp_temp_array_c", ":slot", ":pos"),
  (try_end),
  #Calculate Troop Y positions...can't realy follow how
  (try_for_range_backwards, ":tier", 1, ":max_tier"),
     (store_mul, ":slot_for_num", ":tier", 10),
     (store_sub, ":prev_tier", ":tier", 1),
     (store_mul, ":slot_for_prev_num", ":prev_tier", 10),
     (troop_get_slot, ":prev_num", "trp_temp_array_a", ":slot_for_prev_num"),
     (gt, ":prev_num", 0),
     (val_add, ":prev_num", 1),
     (try_for_range, ":tree_no", 1, ":prev_num"),
        (store_add, ":prev_slot", ":tree_no", ":slot_for_prev_num"),
        (assign, ":prev_pos", 0), (assign, ":num", 0),
        (try_for_range, ":subs", 1, 10),
           (store_add, ":slot", ":subs", ":slot_for_num"),
           (troop_slot_eq, "trp_temp_array_a", ":slot", ":tree_no"),
           (troop_get_slot, ":pos", "trp_temp_array_c", ":slot"),           
           (val_add, ":prev_pos", ":pos"),
           (val_add, ":num", 1),
        (try_end),
        (gt, ":num", 0),
        (val_div, ":prev_pos", ":num"),
        (troop_set_slot, "trp_temp_array_c", ":prev_slot", ":prev_pos"),
     (try_end),
     (assign, ":pos", 999),
     (try_for_range, ":tree_no", 1, ":prev_num"), 
        (store_add, ":prev_slot", ":tree_no", ":slot_for_prev_num"),
        (troop_get_slot, ":prev_pos", "trp_temp_array_c", ":prev_slot"),           
        (gt, ":prev_pos", 0),
        (lt, ":prev_pos", ":pos"),
        (assign, ":pos", ":prev_pos"),
     (try_end),        
     (try_for_range, ":tree_no", 1, ":prev_num"), 
        (store_add, ":prev_slot", ":tree_no", ":slot_for_prev_num"),
        (troop_get_slot, ":prev_pos", "trp_temp_array_c", ":prev_slot"),           
        (eq, ":prev_pos", 0),
        (store_sub, ":prev_pos", ":pos", troop_tree_space_y),
        (assign, ":pos", ":prev_pos"),
        (troop_set_slot, "trp_temp_array_c", ":prev_slot", ":prev_pos"),     
     (try_end),
  (try_end),
  (val_add, ":max_num_tier", 11), (troop_set_slot, "trp_temp_array_c", 100, 0), (assign, ":num",100),
  #Draw Troops, Titles - Calcuate X and position of Connecting Lines
  (try_for_range, ":slot", 0,  ":max_num_tier"),
     (troop_get_slot, ":troop_no", "trp_temp_array_b", ":slot"),
     (gt, ":troop_no", 0),
     #Caba - check for duplication - loop over past troops rather than using a troop slot (change?)
     (assign, ":end", ":slot"),
     (try_for_range, ":i", 0, ":end"), #check troops of this prev_tier previously looped over, be sure this troop hasn't been checked
        (neq, ":i", ":slot"), #just to be sure
        (troop_slot_eq, "trp_temp_array_b", ":i", ":troop_no"),
        (assign, ":end", 0), #break loop, found in checked list
     (try_end),
     (neq, ":end", 0),
     #Caba - end
     (store_div, ":posx", ":slot", 10),
     (val_mul, ":posx", troop_tree_space_x),
     (val_add, ":posx", troop_tree_left),
     (troop_get_slot, ":posy", "trp_temp_array_c", ":slot"),
     (val_add, ":num", 1),
     (call_script, "script_prsnt_upgrade_tree_troop_and_name", ":troop_no", ":posx", ":posy"),
     (troop_set_slot, "trp_temp_array_c", ":num", reg1),
     (troop_set_slot, "trp_temp_array_b", ":num", ":troop_no"),
     (store_mod, ":cur_slot",  ":slot", 10),
     (gt, ":cur_slot", 0),
     ## Draw lines to next troops, if found
     (store_sub, ":cur_slot1", ":slot", ":cur_slot"),
     (val_add,   ":cur_slot1", 10),     
     (store_add, ":cur_slot2", ":cur_slot1", 10),
     (try_for_range, ":slot2", ":cur_slot1", ":cur_slot2"), 
        (troop_slot_ge, "trp_temp_array_b", ":slot2", 1), 
        (troop_slot_eq, "trp_temp_array_a", ":slot2", ":cur_slot"),
        #Caba - check for duplication - loop over past troops rather than using a troop slot (change?)
        (troop_get_slot, ":troop_no", "trp_temp_array_b", ":slot2"),
        (assign, ":end", ":slot2"),
        (try_for_range, ":i", ":cur_slot1", ":end"), #check troops of this prev_tier previously looped over, be sure this troop hasn't been checked
            (neq, ":i", ":cur_slot1"), #just to be sure            
            (troop_slot_eq,  "trp_temp_array_b", ":i", ":troop_no"),
            (assign, ":posy_to_use", ":i"),
            (assign, ":end", 0), #break loop, found in checked list
        (try_end),
        (try_begin),
            (neq, ":end", 0),
            (assign, ":posy_to_use", ":slot2"),
        (try_end),
        #Caba - end
        (store_add, ":posx2", ":posx", troop_tree_space_x),
        (store_add, ":posx1", ":posx", troop_tree_space_x/2),
        (troop_get_slot, ":posy2", "trp_temp_array_c", ":posy_to_use"), #caba ":slot2"),
        (store_add, ":posy1", ":posy", troop_tree_space_y/2),
        (val_add, ":posy2", troop_tree_space_y/2),
        #Caba
        (try_begin),
            (neq, ":end", 0),
        #Caba - end
            (call_script, "script_prsnt_lines_to", ":posx", ":posy1", ":posx2", ":posy2", title_black),
            (val_sub, ":posy2", 3),
            (call_script, "script_prsnt_upgrade_tree_troop_cost", ":troop_no", ":posx1", ":posy2"),
        #Caba
        (else_try),
            (call_script, "script_prsnt_lines_to", ":posx", ":posy1", ":posx2", ":posy2", title_yellow),
        (try_end),
        #Caba - end
     (try_end),     
  (try_end),
  (troop_set_slot, "trp_temp_array_c", 100, ":num"),  ]),
The code essentially inserts 3 checks that the troop currently being considered hasn't previously been dealt with, and then (for the line drawing bits) makes the necessary accommodations. It ensures the only duplicated entry in the data arrays is the troop where the merge occurs, which works out neatly.

mergedtree2.png
In this example (for illustration purposes) the Swadian footman is changed to upgrade to the M@Arms and the Crossbowman, while the Skirmisher is upgrading to the Crossbowman and the Infantry -- so the lines merge at the crossbowman from the skirmisher and the footman, though each have unique paths, too. Hopefully that's clear. Not sure if changing the line color is the best solution...but without it, the line blends in with the others. Perhaps an off-set would be better?


EDIT
Off-set definitely better than changing the color.

mergedtreeoff1.png

mergedtreeoff12.png
While this looks fine on a simple merge in a tree, as the second shot shows it doesn't work if the tree is a bit more convoluted.

mergedtreeoff2.png

mergedtreeoff22.png
The double offset seems overkill on the simple merge, but I think it adds better clarity in the more complicated example.

The next thing, I suppose, would be to remove the bend on the tree with only 1 branch (as the other is the merge). Looking into that, then will update code.

EDIT 2
And, tree correction finished, allowing for a middle-of-the-road offset that I think looks quite workable

mergedtreeoff3.png
Code:
("prsnt_culture_troop_tree",
 [(store_script_param_1, ":culture"),
  (store_sub, ":num", ":culture", fac_culture_1), (val_mod, ":num", 6),
  (store_add, ":slot",  ":num","mesh_pic_arms_swadian"),
  (create_mesh_overlay, reg0, ":slot"),
  (store_add, ":slot", ":num", "mesh_pic_swad"),
  (create_mesh_overlay, reg1, ":slot"),
  (position_set_x, pos1, 180),(position_set_y, pos1, 560),
  (position_set_x, pos2, 500),(position_set_y, pos2, 25),      
  (position_set_x, pos3, 500),(position_set_y, pos3, 500),
  (overlay_set_position, reg0, pos1), (overlay_set_size, reg0, pos3),      
  (overlay_set_position, reg1, pos2), (overlay_set_size, reg1, pos3),       
  (try_for_range, ":slot", 0, 61),
     (troop_set_slot, "trp_temp_array_a", ":slot", 0),
     (troop_set_slot, "trp_temp_array_b", ":slot", 0),
     (troop_set_slot, "trp_temp_array_c", ":slot", 0),
     (store_add, ":num", ":slot", 100), #Caba - was missing ":slot"
     (troop_set_slot, "trp_temp_array_b", ":num", -1),
     (troop_set_slot, "trp_temp_array_c", ":num", -1),
  (try_end),
  #try-else block here to get 'troop-no' (or above) for non-kingdom trees
  (faction_get_slot, ":troop_no", ":culture", slot_faction_tier_1_troop),
  # lowest troop tiers initialization BEGIN 
  (troop_set_slot, "trp_temp_array_a", 0, 1),           # Number of Lowest Tier Troop
  (troop_set_slot, "trp_temp_array_a", 1, 1),           # 1 for 1st troop
  (troop_set_slot, "trp_temp_array_b", 1, ":troop_no"), # 1st troop id
  # lowest troop tiers initialization END 
  (assign, ":max_tier", 0), (assign, ":no_tier", 0),
  ## Calculates number of tiers--":max_tiers" and number of branches (more or less)
  (try_for_range, ":tier", 1, 10),                      # Asuming that you wont make troop tree more than 10 tiers
     (eq, ":no_tier", 0),
     (assign, ":no_tier", 1),
     (store_sub, ":prev_tier", ":tier", 1),
     (store_mul, ":slot_for_prev_num", ":prev_tier", 10),
     (store_mul, ":slot_for_num", ":tier", 10),
     (assign, ":num", 0),
     (troop_get_slot, ":prev_num", "trp_temp_array_a", ":slot_for_prev_num"),
     (gt, ":prev_num", 0),
     (val_add, ":prev_num", 1),
     (try_for_range, ":tree_no",  1,  ":prev_num"),     
        (store_add, ":prev_slot", ":tree_no", ":slot_for_prev_num"),
        (troop_get_slot, ":troop_no", "trp_temp_array_b", ":prev_slot"),
        (gt, ":troop_no", 0),
        #Caba - check for duplication
        (assign, ":end", ":tree_no"),
        (try_for_range, ":i", 1, ":end"), #check troops of this prev_tier previously looped over, be sure this troop hasn't been checked
            (store_add, ":other_prev_slot", ":i", ":slot_for_prev_num"),
            (neq, ":prev_slot", ":other_prev_slot"), #just to be sure
            (troop_slot_eq, "trp_temp_array_b", ":other_prev_slot", ":troop_no"),
            (assign, ":end", 0), #break loop, found in checked list
        (try_end),
        (neq, ":end", 0),
        #Caba - end
        (troop_get_upgrade_troop, ":next_troop", ":troop_no", 0),
        (gt, ":next_troop", 0),
        (assign, ":no_tier", 0), 
        (val_add, ":num", 1),
        (troop_set_slot, "trp_temp_array_a", ":slot_for_num", ":num"),
        (store_add, ":slot", ":slot_for_num", ":num"),
        (troop_set_slot, "trp_temp_array_a", ":slot", ":tree_no"),
        (troop_set_slot, "trp_temp_array_b", ":slot", ":next_troop"),
        (troop_get_upgrade_troop, ":next_troop", ":troop_no", 1),
        (gt, ":next_troop", 0),
        (val_add, ":num", 1),
        (troop_set_slot, "trp_temp_array_a", ":slot_for_num", ":num"),
        (store_add, ":slot", ":slot_for_num", ":num"),
        (troop_set_slot, "trp_temp_array_a", ":slot", ":tree_no"),
        (troop_set_slot, "trp_temp_array_b", ":slot", ":next_troop"),
     (try_end),
     (eq, ":no_tier", 0),
     (val_add, ":max_tier", 1),
  (try_end),
  (store_mul, ":max_num_tier", ":max_tier", 10), (val_add, ":max_tier", 1),
  (troop_get_slot, ":num", "trp_temp_array_a", ":max_num_tier"),
  (val_add, ":num", 1),
  #Calculate Y Position of last tier's branches? ???
  (try_for_range, ":tree_no", 1, ":num"),
     (store_add, ":slot", ":max_num_tier", ":tree_no"),
     (store_mul, ":subs", ":tree_no", troop_tree_space_y),
     (store_sub, ":pos", working_pos_y + 35, ":subs"),
     (troop_set_slot, "trp_temp_array_c", ":slot", ":pos"),
  (try_end),
  #Calculate Troop Y positions
  (try_for_range_backwards, ":tier", 1, ":max_tier"),
     (store_mul, ":slot_for_num", ":tier", 10),
     (store_sub, ":prev_tier", ":tier", 1),
     (store_mul, ":slot_for_prev_num", ":prev_tier", 10),
     (troop_get_slot, ":prev_num", "trp_temp_array_a", ":slot_for_prev_num"),
     (gt, ":prev_num", 0),
     (val_add, ":prev_num", 1),
     (try_for_range, ":tree_no", 1, ":prev_num"),
        (store_add, ":prev_slot", ":tree_no", ":slot_for_prev_num"),
        (assign, ":prev_pos", 0), (assign, ":num", 0),
        (try_for_range, ":subs", 1, 10),
           (store_add, ":slot", ":subs", ":slot_for_num"),
           (troop_slot_eq, "trp_temp_array_a", ":slot", ":tree_no"),
           #Caba - check for duplication - loop over past troops rather than using a troop slot (change?)
           (troop_get_slot, ":troop_no", "trp_temp_array_b", ":slot"),
           (assign, ":end", ":slot"),
           (try_for_range, ":i", 0, ":end"), #check troops of this prev_tier previously looped over, be sure this troop hasn't been checked
                (neq, ":i", ":slot"), #just to be sure
                (troop_slot_eq, "trp_temp_array_b", ":i", ":troop_no"),
                (assign, ":end", 0), #break loop, found in checked list
           (try_end),
           (neq, ":end", 0),
           #Caba - end
           (troop_get_slot, ":pos", "trp_temp_array_c", ":slot"),           
           (val_add, ":prev_pos", ":pos"),
           (val_add, ":num", 1),
        (try_end),
        (gt, ":num", 0),
        (val_div, ":prev_pos", ":num"),
        (troop_set_slot, "trp_temp_array_c", ":prev_slot", ":prev_pos"),
     (try_end),
     (assign, ":pos", 999),
     (try_for_range, ":tree_no", 1, ":prev_num"), 
        (store_add, ":prev_slot", ":tree_no", ":slot_for_prev_num"),
        (troop_get_slot, ":prev_pos", "trp_temp_array_c", ":prev_slot"),           
        (gt, ":prev_pos", 0),
        (lt, ":prev_pos", ":pos"),
        (assign, ":pos", ":prev_pos"),
     (try_end),        
     (try_for_range, ":tree_no", 1, ":prev_num"), 
        (store_add, ":prev_slot", ":tree_no", ":slot_for_prev_num"),
        (troop_get_slot, ":prev_pos", "trp_temp_array_c", ":prev_slot"),           
        (eq, ":prev_pos", 0),
        (store_sub, ":prev_pos", ":pos", troop_tree_space_y),
        (assign, ":pos", ":prev_pos"),
        (troop_set_slot, "trp_temp_array_c", ":prev_slot", ":prev_pos"),     
     (try_end),
  (try_end),
  (val_add, ":max_num_tier", 11), (troop_set_slot, "trp_temp_array_c", 100, 0), (assign, ":num",100),
  #Draw Troops, Titles - Calcuate X and position of Connecting Lines
  (try_for_range, ":slot", 0,  ":max_num_tier"),
     (troop_get_slot, ":troop_no", "trp_temp_array_b", ":slot"),
     (gt, ":troop_no", 0),
     #Caba - check for duplication - loop over past troops rather than using a troop slot (change?)
     (assign, ":end", ":slot"),
     (try_for_range, ":i", 0, ":end"), #check troops of this prev_tier previously looped over, be sure this troop hasn't been checked
        (neq, ":i", ":slot"), #just to be sure
        (troop_slot_eq, "trp_temp_array_b", ":i", ":troop_no"),
        (assign, ":end", 0), #break loop, found in checked list
     (try_end),
     (neq, ":end", 0),
     #Caba - end
     (store_div, ":posx", ":slot", 10),
     (val_mul, ":posx", troop_tree_space_x),
     (val_add, ":posx", troop_tree_left),
     (troop_get_slot, ":posy", "trp_temp_array_c", ":slot"),
     (val_add, ":num", 1),
     (call_script, "script_prsnt_upgrade_tree_troop_and_name", ":troop_no", ":posx", ":posy"),
     (troop_set_slot, "trp_temp_array_c", ":num", reg1),
     (troop_set_slot, "trp_temp_array_b", ":num", ":troop_no"),
     (store_mod, ":cur_slot",  ":slot", 10),
     (gt, ":cur_slot", 0),
     ## Draw lines to next troops, if found
     (store_sub, ":cur_slot1", ":slot", ":cur_slot"),
     (val_add,   ":cur_slot1", 10),     
     (store_add, ":cur_slot2", ":cur_slot1", 10),
     (try_for_range, ":slot2", ":cur_slot1", ":cur_slot2"), 
        (troop_slot_ge, "trp_temp_array_b", ":slot2", 1), 
        (troop_slot_eq, "trp_temp_array_a", ":slot2", ":cur_slot"),
        #Caba - check for duplication - loop over past troops rather than using a troop slot (change?)
        (troop_get_slot, ":troop_no", "trp_temp_array_b", ":slot2"),
        (assign, ":end", ":slot2"),
        (try_for_range, ":i", ":cur_slot1", ":end"), #check troops of this prev_tier previously looped over, be sure this troop hasn't been checked
            (neq, ":i", ":cur_slot1"), #just to be sure            
            (troop_slot_eq,  "trp_temp_array_b", ":i", ":troop_no"),
            (assign, ":posy_to_use", ":i"),
            (assign, ":end", 0), #break loop, found in checked list
        (try_end),
        (try_begin),
            (neq, ":end", 0),
            (assign, ":posy_to_use", ":slot2"),
        (try_end),
        #Caba - end
        (store_add, ":posx2", ":posx", troop_tree_space_x),
        (store_add, ":posx1", ":posx", troop_tree_space_x/2),
        (troop_get_slot, ":posy2", "trp_temp_array_c", ":posy_to_use"), #caba ":slot2"),
        (store_add, ":posy1", ":posy", troop_tree_space_y/2),
        (val_add, ":posy2", troop_tree_space_y/2),
        #Caba
        (try_begin),
            (neq, ":end", 0),
        #Caba - end
            (call_script, "script_prsnt_lines_to", ":posx", ":posy1", ":posx2", ":posy2", title_black),
            (val_sub, ":posy2", 3),
            (call_script, "script_prsnt_upgrade_tree_troop_cost", ":troop_no", ":posx1", ":posy2"),
        #Caba  
        (else_try),
            (val_sub, ":posy2", 20),
            (store_sub, ":posx3", ":posx2", 20),
            (call_script, "script_prsnt_lines_to", ":posx", ":posy1", ":posx3", ":posy2", title_black),
            (call_script, "script_prsnt_lines_to", ":posx3", ":posy2", ":posx2", ":posy2", title_black),
        (try_end),
        #Caba - end
     (try_end),     
  (try_end),
  (troop_set_slot, "trp_temp_array_c", 100, ":num"),  ]),
 
Hey Dunde,

I've run into a touch of snag with this presentation generation.

Due to the way we're constructing reinforcement templates and AI party make up, we have between 6-10 tiers of troops. We also have troops within the same faction that do not ever upgrade into one another.

A simple case in point.

In every faction, infantry only upgrades into other infantry. Cavalry only upgrades into other cavalry. Non-commissioned officers upgrade into Commissioned Officers.

The result winds up with this:

7048488955_81f6d8fce3_b.jpg


6902398242_e714f0e509_b.jpg


6902411118_7272f54fc3_b.jpg

NPCs within a faction (lords/ladies) show up on the screen, scattered around rather unrelated and often non-faction troops, yet clicking on any of them gives you not only the selected factions troops, but also other faction troops. Even weirder, after getting past the first 3 factions, only one soldier remains on the other 10 pages. I also get a scrolling error message. It managed to update all the remaining factions after I started a new game, but the presentation is still completely messed up.

I don't mind doing the leg work and customizing it to our needs, but do you mind giving me some suggestions as to where the problem could be?

I'm using the NMC base, which came with Custom Commander's view upgrade presentation and all of it's related scripts, as well as diplomacy.

Thanks,

CR
 
I'm getting a similar error; it looks like its running out of room and trying to make do with what it has?

This tree was simple enough so it works:
2012-04-05_00009.jpg

This one was larger; two units overlap each other in the middle and it gives the illusion that there are three upgrade points.
2012-04-05_00010.jpg

FYI: The "Hebei Archer" should just turn into the "Hebei Veteran Archer" at tier 4 and then the "Hebei Marksman" at tier 5; there aren't any deviations in that route.
The "Hebei Soldier" should turn into the "Hebei Infantry" (It's there but you cant see the name as its overlapping the Veteran Archer name) at tier 4; and then branch into the "Hebei Major and Hebei Skirmisher" at tier 5.

These two paths overlap; but otherwise are displaying correctly.

So would this be resolvable by just making every picture/branch a little smaller?

Also: Very great code; literally saved me hours upon hours upon HOURS of work if I had to manually make each one of these.
 
Ok here is the output from my compiler....  it seems that it is now complaining about the Power strike skill.  I can't seem to figure this one out.  I know it has to be a missing comma or some other easy thing.  Any ideas where to begin looking?  It would seem that my skills.py file was somehow messed up, but I do not see how inserting this mods code could cause that.

Getting Header Files .........
Getting ID Files .........
Getting Process Files .........
Start Processing...
______________________________

Traceback (most recent call last):
  File "process_init.py", line 2, in <module>
    from process_operations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\proce
ss_operations.py", line 26, in <module>
    from module_presentations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\modul
e_presentations.py", line 1128, in <module>
    (store_skill_level, reg1, skl_power_strike, "$temp"),
NameError: name 'skl_power_strike' is not defined
Traceback (most recent call last):
  File "process_global_variables.py", line 8, in <module>
    from module_presentations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\modul
e_presentations.py", line 1128, in <module>
    (store_skill_level, reg1, skl_power_strike, "$temp"),
NameError: name 'skl_power_strike' is not defined
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:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\proce
ss_operations.py", line 26, in <module>
    from module_presentations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\modul
e_presentations.py", line 1128, in <module>
    (store_skill_level, reg1, skl_power_strike, "$temp"),
NameError: name 'skl_power_strike' is not defined
Exporting faction data...
Exporting item data...
Traceback (most recent call last):
  File "process_items.py", line 66, in <module>
    from process_operations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\proce
ss_operations.py", line 26, in <module>
    from module_presentations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\modul
e_presentations.py", line 1128, in <module>
    (store_skill_level, reg1, skl_power_strike, "$temp"),
NameError: name 'skl_power_strike' is not defined
Exporting scene data...
Traceback (most recent call last):
  File "process_scenes.py", line 15, in <module>
    from process_operations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\proce
ss_operations.py", line 26, in <module>
    from module_presentations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\modul
e_presentations.py", line 1128, in <module>
    (store_skill_level, reg1, skl_power_strike, "$temp"),
NameError: name 'skl_power_strike' is not defined
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:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\proce
ss_operations.py", line 26, in <module>
    from module_presentations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\modul
e_presentations.py", line 1128, in <module>
    (store_skill_level, reg1, skl_power_strike, "$temp"),
NameError: name 'skl_power_strike' is not defined
Traceback (most recent call last):
  File "process_tableau_materials.py", line 8, in <module>
    from process_operations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\proce
ss_operations.py", line 26, in <module>
    from module_presentations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\modul
e_presentations.py", line 1128, in <module>
    (store_skill_level, reg1, skl_power_strike, "$temp"),
NameError: name 'skl_power_strike' is not defined
Traceback (most recent call last):
  File "process_presentations.py", line 4, in <module>
    from module_presentations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\modul
e_presentations.py", line 1128, in <module>
    (store_skill_level, reg1, skl_power_strike, "$temp"),
NameError: name 'skl_power_strike' is not defined
Exporting party_template data...
Traceback (most recent call last):
  File "process_parties.py", line 6, in <module>
    from process_operations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\proce
ss_operations.py", line 26, in <module>
    from module_presentations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\modul
e_presentations.py", line 1128, in <module>
    (store_skill_level, reg1, skl_power_strike, "$temp"),
NameError: name 'skl_power_strike' is not defined
Exporting quest data...
Exporting info_page data...
Traceback (most recent call last):
  File "process_scripts.py", line 7, in <module>
    from process_operations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\proce
ss_operations.py", line 26, in <module>
    from module_presentations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\modul
e_presentations.py", line 1128, in <module>
    (store_skill_level, reg1, skl_power_strike, "$temp"),
NameError: name 'skl_power_strike' is not defined
Traceback (most recent call last):
  File "process_mission_tmps.py", line 8, in <module>
    from process_operations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\proce
ss_operations.py", line 26, in <module>
    from module_presentations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\modul
e_presentations.py", line 1128, in <module>
    (store_skill_level, reg1, skl_power_strike, "$temp"),
NameError: name 'skl_power_strike' is not defined
Traceback (most recent call last):
  File "process_game_menus.py", line 8, in <module>
    from process_operations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\proce
ss_operations.py", line 26, in <module>
    from module_presentations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\modul
e_presentations.py", line 1128, in <module>
    (store_skill_level, reg1, skl_power_strike, "$temp"),
NameError: name 'skl_power_strike' is not defined
Traceback (most recent call last):
  File "process_simple_triggers.py", line 5, in <module>
    from process_operations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\proce
ss_operations.py", line 26, in <module>
    from module_presentations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\modul
e_presentations.py", line 1128, in <module>
    (store_skill_level, reg1, skl_power_strike, "$temp"),
NameError: name 'skl_power_strike' is not defined
Traceback (most recent call last):
  File "process_dialogs.py", line 9, in <module>
    from process_operations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\proce
ss_operations.py", line 26, in <module>
    from module_presentations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\modul
e_presentations.py", line 1128, in <module>
    (store_skill_level, reg1, skl_power_strike, "$temp"),
NameError: name 'skl_power_strike' is not defined
Traceback (most recent call last):
  File "process_global_variables_unused.py", line 3, in <module>
    from process_operations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\proce
ss_operations.py", line 26, in <module>
    from module_presentations import *
  File "C:\Users\Eric\MY Mods\Warband\Module_system 1.151 - Game of swords\modul
e_presentations.py", line 1128, in <module>
    (store_skill_level, reg1, skl_power_strike, "$temp"),
NameError: name 'skl_power_strike' is not defined
Exporting postfx_params...

All Finish ...
Cleaning up...
______________________________

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


ok following the guidlines for the additional lines in the constants file it stopped complaining about power strike, but now I get this...  it seems I am misisng somthing obvious here, but i cant see it.

      Getting Header Files .........
Getting ID Files .........
Getting Process Files .........
Start Processing...
______________________________

Initializing...
Compiling all global variables...
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...
Error: Unable to find object:script_copy_inventory
ERROR: Illegal Identifier:script_copy_inventory
Error: Unable to find object:script_get_troop_max_hp
ERROR: Illegal Identifier:script_get_troop_max_hp
Exporting party_template data...
Exporting parties
Exporting quest data...
Exporting info_page data...
Exporting scripts...
Error: Unable to find object:script_prsnt_upgrade_tree_troop_and_name
ERROR: Illegal Identifier:script_prsnt_upgrade_tree_troop_and_name
Error: Unable to find object:script_prsnt_lines_to
ERROR: Illegal Identifier:script_prsnt_lines_to
Error: Unable to find object:script_prsnt_upgrade_tree_troop_cost
ERROR: Illegal Identifier:script_prsnt_upgrade_tree_troop_cost
Error: Unable to find object:script_prsnt_lines_to
ERROR: Illegal Identifier:script_prsnt_lines_to
Error: Unable to find object:script_prsnt_lines_to
ERROR: Illegal Identifier:script_prsnt_lines_to
Exporting mission_template data...
Exporting game menus data...
exporting simple triggers...
exporting triggers...
exporting dialogs...
Checking global variable usages...
WARNING: Global variable never used: camp_supply
Exporting postfx_params...

All Finish ...
Cleaning up...
______________________________

Script processing has ended.
Press any key to exit. . .
 
 
I'm getting this:
[More Stuff comes here, but that is not important]
ll_count', 1), (434, ':latest_joined_player_no', ':player_kill_count'), (435, ':
player_death_count', ':latest_joined_player_no'), (2106, ':player_death_count',
1), (436, ':latest_joined_player_no', ':player_death_count'), (431, ':player_sco
re', ':latest_joined_player_no'), (2105, ':player_score', 1), (432, ':latest_joi
ned_player_no', ':player_score'), (6, ':player_no', 1, ':num_players'), (401, ':
player_no'), (398, ':player_no', 86, ':latest_joined_player_no', ':player_score'
, ':player_kill_count', ':player_death_count'), 3, (460, ':eek:ld_items_value', ':l
atest_joined_player_no'), (407, ':player_gold', ':latest_joined_player_no'), (21
05, ':player_gold', ':eek:ld_items_value'), (408, ':latest_joined_player_no', ':pla
yer_gold', 15000), 3, (405, ':latest_joined_player_no', -1), (403, ':latest_join
ed_player_no', ':team_with_less_players'), (394, ':latest_joined_player_no', 79)
, 3, 3, (1, 'script_show_multiplayer_message', 2, 0), (415, ':my_player_no'), (4
00, ':num_players'), (6, ':player_no', 0, ':num_players'), (401, ':player_no'),
(2147483679L, ':my_player_no', ':player_no'), (395, ':player_no', 68, 2), 3, (21
33, '$g_team_balance_next_round', 0), 3, 3, (2133, '$g_team_balance_next_round',
0), (400, ':num_players'), (6, ':player_no', 0, ':num_players'), (401, ':player
_no'), (508, ':player_no', 0, 0), (406, ':player_agent', ':player_no'), (30, ':p
layer_agent', 0), (1702, ':player_agent'), (459, ':player_no'), (460, ':eek:ld_item
s_value', ':player_no'), (508, ':player_no', 1, ':eek:ld_items_value'), 3, (2133, '
:per_round_gold_addition', 500), (2107, ':per_round_gold_addition', '$g_multipla
yer_round_earnings_multiplier'), (2108, ':per_round_gold_addition', 100), (400,
':num_players'), (6, ':player_no', 0, ':num_players'), (401, ':player_no'), (407
, ':player_gold', ':player_no'), (402, ':player_team', ':player_no'), 4, (107374
1855, ':player_team', 0), (31, ':player_team', 1), (2105, ':player_gold', ':per_
round_gold_addition'), 3, 4, (528, ':eek:ld_items_value', ':player_no', 1), (2120,
':player_total_potential_gold', ':player_gold', ':eek:ld_items_value'), (2122, ':mi
nimum_gold', '$g_multiplayer_initial_gold_multiplier', 10), (2147483678L, ':play
er_total_potential_gold', ':minimum_gold'), (2121, ':additional_gold', ':minimum
_gold', ':player_total_potential_gold'), (2105, ':player_gold', ':additional_gol
d'), 3, (408, ':player_no', ':player_gold', 15000), 3, (2133, '$my_team_at_start
_of_round', -1), 416, (1, 'script_multiplayer_initialize_belfry_wheel_rotations'
), 4, (31, '$g_battle_death_mode_started', 2), (1, 'script_move_death_mode_flags
_down'), 3, (2133, '$g_battle_death_mode_started', 0), (2133, '$g_reduced_waitin
g_seconds', 0), (1, 'script_multiplayer_close_gate_if_it_is_open'), (1, 'script_
multiplayer_move_moveable_objects_initial_positions'), (2133, '$g_round_ended',
0), (2133, '$g_multiplayer_num_bots_required_team_1', '$g_multiplayer_num_bots_t
eam_1'), (2133, '$g_multiplayer_num_bots_required_team_2', '$g_multiplayer_num_b
ots_team_2'), (2370, '$g_round_start_time'), (1, 'script_initialize_all_scene_pr
op_slots'), (400, ':num_players'), (6, ':player_no', 0, ':num_players'), (401, '
:player_no'), (395, ':player_no', 78, -9999), 3]), (0, 0, 0, [], [(2133, ':human
_agents_spawned_at_team_1', '$g_multiplayer_num_bots_team_1'), (2133, ':human_ag
ents_spawned_at_team_2', '$g_multiplayer_num_bots_team_2'), (400, ':num_players'
), (6, ':player_no', 0, ':num_players'), (401, ':player_no'), (402, ':player_tea
m', ':player_no'), 4, (31, ':player_team', 0), (2105, ':human_agents_spawned_at_
team_1', 1), 5, (31, ':player_team', 1), (2105, ':human_agents_spawned_at_team_2
', 1), 3, 3, 4, (1073741855, ':human_agents_spawned_at_team_1', 0), (31, ':human
_agents_spawned_at_team_2', 0), (2370, ':seconds_past_since_round_started'), (21
06, ':seconds_past_since_round_started', '$g_round_start_time'), (2147483680L, '
:seconds_past_since_round_started', 2), (2370, '$g_round_start_time'), 3]), (1,
0, 0, [], [417, (400, ':num_players'), (6, ':player_no', 0, ':num_players'), (40
1, ':player_no'), (2147484086L, ':player_no'), 4, (548, ':player_no', 0, 0), (40
2, ':player_team', ':player_no'), (2147483678L, ':player_team', 2), (404, ':play
er_troop', ':player_no'), (30, ':player_troop', 0), (2133, ':spawn_new', 0), (21
33, ':num_active_players_in_team_0', 0), (2133, ':num_active_players_in_team_1',
0), 4, (2133, ':num_active_players', 0), (400, ':num_players'), (6, ':player_no
_2', 0, ':num_players'), (401, ':player_no_2'), (2105, ':num_active_players', 1)
, (402, ':player_team_2', ':player_no_2'), 4, (31, ':player_team_2', 0), (2105,
':num_active_players_in_team_0', 1), 5, (31, ':player_team_2', 1), (2105, ':num_
active_players_in_team_1', 1), 3, 3, (2122, ':multipication_of_num_active_player
s_in_teams', ':num_active_players_in_team_0', ':num_active_players_in_team_1'),
(2370, ':round_time'), (2106, ':round_time', '$g_round_start_time'), (3221225502
L, ':round_time', 30), (3221225504L, ':num_active_players', 2), (31, ':multipica
tion_of_num_active_players_in_teams', 0), (31, '$g_round_ended', 0), (2133, ':sp
awn_new', 1), 3, (31, ':spawn_new', 1), 4, (31, ':player_team', 0), (2133, ':ent
ry_no', 0), 5, (31, ':player_team', 1), (2133, ':entry_no', 32), 3, (1, 'script_
multiplayer_buy_agent_equipment', ':player_no'), (409, ':player_no', ':entry_no'
), (508, ':player_no', 0, 1), 5, (31, '$g_multiplayer_player_respawn_as_bot', 1)
, (406, ':player_agent', ':player_no'), (30, ':player_agent', 0), (2147485350L,
':player_agent'), (1760, ':elapsed_time', ':player_agent'), (32, ':elapsed_time'
, '$g_multiplayer_respawn_period'), (402, ':player_team', ':player_no'), (2133,
':is_found', 0), (12, ':cur_agent'), (31, ':is_found', 0), (1702, ':cur_agent'),
(1704, ':cur_agent'), (1707, ':cur_agent'), (1770, ':cur_team', ':cur_agent'),
(31, ':cur_team', ':player_team'), (2133, ':is_found', 1), 3, 4, (31, ':is_found
', 1), (1, 'script_find_most_suitable_bot_to_control', ':player_no'), (421, ':pl
ayer_no', 72057594037927936L), (528, ':num_spawns', ':player_no', 0), (2105, ':n
um_spawns', 1), (508, ':player_no', 0, ':num_spawns'), 3, 3, 3]), (0, 0, 0, [],
[417, (31, '$g_multiplayer_ready_for_spawning_agent', 1), (2120, ':total_req', '
$g_multiplayer_num_bots_required_team_1', '$g_multiplayer_num_bots_required_team
_2'), 4, (32, ':total_req', 0), 4, (1073741855, '$g_multiplayer_game_type', 2),
(1073741855, '$g_multiplayer_game_type', :cool: , (1073741855, '$g_multiplayer_game_t
ype', 9), (1073741855, '$g_multiplayer_game_type', 3), (31, '$g_multiplayer_game
_type', 6), (455, ':team_1_score', 0), (455, ':team_2_score', 1), (2120, ':curre
nt_round', ':team_1_score', ':team_2_score'), (31, ':current_round', 0), (2370,
':round_time'), (2106, ':round_time', '$g_round_start_time'), (2147483678L, ':ro
und_time', 20), (2133, ':rounded_game_first_round_time_limit_past', 0), 5, (2133
, ':rounded_game_first_round_time_limit_past', 1), 3, (31, ':rounded_game_first_
round_time_limit_past', 1), (2136, ':random_req', 0, ':total_req'), (2106, ':ran
dom_req', '$g_multiplayer_num_bots_required_team_1'), 4, (2147483678L, ':random_
req', 0), (2133, ':selected_team', 0), 5, (2133, ':selected_team', 1), 3, 4, (10
73741855, '$g_multiplayer_game_type', 2), (1073741855, '$g_multiplayer_game_type
', :cool: , (1073741855, '$g_multiplayer_game_type', 9), (31, '$g_multiplayer_game_ty
pe', 3), (2370, ':round_time'), (2106, ':round_time', '$g_round_start_time'), 4,
(2147483680L, ':round_time', 20), (2133, ':look_only_actives', 0), 5, (2133, ':
look_only_actives', 1), 3, 5, (2133, ':look_only_actives', 1), 3, (1, 'script_mu
ltiplayer_find_bot_troop_and_group_for_spawn', ':selected_team', ':look_only_act
ives'), (2133, ':selected_troop', 72057594037927936L), (2133, ':selected_group',
72057594037927937L), (458, ':team_faction', ':selected_team'), (2133, ':num_ai_
troops', 0), (6, ':cur_ai_troop', 'trp_swadian_crossbowman_multiplayer_ai', 'trp
_swadian_crossbowman_multiplayer'), (2173, ':ai_troop_faction', ':cur_ai_troop')
, (31, ':ai_troop_faction', ':team_faction'), (2105, ':num_ai_troops', 1), 3, (2
133, ':number_of_active_players_wanted_bot', 0), (400, ':num_players'), (6, ':pl
ayer_no', 0, ':num_players'), (401, ':player_no'), (402, ':player_team_no', ':pl
ayer_no'), (31, ':selected_team', ':player_team_no'), (2133, ':ai_wanted', 0), (
2120, ':end_cond', 35, ':num_ai_troops'), (6, ':bot_type_wanted_slot', 35, ':end
_cond'), (568, ':player_no', ':bot_type_wanted_slot', 1), (2133, ':ai_wanted', 1
), (2133, ':end_cond', 0), 3, (30, ':ai_wanted', 1), (2105, ':number_of_active_p
layers_wanted_bot', 1), 3, 4, (1073741854, ':selected_group', 0), (31, ':number_
of_active_players_wanted_bot', 0), (1541, ':has_item', ':selected_troop', :cool: , 4,
(30, ':has_item', 0), (2133, ':is_horseman', 1), 5, (2133, ':is_horseman', 0),
3, 4, (31, '$g_multiplayer_game_type', 6), (2370, ':round_time'), (2106, ':round
_time', '$g_round_start_time'), 4, (2147483678L, ':round_time', 20), 4, (31, ':s
elected_team', 0), (1, 'script_multiplayer_find_spawn_point', ':selected_team',
1, ':is_horseman'), 5, (2133, 72057594037927936L, 32), 3, 5, (1, 'script_multipl
ayer_find_spawn_point', ':selected_team', 0, ':is_horseman'), 3, 5, (1073741855,
'$g_multiplayer_game_type', 2), (31, '$g_multiplayer_game_type', 3), 4, (31, ':
selected_team', 0), (2133, 72057594037927936L, 0), 5, (2133, 72057594037927936L,
32), 3, 5, (31, '$g_multiplayer_game_type', :cool: , 4, (31, ':selected_team', 0), (
2136, 72057594037927936L, 0, 2), 5, (2136, 72057594037927936L, 32, 40), 3, 5, (3
1, '$g_multiplayer_game_type', 9), 4, (31, ':selected_team', 0), (2133, 72057594
037927936L, 0), 5, (2133, 72057594037927936L, 32), 3, 5, (1, 'script_multiplayer
_find_spawn_point', ':selected_team', 0, ':is_horseman'), 3, (2211, ':cur_scene'
), (1261, ':cur_scene'), (1265, 72057594037927936L, ':selected_troop', 1, ':sele
cted_team', ':selected_group'), (2133, '$g_multiplayer_ready_for_spawning_agent'
, 0), 4, (31, ':selected_team', 0), (2106, '$g_multiplayer_num_bots_required_tea
m_1', 1), 5, (31, ':selected_team', 1), (2106, '$g_multiplayer_num_bots_required
_team_2', 1), 3, 3, 3]), (3, 0, 0, [], [417, (12, ':cur_agent'), (1707, ':cur_ag
ent'), (1704, ':cur_agent'), (1702, ':cur_agent'), (1765, ':agent_group', ':cur_
agent'), 4, (2147484049L, ':agent_group'), (1, 'script_multiplayer_change_leader
_of_bot', ':cur_agent'), 5, (402, ':leader_team_no', ':agent_group'), (1770, ':a
gent_team', ':cur_agent'), (2147483679L, ':leader_team_no', ':agent_team'), (1,
'script_multiplayer_change_leader_of_bot', ':cur_agent'), 3, 3]), (1, 0, 0, [],
[417, (2133, ':end_map', 0), 4, (1073741855, '$g_multiplayer_game_type', 2), (10
73741855, '$g_multiplayer_game_type', :cool: , (1073741855, '$g_multiplayer_game_type
', 9), (1073741855, '$g_multiplayer_game_type', 3), (31, '$g_multiplayer_game_ty
pe', 6), 4, (31, '$g_round_ended', 1), (2370, ':seconds_past_till_round_ended'),
(2106, ':seconds_past_till_round_ended', '$g_round_finish_time'), (2121, ':mult
iplayer_respawn_period_minus_one', '$g_multiplayer_respawn_period', 1), (30, ':s
econds_past_till_round_ended', ':multiplayer_respawn_period_minus_one'), (2370,
':mission_timer'), 4, (1073741855, '$g_multiplayer_game_type', 2), (1073741855,
'$g_multiplayer_game_type', :cool: , (1073741855, '$g_multiplayer_game_type', 9), (31
, '$g_multiplayer_game_type', 3), (2133, ':reduce_amount', 90), 5, (2133, ':redu
ce_amount', 120), 3, (2122, ':game_max_seconds', '$g_multiplayer_game_max_minute
s', 60), (2121, ':game_max_seconds_min_n_seconds', ':game_max_seconds', ':reduce
_amount'), (32, ':mission_timer', ':game_max_seconds_min_n_seconds'), (2133, ':e
nd_map', 1), 3, (31, ':end_map', 1), 5, (2147483679L, '$g_multiplayer_game_type'
, 2), (2147483679L, '$g_multiplayer_game_type', :cool: , (2147483679L, '$g_multiplaye
r_game_type', 9), (2147483679L, '$g_multiplayer_game_type', 3), (2147483679L, '$
g_multiplayer_game_type', 6), (2147483679L, '$g_multiplayer_game_type', 5), (237
0, ':mission_timer'), (2122, ':game_max_seconds', '$g_multiplayer_game_max_minut
es', 60), (32, ':mission_timer', ':game_max_seconds'), (2133, ':end_map', 1), 5,
(455, ':team_1_score', 0), (455, ':team_2_score', 1), 4, (2147483679L, '$g_mult
iplayer_game_type', 5), 4, (1073741854, ':team_1_score', '$g_multiplayer_game_ma
x_points'), (30, ':team_2_score', '$g_multiplayer_game_max_points'), (2133, ':en
d_map', 1), 3, 5, (2133, ':at_least_one_player_is_at_game', 0), (400, ':num_play
ers'), (6, ':player_no', 0, ':num_players'), (401, ':player_no'), (406, ':agent_
id', ':player_no'), (30, ':agent_id', 0), (2147485355L, ':agent_id'), (2133, ':a
t_least_one_player_is_at_game', 1), (2133, ':num_players', 0), 3, (31, ':at_leas
t_one_player_is_at_game', 1), (3221225504L, ':team_1_score', 0), (2147483680L, '
:team_2_score', 0), (2133, ':end_map', 1), 3, 3, 4, (31, ':end_map', 1), (1, 'sc
ript_game_multiplayer_get_game_type_mission_template', '$g_multiplayer_game_type
'), (470, 72057594037927936L, '$g_multiplayer_selected_map', 0), (1, 'script_gam
e_set_multiplayer_mission_end'), 3]), (-21.0, 0, 0, [], [4, (31, '$g_multiplayer
_mission_end_screen', 0), (2133, '$g_multiplayer_stats_chart_opened_manually', 1
), (900, 'prsnt_multiplayer_stats_chart'), 3]), (0, 0, 100000000.0, [], [(900, '
prsnt_multiplayer_welcome_message')]), (-24.0, 0, 0, [], [(900, 'prsnt_multiplay
er_round_time_counter'), (900, 'prsnt_multiplayer_team_score_display'), 4, (31,
'$g_battle_death_mode_started', 2), (900, 'prsnt_multiplayer_flag_projection_dis
play_bt'), 3]), (-23.0, 0, 0, [], [(2147484551L, 'prsnt_multiplayer_escape_menu'
), (2147484551L, 'prsnt_multiplayer_stats_chart'), (31, '$g_waiting_for_confirma
tion_to_terminate', 0), (900, 'prsnt_multiplayer_escape_menu')])])
[More Stuff comes here, but that is not important]
Traceback (most recent call last):  File "process_mission_tmps.py", line 64, in <module>    save_mission_templates(variables,variable_uses,tag_uses,quick_strings)  File "process_mission_tmps.py", line 48, in save_mission_templates    save_triggers(file,convert_to_identifier(mission_template[mission_template_name_pos]), mission_template[mission_template_triggers_pos],variables,variable_uses,tag_uses,quick_strings)  File "process_mission_tmps.py", line 21, in save_triggers    file.write("%f %f %f "%(trigger[trigger_check_pos],trigger[trigger_delay_pos],trigger[trigger_rearm_pos]))IndexError: list index out of range
[More Stuff comes here, but that is not important]
What did I do wrong? I marked what I think is most important in green.

edit: The first thing seems to be from a presentation, from the scoreboard presentation to be exactly. But I did not do any changes to that after adding this dynamic troop trees. And I compiled it before and it worked fine.
 
Humm, I did not change anything in the mission templates since the last time I compiled. I will check what happens when I start the mod.

edit: UNexpected end of file, mission_templates.txt, yes. OK, now I just need to find out what I did wrong -.-
 
Caba`drin said:
Simply looks like you didn't add the scripts to the module_scripts file. (Or, if you did, you added them outside of the scripts = [] list)


here is an snip of my module_scripts.py

have I misinterpreted the instructions on what this file should look like?



# -*- coding: cp1254 -*-
from header_common import *
from header_operations import *
from module_constants import *
from module_constants import *
from header_parties import *
from header_skills import *
from header_mission_templates import *
from header_items import *
from header_triggers import *
from header_terrain_types import *
from header_music import *
from header_map_icons import *
from ID_animations import *
from header_presentations import *

.
.
.


scripts = [


  #script_game_start:
  # This script is called when a new game is started
  # INPUT: none
  ("game_start",

.
.
.
about 51000 lines later at the very end of the file.



# dynamic troop tree begin ================================================================
("prsnt_culture_troop_tree",
[(store_script_param_1, ":culture"),
  (store_sub, ":num", ":culture", fac_culture_1), (val_mod, ":num", 6),
  (store_add, ":slot",  ":num","mesh_pic_arms_swadian"),
  (create_mesh_overlay, reg0, ":slot"),
  (store_add, ":slot", ":num", "mesh_pic_swad"),
  (create_mesh_overlay, reg1, ":slot"),
  (position_set_x, pos1, 180),(position_set_y, pos1, 560),
  (position_set_x, pos2, 500),(position_set_y, pos2, 25),     
  (position_set_x, pos3, 500),(position_set_y, pos3, 500),
  (overlay_set_position, reg0, pos1), (overlay_set_size, reg0, pos3),     
  (overlay_set_position, reg1, pos2), (overlay_set_size, reg1, pos3),     
  (try_for_range, ":slot", 0, 61),
    (troop_set_slot, "trp_temp_array_a", ":slot", 0),
    (troop_set_slot, "trp_temp_array_b", ":slot", 0),
    (troop_set_slot, "trp_temp_array_c", ":slot", 0),
    (store_add, ":num", ":slot", 100), #Caba - was missing ":slot"
    (troop_set_slot, "trp_temp_array_b", ":num", -1),
    (troop_set_slot, "trp_temp_array_c", ":num", -1),
  (try_end),
  #try-else block here to get 'troop-no' (or above) for non-kingdom trees
  (faction_get_slot, ":troop_no", ":culture", slot_faction_tier_1_troop),
  # lowest troop tiers initialization BEGIN
  (troop_set_slot, "trp_temp_array_a", 0, 1),          # Number of Lowest Tier Troop
  (troop_set_slot, "trp_temp_array_a", 1, 1),          # 1 for 1st troop
  (troop_set_slot, "trp_temp_array_b", 1, ":troop_no"), # 1st troop id
  # lowest troop tiers initialization END
  (assign, ":max_tier", 0), (assign, ":no_tier", 0),
  ## Calculates number of tiers--":max_tiers" and number of branches (more or less)
  (try_for_range, ":tier", 1, 10),                      # Asuming that you wont make troop tree more than 10 tiers
    (eq, ":no_tier", 0),
    (assign, ":no_tier", 1),
    (store_sub, ":prev_tier", ":tier", 1),
    (store_mul, ":slot_for_prev_num", ":prev_tier", 10),
    (store_mul, ":slot_for_num", ":tier", 10),
    (assign, ":num", 0),
    (troop_get_slot, ":prev_num", "trp_temp_array_a", ":slot_for_prev_num"),
    (gt, ":prev_num", 0),
    (val_add, ":prev_num", 1),
    (try_for_range, ":tree_no",  1,  ":prev_num"),   
        (store_add, ":prev_slot", ":tree_no", ":slot_for_prev_num"),
        (troop_get_slot, ":troop_no", "trp_temp_array_b", ":prev_slot"),
        (gt, ":troop_no", 0),
        #Caba - check for duplication
        (assign, ":end", ":tree_no"),
        (try_for_range, ":i", 1, ":end"), #check troops of this prev_tier previously looped over, be sure this troop hasn't been checked
            (store_add, ":eek:ther_prev_slot", ":i", ":slot_for_prev_num"),
            (neq, ":prev_slot", ":eek:ther_prev_slot"), #just to be sure
            (troop_slot_eq, "trp_temp_array_b", ":eek:ther_prev_slot", ":troop_no"),
            (assign, ":end", 0), #break loop, found in checked list
        (try_end),
        (neq, ":end", 0),
        #Caba - end
        (troop_get_upgrade_troop, ":next_troop", ":troop_no", 0),
        (gt, ":next_troop", 0),
        (assign, ":no_tier", 0),
        (val_add, ":num", 1),
        (troop_set_slot, "trp_temp_array_a", ":slot_for_num", ":num"),
        (store_add, ":slot", ":slot_for_num", ":num"),
        (troop_set_slot, "trp_temp_array_a", ":slot", ":tree_no"),
        (troop_set_slot, "trp_temp_array_b", ":slot", ":next_troop"),
        (troop_get_upgrade_troop, ":next_troop", ":troop_no", 1),
        (gt, ":next_troop", 0),
        (val_add, ":num", 1),
        (troop_set_slot, "trp_temp_array_a", ":slot_for_num", ":num"),
        (store_add, ":slot", ":slot_for_num", ":num"),
        (troop_set_slot, "trp_temp_array_a", ":slot", ":tree_no"),
        (troop_set_slot, "trp_temp_array_b", ":slot", ":next_troop"),
    (try_end),
    (eq, ":no_tier", 0),
    (val_add, ":max_tier", 1),
  (try_end),
  (store_mul, ":max_num_tier", ":max_tier", 10), (val_add, ":max_tier", 1),
  (troop_get_slot, ":num", "trp_temp_array_a", ":max_num_tier"),
  (val_add, ":num", 1),
  #Calculate Y Position of last tier's branches? ???
  (try_for_range, ":tree_no", 1, ":num"),
    (store_add, ":slot", ":max_num_tier", ":tree_no"),
    (store_mul, ":subs", ":tree_no", troop_tree_space_y),
    (store_sub, ":pos", working_pos_y + 35, ":subs"),
    (troop_set_slot, "trp_temp_array_c", ":slot", ":pos"),
  (try_end),
  #Calculate Troop Y positions
  (try_for_range_backwards, ":tier", 1, ":max_tier"),
    (store_mul, ":slot_for_num", ":tier", 10),
    (store_sub, ":prev_tier", ":tier", 1),
    (store_mul, ":slot_for_prev_num", ":prev_tier", 10),
    (troop_get_slot, ":prev_num", "trp_temp_array_a", ":slot_for_prev_num"),
    (gt, ":prev_num", 0),
    (val_add, ":prev_num", 1),
    (try_for_range, ":tree_no", 1, ":prev_num"),
        (store_add, ":prev_slot", ":tree_no", ":slot_for_prev_num"),
        (assign, ":prev_pos", 0), (assign, ":num", 0),
        (try_for_range, ":subs", 1, 10),
          (store_add, ":slot", ":subs", ":slot_for_num"),
          (troop_slot_eq, "trp_temp_array_a", ":slot", ":tree_no"),
          #Caba - check for duplication - loop over past troops rather than using a troop slot (change?)
          (troop_get_slot, ":troop_no", "trp_temp_array_b", ":slot"),
          (assign, ":end", ":slot"),
          (try_for_range, ":i", 0, ":end"), #check troops of this prev_tier previously looped over, be sure this troop hasn't been checked
                (neq, ":i", ":slot"), #just to be sure
                (troop_slot_eq, "trp_temp_array_b", ":i", ":troop_no"),
                (assign, ":end", 0), #break loop, found in checked list
          (try_end),
          (neq, ":end", 0),
          #Caba - end
          (troop_get_slot, ":pos", "trp_temp_array_c", ":slot"),         
          (val_add, ":prev_pos", ":pos"),
          (val_add, ":num", 1),
        (try_end),
        (gt, ":num", 0),
        (val_div, ":prev_pos", ":num"),
        (troop_set_slot, "trp_temp_array_c", ":prev_slot", ":prev_pos"),
    (try_end),
    (assign, ":pos", 999),
    (try_for_range, ":tree_no", 1, ":prev_num"),
        (store_add, ":prev_slot", ":tree_no", ":slot_for_prev_num"),
        (troop_get_slot, ":prev_pos", "trp_temp_array_c", ":prev_slot"),         
        (gt, ":prev_pos", 0),
        (lt, ":prev_pos", ":pos"),
        (assign, ":pos", ":prev_pos"),
    (try_end),       
    (try_for_range, ":tree_no", 1, ":prev_num"),
        (store_add, ":prev_slot", ":tree_no", ":slot_for_prev_num"),
        (troop_get_slot, ":prev_pos", "trp_temp_array_c", ":prev_slot"),         
        (eq, ":prev_pos", 0),
        (store_sub, ":prev_pos", ":pos", troop_tree_space_y),
        (assign, ":pos", ":prev_pos"),
        (troop_set_slot, "trp_temp_array_c", ":prev_slot", ":prev_pos"),   
    (try_end),
  (try_end),
  (val_add, ":max_num_tier", 11), (troop_set_slot, "trp_temp_array_c", 100, 0), (assign, ":num",100),
  #Draw Troops, Titles - Calcuate X and position of Connecting Lines
  (try_for_range, ":slot", 0,  ":max_num_tier"),
    (troop_get_slot, ":troop_no", "trp_temp_array_b", ":slot"),
    (gt, ":troop_no", 0),
    #Caba - check for duplication - loop over past troops rather than using a troop slot (change?)
    (assign, ":end", ":slot"),
    (try_for_range, ":i", 0, ":end"), #check troops of this prev_tier previously looped over, be sure this troop hasn't been checked
        (neq, ":i", ":slot"), #just to be sure
        (troop_slot_eq, "trp_temp_array_b", ":i", ":troop_no"),
        (assign, ":end", 0), #break loop, found in checked list
    (try_end),
    (neq, ":end", 0),
    #Caba - end
    (store_div, ":posx", ":slot", 10),
    (val_mul, ":posx", troop_tree_space_x),
    (val_add, ":posx", troop_tree_left),
    (troop_get_slot, ":posy", "trp_temp_array_c", ":slot"),
    (val_add, ":num", 1),
    (call_script, "script_prsnt_upgrade_tree_troop_and_name", ":troop_no", ":posx", ":posy"),
    (troop_set_slot, "trp_temp_array_c", ":num", reg1),
    (troop_set_slot, "trp_temp_array_b", ":num", ":troop_no"),
    (store_mod, ":cur_slot",  ":slot", 10),
    (gt, ":cur_slot", 0),
    ## Draw lines to next troops, if found
    (store_sub, ":cur_slot1", ":slot", ":cur_slot"),
    (val_add,  ":cur_slot1", 10),   
    (store_add, ":cur_slot2", ":cur_slot1", 10),
    (try_for_range, ":slot2", ":cur_slot1", ":cur_slot2"),
        (troop_slot_ge, "trp_temp_array_b", ":slot2", 1),
        (troop_slot_eq, "trp_temp_array_a", ":slot2", ":cur_slot"),
        #Caba - check for duplication - loop over past troops rather than using a troop slot (change?)
        (troop_get_slot, ":troop_no", "trp_temp_array_b", ":slot2"),
        (assign, ":end", ":slot2"),
        (try_for_range, ":i", ":cur_slot1", ":end"), #check troops of this prev_tier previously looped over, be sure this troop hasn't been checked
            (neq, ":i", ":cur_slot1"), #just to be sure           
            (troop_slot_eq,  "trp_temp_array_b", ":i", ":troop_no"),
            (assign, ":posy_to_use", ":i"),
            (assign, ":end", 0), #break loop, found in checked list
        (try_end),
        (try_begin),
            (neq, ":end", 0),
            (assign, ":posy_to_use", ":slot2"),
        (try_end),
        #Caba - end
        (store_add, ":posx2", ":posx", troop_tree_space_x),
        (store_add, ":posx1", ":posx", troop_tree_space_x/2),
        (troop_get_slot, ":posy2", "trp_temp_array_c", ":posy_to_use"), #caba ":slot2"),
        (store_add, ":posy1", ":posy", troop_tree_space_y/2),
        (val_add, ":posy2", troop_tree_space_y/2),
        #Caba
        (try_begin),
            (neq, ":end", 0),
        #Caba - end
            (call_script, "script_prsnt_lines_to", ":posx", ":posy1", ":posx2", ":posy2", title_black),
            (val_sub, ":posy2", 3),
            (call_script, "script_prsnt_upgrade_tree_troop_cost", ":troop_no", ":posx1", ":posy2"),
        #Caba 
        (else_try),
            (val_sub, ":posy2", 20),
            (store_sub, ":posx3", ":posx2", 20),
            (call_script, "script_prsnt_lines_to", ":posx", ":posy1", ":posx3", ":posy2", title_black),
            (call_script, "script_prsnt_lines_to", ":posx3", ":posy2", ":posx2", ":posy2", title_black),
        (try_end),
        #Caba - end
    (try_end),   
  (try_end),
  (troop_set_slot, "trp_temp_array_c", 100, ":num"),
  ]),
# dynamic troop tree end =================================================================


]


On a side note, when rearrangimg the mesh file...

do we insert that block of txt marked with the # # pair where it shows in that sopiler, then comment out the lines below where they normally would be?  or have i misunderstoood this section?
like so...


Snip form module_meshes.py

meshes = [
  ("pic_bandits", 0, "pic_bandits", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_mb_warrior_1", 0, "pic_mb_warrior_1", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_messenger", 0, "pic_messenger", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_prisoner_man", 0, "pic_prisoner_man", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_prisoner_fem", 0, "pic_prisoner_fem", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_prisoner_wilderness", 0, "pic_prisoner_wilderness", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_siege_sighted", 0, "pic_siege_sighted", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_siege_sighted_fem", 0, "pic_siege_sighted_fem", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_camp", 0, "pic_camp", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_payment", 0, "pic_payment", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_escape_1", 0, "pic_escape_1", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_escape_1_fem", 0, "pic_escape_1_fem", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_victory", 0, "pic_victory", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_defeat", 0, "pic_defeat", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_wounded", 0, "pic_wounded", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_wounded_fem", 0, "pic_wounded_fem", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_steppe_bandits", 0, "pic_steppe_bandits", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_mountain_bandits", 0, "pic_mountain_bandits", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_sea_raiders", 0, "pic_sea_raiders", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_deserters", 0, "pic_deserters", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_forest_bandits", 0, "pic_forest_bandits", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_cattle", 0, "pic_cattle", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_looted_village", 0, "pic_looted_village", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_village_p", 0, "pic_village_p", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_village_s", 0, "pic_village_s", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_village_w", 0, "pic_village_w", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_recruits", 0, "pic_recruits", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_arms_swadian", 0, "pic_arms_swadian", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_arms_vaegir", 0, "pic_arms_vaegir", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_arms_khergit", 0, "pic_arms_khergit", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_arms_nord", 0, "pic_arms_nord", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_arms_rhodok", 0, "pic_arms_rhodok", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_sarranid_arms", 0, "pic_sarranid_arms", 0, 0, 0, 0, 0, 0, 1, 1, 1),
 
# dynamic troop tree begin =================================================================
  ("pic_swad", 0, "pic_swad", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_vaegir", 0, "pic_vaegir", 0, 0, 0, 0, 0, 0, 1, 1, 1), 
  ("pic_khergit", 0, "pic_khergit", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_nord", 0, "pic_nord", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_rhodock", 0, "pic_rhodock", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_sarranid_encounter", 0, "pic_sarranid_encounter", 0, 0, 0, 0, 0, 0, 1, 1, 1),
# dynamic troop tree end ==================================================================
 
  ("pic_castle1", 0, "pic_castle1", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_castledes", 0, "pic_castledes", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_castlesnow", 0, "pic_castlesnow", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_charge", 0, "pic_charge", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  #("pic_khergit", 0, "pic_khergit", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  #("pic_nord", 0, "pic_nord", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  #("pic_rhodock", 0, "pic_rhodock", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_sally_out", 0, "pic_sally_out", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_siege_attack", 0, "pic_siege_attack", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  #("pic_swad", 0, "pic_swad", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_town1", 0, "pic_town1", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_towndes", 0, "pic_towndes", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_townriot", 0, "pic_townriot", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_townsnow", 0, "pic_townsnow", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  #("pic_vaegir", 0, "pic_vaegir", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("pic_villageriot", 0, "pic_villageriot", 0, 0, 0, 0, 0, 0, 1, 1, 1),
  #("pic_sarranid_encounter", 0, "pic_sarranid_encounter", 0, 0, 0, 0, 0, 0, 1, 1, 1),
 
  ("mp_score_a", 0, "mp_score_a", 0, 0, 0, 0, 0, 0, 1, 1, 1),
 



EDIT:

ok I have found solutions to these problems.  The "updated" script section by Caba'drin is only a partial replacement for the original one.  You still need to add in the last sections from the OP

First the script    ("prsnt_lines_to",...
and second the section designated as  # Rubik CC's   

These are not duplicated in Caba's post, it only covers the one script.  Amazing what debugging at some time other than 1AM can do for you.


Still a question on if I did the meshes file correctly?  or will I run into some problems down the road by doing it the way I have posted above.
 
There is no "done" button on the troop tree main page

Here is how I fixed this.  If you have a better way please let me know.



Code:
("faction_troop_tree", 0, mesh_load_window,
 [(ti_on_presentation_load,
  [(presentation_set_duration, 999999),
   (set_fixed_point_multiplier, 1000),
   # Title
   (position_set_y, pos1, title_pos_y), (position_set_x, pos1, title_pos_x),  # Title Position
   (position_set_x, pos3, title_size),  (position_set_y, pos3, title_size),   # Title Size
   (create_text_overlay, reg0, "str_faction_troop_tree", tf_center_justify), (overlay_set_color, reg0, title_black),
   (overlay_set_position, reg0, pos1), (overlay_set_size, reg0, pos3),
   (position_set_y, pos1, title_pos_y-1),  (position_set_x, pos1, title_pos_x-1),  # Title Position
   (create_text_overlay, reg0, "str_faction_troop_tree", tf_center_justify), (overlay_set_color, reg0, title_red),
   (overlay_set_position, reg0, pos1), (overlay_set_size, reg0, pos3),      
   # Create Objects
   (create_combo_label_overlay, "$g_presentation_obj_1"), #type
   (position_set_x, pos1, title_pos_x), (position_set_y, pos1, title_pos_y-50), (overlay_set_position, "$g_presentation_obj_1",  pos1),
   
   ## back Button added by eswallie
   (create_game_button_overlay, "$g_presentation_obj_2", "@Done"),
   (position_set_x, pos1, 900),
   (position_set_y, pos1, 25),
   (overlay_set_position, "$g_presentation_obj_2", pos1),
   ## Back button added by eswallie
   
   
   # Objects
   (assign, ":hi_faction", "fac_kingdoms_end"),
   (try_begin),
      (faction_slot_eq, "fac_player_supporters_faction", slot_faction_state, sfs_inactive),
      (assign, ":lo_faction", "fac_kingdom_1"),
   (else_try),
      (assign, ":lo_faction", "fac_player_supporters_faction"),
   (try_end),
   (try_for_range, ":faction", ":lo_faction", ":hi_faction"),
      (str_store_faction_name, s1, ":faction"),
      (overlay_add_item,  "$g_presentation_obj_1", s1),
   (try_end),
   (store_sub, reg12, ":hi_faction", ":lo_faction"),
   (val_clamp, reg11, 0, reg12),
   (overlay_set_val,  "$g_presentation_obj_1", reg11),
   (store_add, "$faction_display", ":lo_faction", reg11),
   (faction_get_slot, ":culture", "$faction_display", slot_faction_culture),
   (call_script, "script_prsnt_culture_troop_tree", ":culture"), ]),
   
 (ti_on_presentation_event_state_change, 
  [(store_trigger_param_1, ":object"),
   (store_trigger_param_2, ":value"),
   (set_fixed_point_multiplier, 1000),
   (try_begin), 
     (eq, ":object", "$g_presentation_obj_1"),
     (assign, reg11, ":value"),     
     (start_presentation, "prsnt_faction_troop_tree"),
   (else_try),
     (troop_get_slot, ":limit", "trp_temp_array_c", 100),
     (val_add, ":limit", 1), (assign, ":troop_no", 0),
     (try_for_range, ":slot", 101, ":limit"),
        (le, ":troop_no", 0),
        (troop_slot_eq, "trp_temp_array_c", ":slot", ":object"),
        (troop_get_slot, ":troop_no", "trp_temp_array_b", ":slot"),
     (try_end),      
     (gt, ":troop_no", 0),
     (assign, "$temp", ":troop_no"), 
     (assign, "$g_presentation_next_presentation", "prsnt_faction_troop_tree"),
     (start_presentation, "prsnt_troop_note"),
   (try_end),
   
   ## Back button code added by eswallie
   (try_begin),
     (eq, ":object", "$g_presentation_obj_2"),
     (presentation_set_duration, 0),
   (try_end), 
   ## Back button code added by eswallie
  ]
 ), 
  
   ## Event to process when running the presentation
  (ti_on_presentation_run,
   [(try_begin),
      (this_or_next|key_clicked, key_escape),
      (key_clicked, key_right_mouse_button),
      (presentation_set_duration, 0),
      (assign, "$faction_display", 0),
      (jump_to_menu, "mnu_reports"), # I asume it's called from report menu, you can modify it to any menus or using $next_menu declarated by menu that call this presentation
    (try_end), ]),

 ]
),
 
eswallie said:
There is no "done" button on the troop tree main page

Here is how I fixed this.  If you have a better way please let me know.



Code:
("faction_troop_tree", 0, mesh_load_window,
 [(ti_on_presentation_load,
  [(presentation_set_duration, 999999),
   (set_fixed_point_multiplier, 1000),
   # Title
   (position_set_y, pos1, title_pos_y), (position_set_x, pos1, title_pos_x),  # Title Position
   (position_set_x, pos3, title_size),  (position_set_y, pos3, title_size),   # Title Size
   (create_text_overlay, reg0, "str_faction_troop_tree", tf_center_justify), (overlay_set_color, reg0, title_black),
   (overlay_set_position, reg0, pos1), (overlay_set_size, reg0, pos3),
   (position_set_y, pos1, title_pos_y-1),  (position_set_x, pos1, title_pos_x-1),  # Title Position
   (create_text_overlay, reg0, "str_faction_troop_tree", tf_center_justify), (overlay_set_color, reg0, title_red),
   (overlay_set_position, reg0, pos1), (overlay_set_size, reg0, pos3),      
   # Create Objects
   (create_combo_label_overlay, "$g_presentation_obj_1"), #type
   (position_set_x, pos1, title_pos_x), (position_set_y, pos1, title_pos_y-50), (overlay_set_position, "$g_presentation_obj_1",  pos1),
   
   ## back Button added by eswallie
   (create_game_button_overlay, "$g_presentation_obj_2", "@Done"),
   (position_set_x, pos1, 900),
   (position_set_y, pos1, 25),
   (overlay_set_position, "$g_presentation_obj_2", pos1),
   ## Back button added by eswallie
   
   
   # Objects
   (assign, ":hi_faction", "fac_kingdoms_end"),
   (try_begin),
      (faction_slot_eq, "fac_player_supporters_faction", slot_faction_state, sfs_inactive),
      (assign, ":lo_faction", "fac_kingdom_1"),
   (else_try),
      (assign, ":lo_faction", "fac_player_supporters_faction"),
   (try_end),
   (try_for_range, ":faction", ":lo_faction", ":hi_faction"),
      (str_store_faction_name, s1, ":faction"),
      (overlay_add_item,  "$g_presentation_obj_1", s1),
   (try_end),
   (store_sub, reg12, ":hi_faction", ":lo_faction"),
   (val_clamp, reg11, 0, reg12),
   (overlay_set_val,  "$g_presentation_obj_1", reg11),
   (store_add, "$faction_display", ":lo_faction", reg11),
   (faction_get_slot, ":culture", "$faction_display", slot_faction_culture),
   (call_script, "script_prsnt_culture_troop_tree", ":culture"), ]),
   
 (ti_on_presentation_event_state_change, 
  [(store_trigger_param_1, ":object"),
   (store_trigger_param_2, ":value"),
   (set_fixed_point_multiplier, 1000),
   (try_begin), 
     (eq, ":object", "$g_presentation_obj_1"),
     (assign, reg11, ":value"),     
     (start_presentation, "prsnt_faction_troop_tree"),
   (else_try),
     (troop_get_slot, ":limit", "trp_temp_array_c", 100),
     (val_add, ":limit", 1), (assign, ":troop_no", 0),
     (try_for_range, ":slot", 101, ":limit"),
        (le, ":troop_no", 0),
        (troop_slot_eq, "trp_temp_array_c", ":slot", ":object"),
        (troop_get_slot, ":troop_no", "trp_temp_array_b", ":slot"),
     (try_end),      
     (gt, ":troop_no", 0),
     (assign, "$temp", ":troop_no"), 
     (assign, "$g_presentation_next_presentation", "prsnt_faction_troop_tree"),
     (start_presentation, "prsnt_troop_note"),
   (try_end),
   
   ## Back button code added by eswallie
   (try_begin),
     (eq, ":object", "$g_presentation_obj_2"),
     (presentation_set_duration, 0),
   (try_end), 
   ## Back button code added by eswallie
  ]
 ), 
  
   ## Event to process when running the presentation
  (ti_on_presentation_run,
   [(try_begin),
      (this_or_next|key_clicked, key_escape),
      (key_clicked, key_right_mouse_button),
      (presentation_set_duration, 0),
      (assign, "$faction_display", 0),
      (jump_to_menu, "mnu_reports"), # I asume it's called from report menu, you can modify it to any menus or using $next_menu declarated by menu that call this presentation
    (try_end), ]),

 ]
),

Thank you,  eswallie .  This is what I wanted to ask. :grin:
 
OK new question...  i would like this to show the mercenary tree, the sword sister tree, and the various bandits.  taiga bandits mountain bandits etc. that can be upgraded into a new unit.


i have been poking around in the code but every change i try to make to get this to work just breaks it entirely.  any help on this would be greatly appreciated.


i am sure it is an easy fix for someone  more familiar with the mod system than i.  i am more of fix it with a hammer type of  warband coder.  i need a scalpel user for this.






Looking at this again...


  #try-else block here to get 'troop-no' (or above) for non-kingdom trees
  (faction_get_slot, ":troop_no", ":culture", slot_faction_tier_1_troop),
  # lowest troop tiers initialization BEGIN
  (troop_set_slot, "trp_temp_array_a", 0, 1),          # Number of Lowest Tier Troop
  (troop_set_slot, "trp_temp_array_a", 1, 1),          # 1 for 1st troop
  (troop_set_slot, "trp_temp_array_b", 1, ":troop_no"), # 1st troop id
  # lowest troop tiers initialization END


this section of code seems to me that it is suggesting i use a try try block to get troop_no which will be the starting point for a faction...  what exactly would this try block look like?  what is it looking for?



It would seem to me that basically it is finding the id number of the troop that is the beginning troop for a faction so we have a start point to step through the tree and fill out the faction array.  but where is the starting troop for a faction defined?
 
where is the starting troop for a faction defined?
In the game_start script, where all of the basics get set up.

For this code you want to do, you'll need to write an else block for all of the non-Faction troop trees. 

But I don't even think that's needed.  I don't think troop_get_upgrade_troop existed when this was written and probably it can be greatly shortened by simply checking to see if it returns any value other than -1, instead of manually winding through the Faction troop slot definitions.
 
xenoargh said:
But I don't even think that's needed.  I don't think troop_get_upgrade_troop existed when this was written and probably it can be greatly shortened by simply checking to see if it returns any value other than -1, instead of manually winding through the Faction troop slot definitions.
?
The only faction slot definition that dunde's code uses is the first one to get the recruit troop. It then loops through uses of troop_get_upgrade_troop (an operation that has long, long been present) to generate a list of troops, by tier, in the trp_temp_array_x slots.

There are a number of places you'll need to make changes to get the non-kingdom factions in
[+]"prsnt_faction_troop_tree" - need to (overlay_add_item,  "$g_presentation_obj_1" ) with the extra factions to make it an option and
[+] re-work the code that goes from that overlay's value to (call_script, "script_prsnt_culture_troop_tree", ":culture"),  since the non-kingdom factions don't have a culture set, so you'll want to simply pass the faction ID
[+]"script_prsnt_culture_troop_tree" - the top needs to be reworked if you want an appropriate mesh set
[+] then the else-try to set up where the script should start the troop_get_upgrade_troop loops; you'll essentially want the follow:
Code:
(try_begin),
  (eq, ":culture", "fac_manhunters"),
  (troop_set_slot, "trp_temp_array_a", 0, 1),           # Number of Lowest Tier Troop
  (troop_set_slot, "trp_temp_array_a", 1, 1),           # 1 for 1st troop
  (troop_set_slot, "trp_temp_array_b", 1, "trp_FIRST_MANHUNTER_TROOP_HERE"), # 1st troop id
(else_try),
   (eq, ":culture", "fac_<whoever>"),
   #again
(else_try),
  (faction_get_slot, ":troop_no", ":culture", slot_faction_tier_1_troop),
  (troop_set_slot, "trp_temp_array_a", 0, 1),           # Number of Lowest Tier Troop
  (troop_set_slot, "trp_temp_array_a", 1, 1),           # 1 for 1st troop
  (troop_set_slot, "trp_temp_array_b", 1, ":troop_no"), # 1st troop id
(try_end),

I'm not sure how well the system will do for the mercenary tree, given that you'll need to make 2 starting troop definitions (farmer and whatever the other merc is) that then merge. To get the merging to work at all, you'd need to use my additions...but I never toyed with giving it 2 tier 1 troops, so not sure.
 
Well in the merc tree there is "farmer" as the beginning for the normal mercs, and then "peasant woman" as the beginning for the female side.  the female troop tree also can begin with "refugee" but i an nor sure what these are, or where you find them.  to my knowledge i have never seen them in the game.  There are also some townsmen etc that jump to the mercenary tree as well.  but just getitng it to start at "farmer" is fine by me.  I would like to get the female side of the mercenary tree in as well, however they are in faction commoners as well, so that may be a bit more difficult.




another thing i had been trying is to do something like this...


in constants

Code:
# Dynamic troop tree begin ==================================================================================
slot_faction_tier_0_troop         = 40
# Dynamic troop tree end ==================================================================================



and then in scripts under ("game_start",
Code:
# dynamic troop tree begin ================================================================
			(faction_set_slot, "fac_culture_1",  slot_faction_tier_0_troop, "trp_forest_bandit"),
			(faction_set_slot, "fac_culture_2",  slot_faction_tier_0_troop, "trp_taiga_bandit"),
			(faction_set_slot, "fac_culture_3",  slot_faction_tier_0_troop, "trp_steppe_bandit"),
			(faction_set_slot, "fac_culture_4",  slot_faction_tier_0_troop, "trp_sea_raider"),
			(faction_set_slot, "fac_culture_5",  slot_faction_tier_0_troop, "trp_mountain_bandit"),
			(faction_set_slot, "fac_culture_6",  slot_faction_tier_0_troop, "trp_desert_bandit"),
# dynamic troop tree end =================================================================

and again under ("prsnt_culture_troop_tree",

Code:
#try-else block here to get 'troop-no' (or above) for non-kingdom trees
#  (faction_get_slot, ":troop_no", ":culture", slot_faction_tier_1_troop),
  (faction_get_slot, ":troop_no", ":culture", slot_faction_tier_0_troop),
  # lowest troop tiers initialization BEGIN

but this does not seem to work...  I have either missed something or this idea or tier_0_troop just does not work out.  I was hoping to get the bandit that leads into each faction on the presentation as well.  I am in no way an expert on warband coding, more like a total noob.  so any help on this aspect would be great as well.








Ok got it working.... mostly.

the display is a bit scrambled.  I just posted a hyperlink to he img so you can look at it full size to see what is going on.

http://dl.dropbox.com/u/75023494/mb_warband%202012-05-10%2021-40-51-22.jpg

here is the upgrade section of troops.py

Code:
#Troop upgrade declarations

#1
#upgrade(troops,"farmer", "watchman")
#upgrade(troops,"townsman","watchman")
upgrade2(troops,"farmer", "watchman","courier")
upgrade2(troops,"townsman","watchman","courier")

#2
#upgrade2(troops,"watchman","caravan_guard","mercenary_crossbowman")
upgrade2(troops,"watchman","mercenary_crossbowman","town_guard")
upgrade(troops,"courier","caravan_guard")
#3
#upgrade2(troops,"caravan_guard","mercenary_swordsman","mercenary_horseman")
upgrade2(troops,"caravan_guard","caravan_master","mercenary_horseman")
upgrade(troops,"town_guard","mercenary_swordsman")
upgrade(troops,"mercenary_crossbowman","mercenary_sharpshooter")

#4
#upgrade(troops,"mercenary_swordsman","hired_blade")
upgrade(troops,"mercenary_horseman","mercenary_cavalry")
upgrade(troops,"mercenary_swordsman","hired_blade")
 
Back
Top Bottom