OSP Code SP In-Game Armour Customization with Tutorial

Users who are viewing this thread

Added Narf's Men at Arms armor sets, the folder contains extra textures. You'll also need the original textures here.
nord1.jpg
nord2.jpg

Code:
["aketon", "Aketon", [("aketon",0)], itp_merchandise| itp_type_body_armor|itp_covers_legs|itp_civilian,0,
 325 , weight(3)|abundance(100)|head_armor(0)|body_armor(22)|leg_armor(6)|difficulty(0) ,imodbits_cloth,
 [(ti_on_init_item, 
  [
    (store_trigger_param_1, ":agent_no"),
    # (gt, ":agent_no", -1),
    (store_trigger_param_2, ":troop_no"),
    (call_script, "script_init_aketon", ":agent_no", ":troop_no", 1),
    (cur_item_add_mesh, s1), #submesh 1
    (call_script, "script_init_aketon", ":agent_no", ":troop_no", 2),
    (cur_item_add_mesh, s1), #submesh 2
    (try_begin),
      (troop_is_hero, ":troop_no"),
      (item_get_slot, ":color", "itm_aketon", slot_item_player_color),
      (gt, ":color", -1),
    (else_try),
      (store_random_in_range, ":color", 0, 6),
    (try_end),
    
    (val_mod, ":color", 6),
    (str_clear, s1),
    (val_add, ":color", "str_hose_r"),
    (str_store_string, s1, ":color"),
    (cur_item_set_material, s1, 2), #second mesh = legs
    ])
  ]],
["aketon_kneecops", "Aketon with Plate", [("aketon",0)], itp_merchandise| itp_type_body_armor|itp_covers_legs|itp_civilian,0,
 575 , weight(6)|abundance(100)|head_armor(0)|body_armor(32)|leg_armor(15)|difficulty(0) ,imodbits_plate,
 [(ti_on_init_item, 
  [
    (store_trigger_param_1, ":agent_no"),
    (store_trigger_param_2, ":troop_no"),
    (try_begin),
      (item_get_slot, ":color", "itm_aketon_kneecops", slot_item_player_slots_end - 1),
      (neq, ":color", 0), #enabled by default
      (call_script, "script_init_aketon_kneecops", ":agent_no", ":troop_no", 3, 0),
      (cur_item_add_mesh, s1), #submesh 1 accessory
    (try_end),
    
    (try_begin),
      (item_get_slot, ":color", "itm_aketon_kneecops", slot_item_player_slots_begin),
      (eq, ":color", -1),
      (store_random_in_range, ":color", 0, 2),
    (try_end),
    (call_script, "script_init_aketon_kneecops", ":agent_no", ":troop_no", 2, ":color"),
    (cur_item_add_mesh, s1), #submesh 2 legs
    (call_script, "script_init_aketon_kneecops", ":agent_no", ":troop_no", 1, 0),
    (cur_item_add_mesh, s1), #submesh 3 arms

    (try_begin),
      (troop_is_hero, ":troop_no"),
      (item_get_slot, ":color", "itm_aketon_kneecops", slot_item_player_color),
      (gt, ":color", -1),
    (else_try),
      (store_random_in_range, ":color", 0, 6),
    (try_end),
    (val_mod, ":color", 6),
    (str_clear, s1),
    (val_add, ":color", "str_hose_r"),
    (str_store_string, s1, ":color"),
    (cur_item_set_material, s1, 2), #second mesh = legs

    ])
  ]],
  
["hauberk", "Hauberk", [("aketon_hauberk",0)], itp_merchandise|itp_type_body_armor|itp_covers_legs,0,
 1544 , weight(18)|abundance(100)|head_armor(0)|body_armor(42)|leg_armor(14)|difficulty(7) ,imodbits_armor,
 [(ti_on_init_item, 
  [
    (store_trigger_param_1, ":agent_no"),
    (store_trigger_param_2, ":troop_no"),

    (call_script, "script_init_hauberk", ":agent_no", ":troop_no", 0, 0),
    (cur_item_add_mesh, s1), #submesh 1, under the mail
    (try_begin),
      (item_get_slot, ":color", "itm_hauberk", slot_item_player_slots_begin + 1),
      (eq, ":color", -1),
      (store_random_in_range, ":color", 0, 2),
    (try_end),
    (val_mod, ":color", 2),
    (call_script, "script_init_hauberk", ":agent_no", ":troop_no", 2, ":color"),
    (cur_item_add_mesh, s1), #submesh 2, legs
    (try_begin),
      (troop_is_hero, ":troop_no"),
      (item_get_slot, ":color", "itm_hauberk", slot_item_player_color),
      (gt, ":color", -1),
    (else_try),
      (store_random_in_range, ":color", 0, 6),
    (try_end),
    (val_mod, ":color", 6),
    (str_clear, s1),
    (val_add, ":color", "str_hose_r"),
    (str_store_string, s1, ":color"),
    (cur_item_set_material, s1, 2), #third mesh = legs
    #add arms, can be chain+cloth, chain+jack+cloth, or chain+plate
    (try_begin),
      (item_get_slot, ":color", "itm_hauberk", slot_item_player_slots_begin),
      (eq, ":color", -1),
      #skip the simple variant
      (store_random_in_range, ":color", 0, 2),
      (val_add, ":color", armor_armor),
    (try_end),
    (call_script, "script_init_hauberk", ":agent_no", ":troop_no", 1, ":color"),
    (try_begin),
      (eq, ":color", armor_plate),
      # (call_script, "script_init_hauberk", ":agent_no", ":troop_no", 1, armor_plate),
      (cur_item_add_mesh, s1), #submesh 3, mail under
      # (call_script, "script_init_hauberk", ":agent_no", ":troop_no", 3, armor_plate),
      (cur_item_add_mesh, s2), #submesh 4, plate over
    (else_try),
      (eq, ":color", armor_armor),
      # (call_script, "script_init_hauberk", ":agent_no", ":troop_no", 1, armor_armor),
      (cur_item_add_mesh, s1), #submesh 3, arm under
      # (call_script, "script_init_hauberk", ":agent_no", ":troop_no", 3, armor_armor),
      (cur_item_add_mesh, s2), #submesh 4, mail sleeve over
      (try_begin), #added jack on top
        (item_get_slot, ":color", "itm_hauberk", slot_item_player_slots_end - 1),
        (neq, ":color", 0),
        (call_script, "script_init_hauberk", ":agent_no", ":troop_no", 3, 0),
        (cur_item_add_mesh, s1), #submesh 5, jack over mail/cloth
      (try_end),
    (else_try),
      # (call_script, "script_init_hauberk", ":agent_no", ":troop_no", 1, armor_cloth),
      (cur_item_add_mesh, s1), #submesh 3, arm under
    (try_end),

    ])
  ]],
  
["brigandine_cloth", "Brigandine", [("brigandine_torso",0)], itp_merchandise|itp_type_body_armor|itp_covers_legs,0,
 1720 , weight(22)|abundance(60)|head_armor(0)|body_armor(43)|leg_armor(14)|difficulty(7) ,imodbits_cloth,
 [(ti_on_init_item, 
  [
    (store_trigger_param_1, ":agent_no"),
    (store_trigger_param_2, ":troop_no"),

    (try_begin),
      (troop_is_hero, ":troop_no"),
      (item_get_slot, ":color", "itm_brigandine_cloth", slot_item_player_color),
      (gt, ":color", -1),
    (else_try),
      (store_random_in_range, ":color", 0, 5),
    (try_end),
    (val_mod, ":color", 5), #RGBY + Black
    (str_clear, s1),
    (val_add, ":color", "str_brigandine_r"),
    (str_store_string, s1, ":color"),
    (cur_item_set_material, s1, 0), #base mesh = torso
    
    (call_script, "script_init_brigandine_cloth", ":agent_no", ":troop_no", 2, armor_cloth),
    (cur_item_add_mesh, s1), #submesh 1, legs
    (store_random_in_range, ":color", 0, 6),
    (val_mod, ":color", 6),
    (str_clear, s1),
    (val_add, ":color", "str_hose_r"),
    (str_store_string, s1, ":color"),
    (cur_item_set_material, s1, 1), #first mesh

    (call_script, "script_init_brigandine_cloth", ":agent_no", ":troop_no", 1, armor_cloth),
    (cur_item_add_mesh, s1), #submesh 2, arms
    (try_begin),
      (troop_is_hero, ":troop_no"),
      (item_get_slot, ":color", "itm_brigandine_cloth", slot_item_player_slots_end - 1),
      (neq, ":color", 0), #enabled by default
      (call_script, "script_init_brigandine_cloth", ":agent_no", ":troop_no", 3, 0),
      (cur_item_add_mesh, s1), #submesh 3, jack over arms
    (try_end),
    ])
  ]],
  
["brigandine_mail", "Brigandine and Mail", [("brigandine_torso",0)], itp_merchandise|itp_type_body_armor|itp_covers_legs,0,
 3828 , weight(25)|abundance(50)|head_armor(0)|body_armor(52)|leg_armor(16)|difficulty(8) ,imodbits_armor,
 [(ti_on_init_item, 
  [
    (store_trigger_param_1, ":agent_no"),
    (store_trigger_param_2, ":troop_no"),
    (try_begin),
      (troop_is_hero, ":troop_no"),
      (item_get_slot, ":color", "itm_brigandine_mail", slot_item_player_color),
      (gt, ":color", -1),
    (else_try),
      (store_random_in_range, ":color", 0, 5),
    (try_end),
    (val_mod, ":color", 5), #RGBY + Black
    (str_clear, s1),
    (val_add, ":color", "str_brigandine_r"),
    (str_store_string, s1, ":color"),
    (cur_item_set_material, s1, 0), #base mesh = torso
    
    (try_begin), #slot 2
      (item_get_slot, ":color", "itm_brigandine_mail", slot_item_player_slots_begin),
      (eq, ":color", -1),
      (try_begin),
        (troop_is_hero, ":troop_no"),
        (store_add, ":color", ":troop_no", 3),
      (else_try),
        (agent_is_active, ":agent_no"),
        (store_add, ":color", ":agent_no", 2),
      (else_try),
        (store_random_in_range, ":color", 0, 2),
        (val_add, ":color", 1), #do not normally use cloth
      (try_end),
    (try_end),
    (val_mod, ":color", 3),
    (call_script, "script_init_brigandine_mail", ":agent_no", ":troop_no", 2, ":color"),
    (cur_item_add_mesh, s1), #submesh 1, legs
    (store_random_in_range, ":color", 0, 6),
    (val_mod, ":color", 6),
    (str_clear, s1),
    (val_add, ":color", "str_hose_r"),
    (str_store_string, s1, ":color"),
    (cur_item_set_material, s1, 1), #first mesh

    (call_script, "script_init_brigandine_mail", ":agent_no", ":troop_no", 1, 0),
    (cur_item_add_mesh, s1), #submesh 2, arms
    #add in extra mail
    (try_begin),
      (item_get_slot, ":color", "itm_brigandine_mail", slot_item_player_slots_end - 1),
      (this_or_next|neq, ":color", 0), #enabled by default
      (neg|troop_is_hero, ":troop_no"),
      (call_script, "script_init_brigandine_mail", ":agent_no", ":troop_no", 3, 0),
      (cur_item_add_mesh, s1), #submesh 3, jack over arms
    (try_end),
    (try_begin),
      (item_get_slot, ":color", "itm_brigandine_mail", slot_item_player_slots_end - 2),
      (this_or_next|neq, ":color", 0), #enabled by default
      (neg|troop_is_hero, ":troop_no"),
      (call_script, "script_init_brigandine_mail", ":agent_no", ":troop_no", 3, 1),
      (cur_item_add_mesh, s1), #submesh 4, over legs
    (try_end),
    
    ])
  ]],
  
["brigandine_plate", "Brigandine and Plate", [("brigandine_torso",0)], itp_merchandise| itp_type_body_armor|itp_covers_legs,0,
 4330 , weight(26)|abundance(40)|head_armor(0)|body_armor(55)|leg_armor(18)|difficulty(9) ,imodbits_plate,
 [(ti_on_init_item, 
  [
    (store_trigger_param_1, ":agent_no"),
    (store_trigger_param_2, ":troop_no"),
    (store_random_in_range, ":color", 0, 5),
    (try_begin),
      (troop_is_hero, ":troop_no"),
      (item_get_slot, ":color", "itm_brigandine_plate", slot_item_player_color),
      (gt, ":color", -1),
    (else_try),
      (store_random_in_range, ":color", 0, 5),
    (try_end),
    (str_clear, s1),
    (val_add, ":color", "str_brigandine_r"),
    (str_store_string, s1, ":color"),
    (cur_item_set_material, s1, 0), #base mesh = torso
    
    (try_begin), #slot 2
      (item_get_slot, ":color", "itm_brigandine_plate", slot_item_player_slots_begin + 1),
      (eq, ":color", -1),
      (try_begin),
        (troop_is_hero, ":troop_no"),
        (store_add, ":color", ":troop_no", 3),
      (else_try),
        (agent_is_active, ":agent_no"),
        (store_add, ":color", ":agent_no", 2),
      (else_try),
        (store_random_in_range, ":color", 0, 2),
      (try_end),
    (try_end),

    (val_mod, ":color", 2),
    (call_script, "script_init_brigandine_plate", ":agent_no", ":troop_no", 2, ":color"),
    (cur_item_add_mesh, s1), #submesh 1, legs
    (store_random_in_range, ":color", 0, 6),
    (val_mod, ":color", 6),
    (str_clear, s1),
    (val_add, ":color", "str_hose_r"),
    (str_store_string, s1, ":color"),
    (cur_item_set_material, s1, 1), #first mesh


    (try_begin),
      (item_get_slot, ":arms", "itm_brigandine_plate", slot_item_player_slots_begin),
      (eq, ":arms", -1),
      (store_random_in_range, ":arms", 0, 2),
    (try_end),
    (call_script, "script_init_brigandine_plate", ":agent_no", ":troop_no", 1, ":arms"),
    #two variants, mail + skirt or cloth plated arms
    (cur_item_add_mesh, s1), #submesh 2, under arms base
    (cur_item_add_mesh, s2), #submesh 3, over arms plate
    (try_begin),
      (item_get_slot, ":value", "itm_brigandine_plate", slot_item_player_slots_end - 2),
      (this_or_next|eq, ":value", -1), #enabled by default
      (eq, ":value", 1), #turned on
      (call_script, "script_init_brigandine_plate", ":agent_no", ":troop_no", 3, 1),
      (cur_item_add_mesh, s1), #submesh 4, Rondel/Besagew
    (try_end),
    (try_begin), #not cloth, add mail skirt
      (item_get_slot, ":value", "itm_brigandine_plate", slot_item_player_slots_end - 1),
      (neq, ":value", 0), #not disabled
      (this_or_next|eq, ":value", 1), #on
      (neq, ":arms", 0), #arm is valid
      (call_script, "script_init_brigandine_plate", ":agent_no", ":troop_no", 3, 0),
      (cur_item_add_mesh, s1), #submesh 5, over legs
    (try_end),
    ])
  ]],
Code:
    (try_for_range, ":item_no", "itm_aketon", "itm_brigandine_cloth"),
      (item_set_slot, ":item_no", slot_item_materials_begin, "str_hose_r"),
      (item_set_slot, ":item_no", slot_item_materials_end, "str_hood_r"),
      (try_for_range, ":slot_no", slot_item_player_slots_begin, slot_item_player_slots_end + 1),
        (item_set_slot, ":item_no", ":slot_no", -1),
      (try_end),
    (try_end),
    (item_set_slot, "itm_aketon", slot_item_init_script, "script_init_aketon"),
    (item_set_slot, "itm_aketon_kneecops", slot_item_init_script, "script_init_aketon_kneecops"),
    (item_set_slot, "itm_hauberk", slot_item_init_script, "script_init_hauberk"),
    (item_set_slot, "itm_aketon", slot_item_num_components, 3),
    (item_set_slot, "itm_aketon_kneecops", slot_item_num_components, 3),
    (item_set_slot, "itm_hauberk", slot_item_num_components, 4),
    
    #6 if you include legs
    (assign, ":script", "script_init_brigandine_cloth"),
    (store_add, ":end", "itm_brigandine_plate", 1),
    (store_add, ":str_end", "str_brigandine_x", 1),
    (try_for_range, ":item_no", "itm_brigandine_cloth", ":end"),
      (item_set_slot, ":item_no", slot_item_materials_begin, "str_brigandine_r"),
      (item_set_slot, ":item_no", slot_item_materials_end, "str_horse_pa"),
      (item_set_slot, ":item_no", slot_item_init_script, ":script"),
      (try_for_range, ":slot_no", slot_item_player_slots_begin, slot_item_player_slots_end + 1),
        (item_set_slot, ":item_no", ":slot_no", -1),
      (try_end),
      (val_add, ":script", 1),
    (try_end),
    (item_set_slot, "itm_brigandine_cloth", slot_item_num_components, 4),
    (item_set_slot, "itm_brigandine_mail", slot_item_num_components, 4),
    (item_set_slot, "itm_brigandine_plate", slot_item_num_components, 4),
    (item_set_slot, "itm_kettle_hood", slot_item_materials_begin, "str_hood_r"),
    (item_set_slot, "itm_kettle_hood", slot_item_materials_end, "str_brigandine_r"),
    (item_set_slot, "itm_kettle_hood", slot_item_init_script, "script_init_chapel_de_fer"),
    (item_set_slot, "itm_kettle_hood", slot_item_player_color, -1),
Code:
  #script_init_aketon
  #input: agent_no, troop_no, sub_mesh, sub_mats
  #output: s1, "$g_custom_armor_param_count" (number of submaterials), "$g_custom_armor_mandatory" (mandatory or accessory)
  #can also output category name for presentation? (torso/arms/legs)
  ("init_aketon",
    [
    (store_script_param, ":agent_no", 1),
    (store_script_param, ":troop_no", 2),
    (store_script_param, ":sub_mesh", 3), #0 is torso, 1 is arm, 2 is legs
    # (store_script_param, ":sub_mats", 4), #0 is torso, 1 is arm, 2 is legs
    (str_clear, s1),
    #item parameters, 1 mesh variation and both are mandatory
    (assign, "$g_custom_armor_param_count", 1),
    (assign, "$g_custom_armor_mandatory", 1),
    (try_begin),
      (eq, ":sub_mesh", 1),
      (str_store_string, s1, "@brigandine_arms_cloth"),
    (else_try),
      (eq, ":sub_mesh", 2),
      (str_store_string, s1, "@aketon_legs_cloth"),
    (else_try),
      (assign, "$g_custom_armor_param_count", 0),
      (assign, "$g_custom_armor_mandatory", 0),
    (try_end),
    # (display_message, s1),
    ]
  ),
  
  ("init_aketon_kneecops",
    [
    (store_script_param, ":agent_no", 1),
    (store_script_param, ":troop_no", 2),
    (store_script_param, ":sub_mesh", 3), #0 is torso, 1 is arm, 2 is legs, 3 is accessory
    (store_script_param, ":sub_mats", 4), #0/1 plate legs
    (str_clear, s1),
    (assign, "$g_custom_armor_param_count", 1),
    (assign, "$g_custom_armor_mandatory", 1),

    (try_begin), #not sub_mesh 0
      (eq, ":sub_mesh", 3),
      (eq, ":sub_mats", 0),
      (assign, "$g_custom_armor_mandatory", 0), #jacks can be removed
      (str_store_string, s1, "@aketon_hauberk_arms_jack"),
    (else_try), #cloth arms
      (eq, ":sub_mesh", 1),
      (eq, ":sub_mats", 0),
      (str_store_string, s1, "@brigandine_arms_cloth"),
    (else_try), #legs
      (eq, ":sub_mesh", 2),
      (assign, "$g_custom_armor_param_count", 2),
      (try_begin),
        (eq, ":sub_mats", 0),
        (str_store_string, s1, "@aketon_legs_kneecop"),
      (else_try),
        (eq, ":sub_mats", 1),
        (str_store_string, s1, "@aketon_legs_plate"),
      (try_end),
    (else_try),
      (assign, "$g_custom_armor_param_count", 0),
      (assign, "$g_custom_armor_mandatory", 0),
    (try_end),
    # (display_message, s1),
    ]
  ),
  
  ("init_hauberk",
    [
    (store_script_param, ":agent_no", 1),
    (store_script_param, ":troop_no", 2),
    (store_script_param, ":sub_mesh", 3),
    (store_script_param, ":sub_mats", 4),
    (str_clear, s1),
    (str_clear, s2),
    (assign, "$g_custom_armor_param_count", 1),
    (assign, "$g_custom_armor_mandatory", 1),

    (try_begin), #torso
      (eq, ":sub_mesh", 0),
      (eq, ":sub_mats", armor_cloth),
      (str_store_string, s1, "@aketon_hauberk_torso"),
    (else_try), #arms
      (eq, ":sub_mesh", 1),
      (assign, "$g_custom_armor_param_count", 3),
      (try_begin),
        (eq, ":sub_mats", armor_cloth),
        (str_store_string, s1, "@brigandine_arms_mail"),
      (else_try),
        (eq, ":sub_mats", armor_armor),
        (str_store_string, s1, "@aketon_hauberk_arms_underjack"),
        (str_store_string, s2, "@aketon_hauberk_arms_chainmail"),
      (else_try),
        # (troop_is_hero, ":troop_no"),
        (eq, ":sub_mats", armor_plate),
        (str_store_string, s1, "@brigandine_arms_platemail"),
        (str_store_string, s2, "@brigandine_arms_plate"),
      (try_end),
    (else_try), #legs
      (eq, ":sub_mesh", 2),
      (call_script, "script_init_aketon_kneecops", ":agent_no", ":troop_no", ":sub_mesh", ":sub_mats"),
      (assign, "$g_custom_armor_param_count", 2),
      (assign, "$g_custom_armor_mandatory", 1),
    (else_try), #accessory, secondary arm meshes
      (eq, ":sub_mesh", 3),
      (assign, "$g_custom_armor_param_count", 2),
      (assign, "$g_custom_armor_mandatory", 0),
      (try_begin),
        (eq, ":sub_mats", armor_cloth),
        (str_store_string, s1, "@aketon_hauberk_arms_jack"),
      (else_try),
        (eq, ":sub_mats", armor_armor),
        (str_store_string, s1, "@brigandine_arms_plate_rondel"),
        (assign, "$g_custom_armor_mandatory", 0),
        # (str_store_string, s1, "@aketon_hauberk_arms_chainmail"),
        # (assign, "$g_custom_armor_mandatory", 0),
      # (else_try),
        # (eq, ":sub_mats", armor_plate),
        # (str_store_string, s1, "@brigandine_arms_plate"),
        # (assign, "$g_custom_armor_mandatory", 1),
      (try_end),
    (else_try),
      (assign, "$g_custom_armor_param_count", 0),
      (assign, "$g_custom_armor_mandatory", 0),
    (try_end),
    ]
  ),
  #the basis for the 3 brigandine archetypes
  ("init_brigandine",
    [
    # (store_script_param, ":agent_no", 1),
    # (store_script_param, ":troop_no", 2),
    (store_script_param, ":sub_mesh", 3), #0 is torso, 1 is legs, 2 is arms, 3+ are accessory
    (store_script_param, ":sub_mats", 4),
    (str_clear, s1),
    (str_clear, s2),
    (assign, "$g_custom_armor_param_count", 3),
    (assign, "$g_custom_armor_mandatory", 1),

    (try_begin),  #arms
      # (eq, ":sub_mesh", 0),
      # (assign, "$g_custom_armor_param_count", 2),
      # (try_begin),
        # (eq, ":sub_mats", armor_cloth),
        # (str_store_string, s1, "@brigandine_arms_platecloth"),
      # (else_try),
        # (eq, ":sub_mats", armor_armor),
        # (str_store_string, s1, "@brigandine_arms_platemail"),
      # (try_end),
    # (else_try),

      (eq, ":sub_mesh", 1),
      (assign, "$g_custom_armor_param_count", 4), #arms plate/cloth
      (try_begin),
        (eq, ":sub_mats", armor_cloth),
        (str_store_string, s1, "@brigandine_arms_cloth"),
      (else_try),
        (eq, ":sub_mats", armor_armor), #rest added in accessories
        (str_store_string, s1, "@brigandine_arms_undermail"), #brigandine_arms_mail works too
      (else_try),
        (eq, ":sub_mats", armor_plate),
        (str_store_string, s1, "@brigandine_arms_platecloth"),
        (str_store_string, s2, "@brigandine_arms_plate"),
      (else_try),
        (eq, ":sub_mats", armor_plate + 1),
        (str_store_string, s1, "@brigandine_arms_platemail"),
        (str_store_string, s2, "@brigandine_arms_plate"),
      (try_end),
    (else_try), #legs
      (eq, ":sub_mesh", 2),
      (try_begin),
        (eq, ":sub_mats", armor_cloth),
        (str_store_string, s1, "@brigandine_leg_cloth"),
      (else_try),
        (eq, ":sub_mats", armor_armor),
        (str_store_string, s1, "@brigandine_leg_plate_short"),
      (else_try),
        (eq, ":sub_mats", armor_plate),
        (str_store_string, s1, "@brigandine_leg_plate_long"),
      (try_end),
    (else_try), #accessories (for arm)
      (eq, ":sub_mesh", 3),
      (assign, "$g_custom_armor_param_count", 4),
      (assign, "$g_custom_armor_mandatory", 0),
      (try_begin),
        (eq, ":sub_mats", 0),
        (str_store_string, s1, "@aketon_hauberk_arms_jack"),
      (else_try),
        (eq, ":sub_mats", 1),
        (str_store_string, s1, "@brigandine_mail_sleeves"),
      (else_try),
        (eq, ":sub_mats", 2),
        (str_store_string, s1, "@brigandine_mail_skirt"),
      (else_try),
        (eq, ":sub_mats", 3),
        (str_store_string, s1, "@brigandine_arms_plate_rondel"),
      (try_end),
    (else_try),
      (assign, "$g_custom_armor_param_count", 0),
      (assign, "$g_custom_armor_mandatory", 0),
    (try_end),
    # (display_message, s1),
    ]
  ),
  
  ("init_brigandine_cloth",
    [
    (store_script_param, ":agent_no", 1),
    (store_script_param, ":troop_no", 2),
    (store_script_param, ":sub_mesh", 3),
    (store_script_param, ":sub_mats", 4),
    (str_clear, s1),
    (str_clear, s2),
    (assign, "$g_custom_armor_param_count", 1),
    (assign, "$g_custom_armor_mandatory", 1),
    (try_begin),  #arms
      (eq, ":sub_mesh", 1),
      (eq, ":sub_mats", armor_cloth),
      (call_script, "script_init_brigandine", ":agent_no", ":troop_no", ":sub_mesh", armor_cloth),
      # (str_store_string, s1, "@brigandine_arms_cloth"),
      (assign, "$g_custom_armor_param_count", 1),
    (else_try), #legs
      (eq, ":sub_mesh", 2),
      (eq, ":sub_mats", armor_cloth),
      (call_script, "script_init_brigandine", ":agent_no", ":troop_no", ":sub_mesh", armor_cloth),
      (assign, "$g_custom_armor_param_count", 1),
    (else_try), #accessories (for arm)
      (eq, ":sub_mesh", 3),
      (eq, ":sub_mats", 0),
      (call_script, "script_init_brigandine", ":agent_no", ":troop_no", ":sub_mesh", 0),
      # (str_store_string, s1, "@aketon_hauberk_arms_jack"),
      (assign, "$g_custom_armor_param_count", 1),
      (assign, "$g_custom_armor_mandatory", 0),
    (else_try),
      (assign, "$g_custom_armor_param_count", 0),
      (assign, "$g_custom_armor_mandatory", 0),
    (try_end),
    # (display_message, s1),
    ]
  ),
  
  ("init_brigandine_mail",
    [
    (store_script_param, ":agent_no", 1),
    (store_script_param, ":troop_no", 2),
    (store_script_param, ":sub_mesh", 3),
    (store_script_param, ":sub_mats", 4),
    (str_clear, s1),
    (str_clear, s2),
    # (assign, "$g_custom_armor_param_count", 1),
    # (assign, "$g_custom_armor_mandatory", 1),
    (try_begin),  #arms
      (eq, ":sub_mesh", 1),
      (eq, ":sub_mats", 0),
      (call_script, "script_init_brigandine", ":agent_no", ":troop_no", ":sub_mesh", armor_armor),
      # (str_store_string, s1, "@brigandine_arms_cloth"),
      (assign, "$g_custom_armor_param_count", 1),
      (assign, "$g_custom_armor_mandatory", 1),
    (else_try), #legs
      (eq, ":sub_mesh", 2),
      (is_between, ":sub_mats", 0, 3), #enable cloth
      # (val_add, ":sub_mats", armor_armor),
      (call_script, "script_init_brigandine", ":agent_no", ":troop_no", ":sub_mesh", ":sub_mats"),
      (assign, "$g_custom_armor_param_count", 3), #3 variants
      (assign, "$g_custom_armor_mandatory", 1),
    (else_try), #add extra mail
      (eq, ":sub_mesh", 3),
      (is_between, ":sub_mats", 0, 2),
      (val_add, ":sub_mats", 1),
      (call_script, "script_init_brigandine", ":agent_no", ":troop_no", ":sub_mesh", ":sub_mats"),
        # (str_store_string, s1, "@aketon_hauberk_arms_jack"),
      (assign, "$g_custom_armor_param_count", 2),
      (assign, "$g_custom_armor_mandatory", 0),
    (else_try),
      (assign, "$g_custom_armor_param_count", 0),
      (assign, "$g_custom_armor_mandatory", 0),
    (try_end),
    ]
  ),
  ("init_brigandine_plate",
    [
    (store_script_param, ":agent_no", 1),
    (store_script_param, ":troop_no", 2),
    (store_script_param, ":sub_mesh", 3),
    (store_script_param, ":sub_mats", 4),
    (str_clear, s1),
    (str_clear, s2),

    (try_begin),  #arms, 2 types
      (eq, ":sub_mesh", 1),
      (is_between, ":sub_mats", 0, 2),
      (val_add, ":sub_mats", armor_plate),
      (call_script, "script_init_brigandine", ":agent_no", ":troop_no", ":sub_mesh", ":sub_mats"),
      (assign, "$g_custom_armor_param_count", 2),
      (assign, "$g_custom_armor_mandatory", 1),
    (else_try), #legs
      (eq, ":sub_mesh", 2),
      (is_between, ":sub_mats", 0, 2),
      (val_add, ":sub_mats", armor_armor),
      (call_script, "script_init_brigandine", ":agent_no", ":troop_no", ":sub_mesh", ":sub_mats"),
      (assign, "$g_custom_armor_param_count", 2),
      (assign, "$g_custom_armor_mandatory", 1),
    (else_try), #add extra mail
      (eq, ":sub_mesh", 3),
      (is_between, ":sub_mats", 0, 2),
      (val_add, ":sub_mats", 2),
      (call_script, "script_init_brigandine", ":agent_no", ":troop_no", ":sub_mesh", ":sub_mats"),
      (assign, "$g_custom_armor_param_count", 2),
      (assign, "$g_custom_armor_mandatory", 0),
    (else_try),
      (assign, "$g_custom_armor_param_count", 0),
      (assign, "$g_custom_armor_mandatory", 0),
    (try_end),
    ]
  ),
Code:
#narf material stuff
  ("hose_r", "hosen_red"),
  ("hose_g", "hosen_green"),
  ("hose_b", "hosen_blue"),
  ("hose_y", "hosen_yellow"),
  ("hose_grey", "hosen_grey"),
  ("hose_brown", "hosen_brown"),
  
  ("hood_r", "hood_red"),
  ("hood_g", "hood_green"),
  ("hood_b", "hood_blue"),
  ("hood_y", "hood_brown"),
  
  ("brigandine_r", "brigandine_red"),
  ("brigandine_g", "brigandine_green"),
  ("brigandine_b", "brigandine_blue"),
  ("brigandine_y", "brigandine_brown"),
  ("brigandine_x", "brigandine_black"),
 
Packed up some of the shield meshes (13.1mb into 564 kb) from CWE, will be working on helmets next. I will update the main post with some new code to customize non-armor meshes.

Code:
 #these three need different stats, the shield have been split up into top/bottom with the former added dynamically
 ["cwe_bandit_shield","Leather Round Shield", [("saracin_shield_bottom", 0)], itp_type_shield|itp_merchandise|itp_wooden_parry, itcf_carry_round_shield,133, weight(1)|abundance(100)|body_armor(10)|hit_points(165)|spd_rtng(109)|shield_height(35)|shield_width(35), imodbits_shield,
  [(ti_on_init_item, [
	(store_trigger_param_1, ":agent_no"),
	(store_trigger_param_2, ":troop_no"),
	(str_clear, s1),

	(try_begin), #shield face
	  (item_get_slot, ":value", "itm_cwe_bandit_shield", slot_item_player_slots_begin),
	  (eq, ":value", -1),
	  (store_random_in_range, ":value", 0, 3),
	(try_end),
	(call_script, "script_init_saracen_shield", ":agent_no", ":troop_no", 0, ":value"),
	(cur_item_add_mesh, s1),
	#subsurface
	(item_get_slot, ":start", "itm_cwe_bandit_shield", slot_item_materials_begin),
	(item_get_slot, ":end", "itm_cwe_bandit_shield", slot_item_materials_end),
	(try_begin), #material
	  (item_get_slot, ":color", "itm_cwe_bandit_shield", slot_item_player_color),
	  (eq, ":color", -1),
	  (store_random_in_range, ":color", ":start", ":end"),
	(else_try),
	  (val_add, ":color", ":start"),
	  (val_min, ":color", ":end"),
	(try_end),
	(str_store_string, s1, ":color"),
	(cur_item_set_material, s1, 1),
    ])
  ]],
 ["cwe_saracen_shield","Ornate Round Shield", [("saracin_shield_bottom", 0)], itp_type_shield|itp_merchandise|itp_wooden_parry, itcf_carry_round_shield,633, weight(2)|abundance(60)|body_armor(20)|hit_points(265)|spd_rtng(106)|shield_height(35)|shield_width(35), imodbits_shield,
   [(ti_on_init_item, [
	(store_trigger_param_1, ":agent_no"),
	(store_trigger_param_2, ":troop_no"),
	(str_clear, s1),

	(try_begin), #shield face
	  (item_get_slot, ":value", "itm_cwe_saracen_shield", slot_item_player_slots_begin),
	  (eq, ":value", -1),
	  (store_random_in_range, ":value", 0, 3),
	(try_end),
	(call_script, "script_init_saracen_shield", ":agent_no", ":troop_no", 0, ":value"),
	(cur_item_add_mesh, s1),
	#subsurface
	(item_get_slot, ":start", "itm_cwe_saracen_shield", slot_item_materials_begin),
	(item_get_slot, ":end", "itm_cwe_saracen_shield", slot_item_materials_end),
	(try_begin), #material
	  (item_get_slot, ":color", "itm_cwe_saracen_shield", slot_item_player_color),
	  (eq, ":color", -1),
	  (store_random_in_range, ":color", ":start", ":end"),
	(else_try),
	  (val_add, ":color", ":start"),
	  (val_min, ":color", ":end"),
	(try_end),
	(str_store_string, s1, ":color"),
	(cur_item_set_material, s1, 1),
    ])
  ]],
 ["cwe_turkish_shield","Engraved Round Shield", [("saracin_shield_bottom", 0)], itp_type_shield|itp_merchandise, itcf_carry_round_shield,933,weight(5)|abundance(20)|body_armor(40)|hit_points(365)|spd_rtng(93)|shield_height(35)|shield_width(35), imodbits_shield|imodbit_lordly,
   [(ti_on_init_item, [
	(store_trigger_param_1, ":agent_no"),
	(store_trigger_param_2, ":troop_no"),
	(str_clear, s1),

	(try_begin), #shield face
	  (item_get_slot, ":value", "itm_cwe_turkish_shield", slot_item_player_slots_begin),
	  (eq, ":value", -1),
	  (store_random_in_range, ":value", 0, 3),
	(try_end),
	(call_script, "script_init_saracen_shield", ":agent_no", ":troop_no", 0, ":value"),
	(cur_item_add_mesh, s1), #one material so we use original settings
    ])
  ]],
 ["cwe_shield_caravan","Round Shield", [("securiti_caravan_crusader_shield", 0)], itp_type_shield|itp_merchandise|itp_wooden_parry, itcf_carry_round_shield, 533, weight(2.5)|abundance(100)|body_armor(15)|hit_points(195)|spd_rtng(95)|shield_height(70)|shield_width(36), imodbits_shield, 
   [custom_reskin("itm_cwe_shield_caravan")]],
 ["cwe_shield_archer","Archer Shield", [("shields_archer_jerusalem_a", 0)], itp_type_shield|itp_merchandise|itp_wooden_parry, itcf_carry_round_shield, 170, weight(2)|abundance(100)|body_armor(1)|hit_points(165)|spd_rtng(100)|shield_height(37)|shield_width(33), imodbits_shield,
   [custom_reskin("itm_cwe_shield_archer")]],

 ["cwe_shield_basic","Teardrop Shield", [("jerusalem_shield_a", 0)], itp_type_shield|itp_merchandise|itp_wooden_parry, itcf_carry_kite_shield,205, weight(2.5)|abundance(100)|body_armor(14)|hit_points(200)|spd_rtng(103)|shield_height(50)|shield_width(30), imodbits_shield,
   [custom_reskin("itm_cwe_shield_basic")]],
 ["cwe_shield_veteran_1","Heater Shield", [("shield_veteran_jerusalem_a", 0)], itp_type_shield|itp_merchandise|itp_wooden_parry, itcf_carry_kite_shield,700, weight(3.5)|abundance(100)|body_armor(25)|hit_points(370)|spd_rtng(80)|shield_height(110)|shield_width(38), imodbits_shield, 
   [custom_reskin("itm_cwe_shield_veteran_1")]],
 ["cwe_shield_veteran_2","Kite Shield", [("shield_veteran_jerusalem_e", 0)], itp_type_shield|itp_merchandise|itp_wooden_parry, itcf_carry_kite_shield,700, weight(3.5)|abundance(100)|body_armor(25)|hit_points(370)|spd_rtng(80)|shield_height(110)|shield_width(38), imodbits_shield,
   [custom_reskin("itm_cwe_shield_veteran_2")]],
 ["cwe_shield_knight_1","Order Shield", [("shield_knight_jerusalem_a", 0)], itp_type_shield|itp_merchandise|itp_wooden_parry, itcf_carry_kite_shield,750, weight(3)|abundance(100)|body_armor(17)|hit_points(300)|spd_rtng(98)|shield_height(50)|shield_width(32), imodbits_shield|imodbit_lordly,
   [custom_reskin("itm_cwe_shield_knight_1")]],
  #no triggers, only 2 variants, unless we make this the heraldic version
 ["cwe_shield_knight_2","Squire Shield", [("ibelin_shield_knight_a", 0)], itp_type_shield|itp_merchandise|itp_wooden_parry, itcf_carry_kite_shield, 600, weight(2.5)|abundance(100)|body_armor(17)|hit_points(400)|spd_rtng(100)|shield_height(48)|shield_width(32), imodbits_shield|imodbit_lordly, []],
Code:
    (try_for_range, ":item_no", "itm_cwe_bandit_shield", "itm_cwe_shield_knight_2"),
      (try_for_range, ":slot_no", slot_item_player_slots_begin, slot_item_player_slots_end + 1),
        (item_set_slot, ":item_no", ":slot_no", -1),
      (try_end),
      (item_set_slot, ":item_no", slot_item_num_components, 1), #allows it to be customized
    (try_end),
    (item_set_slot, "itm_cwe_bandit_shield", slot_item_materials_begin, "str_cwe_buckler_7"),
    (item_set_slot, "itm_cwe_bandit_shield", slot_item_materials_end, "str_cwe_tear_shield_1a"),
    (item_set_slot, "itm_cwe_bandit_shield", slot_item_init_script, "script_init_saracen_shield"),
    (item_set_slot, "itm_cwe_saracen_shield", slot_item_materials_begin, "str_cwe_buckler_2"),
    (item_set_slot, "itm_cwe_saracen_shield", slot_item_materials_end, "str_cwe_buckler_7"),
    (item_set_slot, "itm_cwe_saracen_shield", slot_item_init_script, "script_init_saracen_shield"),
    (item_set_slot, "itm_cwe_turkish_shield", slot_item_materials_begin, "str_cwe_buckler_1"),
    (item_set_slot, "itm_cwe_turkish_shield", slot_item_materials_end, "str_cwe_buckler_2"),
    (item_set_slot, "itm_cwe_turkish_shield", slot_item_init_script, "script_init_saracen_shield"),
	
    (item_set_slot, "itm_cwe_shield_caravan", slot_item_materials_begin, "str_cwe_round_shield_1"),
    (item_set_slot, "itm_cwe_shield_caravan", slot_item_materials_end, "str_cwe_buckler_1"),
	(item_set_slot, "itm_cwe_shield_archer", slot_item_materials_begin, "str_cwe_archer_shield_1a"),
    (item_set_slot, "itm_cwe_shield_archer", slot_item_materials_end, "str_cwe_vheater_shield_1a"),
	(item_set_slot, "itm_cwe_shield_basic", slot_item_materials_begin, "str_cwe_tear_shield_1a"),
    (item_set_slot, "itm_cwe_shield_basic", slot_item_materials_end, "str_cwe_archer_shield_1a"),
	(item_set_slot, "itm_cwe_shield_veteran_1", slot_item_materials_begin, "str_cwe_vheater_shield_1a"),
    (item_set_slot, "itm_cwe_shield_veteran_1", slot_item_materials_end, "str_cwe_vkite_shield_1a"),
	(item_set_slot, "itm_cwe_shield_veteran_2", slot_item_materials_begin, "str_cwe_vkite_shield_1a"),
    (item_set_slot, "itm_cwe_shield_veteran_2", slot_item_materials_end, "str_cwe_knight_shield_1a"),
	(item_set_slot, "itm_cwe_shield_knight_1", slot_item_materials_begin, "str_cwe_knight_shield_1a"),
    (item_set_slot, "itm_cwe_shield_knight_1", slot_item_materials_end, "str_cwe_knight_shield_7a"),
Code:
    #3 different shield surfaces
    ("init_saracen_shield", [
      (store_script_param, ":agent_no", 1),
      (store_script_param, ":troop_no", 2),
      (store_script_param, ":sub_mesh", 3),
      (store_script_param, ":sub_material", 4),
      
      (str_clear, s1),
      
      (try_begin),
        (eq, ":sub_mesh", 0),
        (assign, "$g_custom_armor_mandatory", 1),
        (assign, "$g_custom_armor_param_count", 3),
        (try_begin),
          (eq, ":sub_material", 0),
          (str_store_string, s1, "@saracin_shield_top_bl"),
        (else_try),
          (eq, ":sub_material", 1),
          (str_store_string, s1, "@saracin_shield_top_br"),
        (else_try),
          (eq, ":sub_material", 2),
          (str_store_string, s1, "@saracin_shield_top_tr"),
        (try_end),
      (else_try),
        (assign, "$g_custom_armor_mandatory", 0),
        (assign, "$g_custom_armor_param_count", 0),
      (try_end),
    ]),
Code:
#shields
("cwe_round_shield_1", "securiti_caravan_crusader_shield"),
("cwe_round_shield_2", "saracin_shield_a"),
("cwe_round_shield_3", "saracin_shield_b"),
("cwe_round_shield_4", "saracin_shield_e"),
("cwe_round_shield_5", "saracin_shield_f"),
("cwe_round_shield_6", "saracin_shield_g"),

("cwe_buckler_1", "shield_vostoka_a"),
("cwe_buckler_2", "saracin_shield_c"),
("cwe_buckler_3", "saracin_shield_d"),
("cwe_buckler_4", "saracin_shield_h"),
("cwe_buckler_5", "saracin_shield_i"),
("cwe_buckler_6", "saracin_shield_k"),
("cwe_buckler_7", "bandit_shield_a"),
("cwe_buckler_8", "bandit_shield_b"),

("cwe_tear_shield_1a", "antioh_shield_a"),
("cwe_tear_shield_1b", "antioh_shield_b"),
("cwe_tear_shield_1c", "antioh_shield_c"),
("cwe_tear_shield_1d", "antioh_shield_d"),
("cwe_tear_shield_1e", "antioh_shield_e"),
("cwe_tear_shield_2a", "hospitaller_shield_a"),
("cwe_tear_shield_2b", "hospitaller_shield_b"),
("cwe_tear_shield_2c", "hospitaller_shield_c"),
("cwe_tear_shield_2d", "hospitaller_shield_d"),
#no ibelin shields
("cwe_tear_shield_3a", "jerusalem_shield_a"),
("cwe_tear_shield_3b", "jerusalem_shield_b"),
("cwe_tear_shield_3c", "jerusalem_shield_c"),
("cwe_tear_shield_3d", "jerusalem_shield_d"),
("cwe_tear_shield_4a", "templar_shield_a"),
("cwe_tear_shield_4b", "templar_shield_b"),
("cwe_tear_shield_4c", "templar_shield_c"),
("cwe_tear_shield_4d", "templar_shield_d"),
("cwe_tear_shield_5a", "tevton_shield_a"),
("cwe_tear_shield_5b", "tevton_shield_b"),
("cwe_tear_shield_5c", "tevton_shield_c"),
("cwe_tear_shield_5d", "tevton_shield_d"),
("cwe_tear_shield_5e", "tevton_shield_e"),
("cwe_tear_shield_6a", "tripoli_shield_a"),
("cwe_tear_shield_6b", "tripoli_shield_b"),
("cwe_tear_shield_6c", "tripoli_shield_c"),
("cwe_tear_shield_6d", "tripoli_shield_d"),
("cwe_tear_shield_6e", "tripoli_shield_e"),

("cwe_archer_shield_1a", "shields_archer_antioh_a"),
("cwe_archer_shield_1b", "shields_archer_antioh_b"),
("cwe_archer_shield_2a", "shields_archer_hospitaller_a"),
("cwe_archer_shield_2b", "shields_archer_hospitaller_b"),
("cwe_archer_shield_3a", "shields_archer_ibelin_a"),
("cwe_archer_shield_3b", "shields_archer_ibelin_b"),
("cwe_archer_shield_4a", "shields_archer_jerusalem_a"),
("cwe_archer_shield_4b", "shields_archer_jerusalem_b"),
("cwe_archer_shield_5a", "shields_archer_templar_a"),
("cwe_archer_shield_5b", "shields_archer_templar_b"),
("cwe_archer_shield_6a", "shields_archer_tevton_a"),
("cwe_archer_shield_6b", "shields_archer_tevton_b"),
("cwe_archer_shield_7a", "shields_archer_tripoli_a"),
("cwe_archer_shield_7b", "shields_archer_tripoli_b"),

("cwe_vheater_shield_1a", "shield_veteran_antioh_a"),
("cwe_vheater_shield_1b", "shield_veteran_antioh_b"),
("cwe_vheater_shield_1c", "shield_veteran_antioh_c"),
("cwe_vheater_shield_1d", "shield_veteran_antioh_d"),
("cwe_vheater_shield_2a", "shield_veteran_hospital_a"),
("cwe_vheater_shield_2b", "shield_veteran_hospital_b"),
("cwe_vheater_shield_2c", "shield_veteran_hospital_c"),
("cwe_vheater_shield_2d", "shield_veteran_hospital_d"),
("cwe_vheater_shield_3a", "shield_veteran_ibelin_a"),
("cwe_vheater_shield_3b", "shield_veteran_ibelin_b"),
("cwe_vheater_shield_3c", "shield_veteran_ibelin_c"),
("cwe_vheater_shield_4a", "shield_veteran_jerusalem_a"),
("cwe_vheater_shield_4b", "shield_veteran_jerusalem_b"),
("cwe_vheater_shield_4c", "shield_veteran_jerusalem_c"),
("cwe_vheater_shield_4d", "shield_veteran_jerusalem_d"),
("cwe_vheater_shield_5a", "shield_veteran_templar_a"),
("cwe_vheater_shield_5b", "shield_veteran_templar_b"),
("cwe_vheater_shield_5b", "shield_veteran_templar_c"),
("cwe_vheater_shield_5b", "shield_veteran_templar_d"),
("cwe_vheater_shield_6a", "shield_veteran_tevton_a"),
("cwe_vheater_shield_6b", "shield_veteran_tevton_b"),
("cwe_vheater_shield_6b", "shield_veteran_tevton_c"),
("cwe_vheater_shield_6b", "shield_veteran_tevton_d"),
("cwe_vheater_shield_7a", "shield_veteran_tripoli_a"),
("cwe_vheater_shield_7b", "shield_veteran_tripoli_b"),
("cwe_vheater_shield_7c", "shield_veteran_tripoli_c"),
("cwe_vheater_shield_7d", "shield_veteran_tripoli_d"),

("cwe_vkite_shield_1a", "shield_veteran_antioh_e"),
("cwe_vkite_shield_1b", "shield_veteran_antioh_f"),
("cwe_vkite_shield_1c", "shield_veteran_antioh_g"),
("cwe_vkite_shield_1d", "shield_veteran_antioh_h"),
("cwe_vkite_shield_2a", "shield_veteran_hospital_e"),
("cwe_vkite_shield_2b", "shield_veteran_hospital_f"),
("cwe_vkite_shield_2c", "shield_veteran_hospital_g"),
("cwe_vkite_shield_2d", "shield_veteran_hospital_h"),
("cwe_vkite_shield_3a", "shield_veteran_hospital_h"),
("cwe_vkite_shield_3b", "shield_veteran_hospital_e"),
("cwe_vkite_shield_3a", "shield_veteran_ibelin_d"),
("cwe_vkite_shield_3b", "shield_veteran_ibelin_e"),
("cwe_vkite_shield_4a", "shield_veteran_jerusalem_e"),
("cwe_vkite_shield_4b", "shield_veteran_jerusalem_f"),
("cwe_vkite_shield_4c", "shield_veteran_jerusalem_g"),
("cwe_vkite_shield_4d", "shield_veteran_jerusalem_h"),
("cwe_vkite_shield_5a", "shield_veteran_templar_e"),
("cwe_vkite_shield_5b", "shield_veteran_templar_f"),
("cwe_vkite_shield_5c", "shield_veteran_templar_g"),
("cwe_vkite_shield_5d", "shield_veteran_templar_h"),
("cwe_vkite_shield_6a", "shield_veteran_tevton_e"),
("cwe_vkite_shield_6b", "shield_veteran_tevton_f"),
("cwe_vkite_shield_6c", "shield_veteran_tevton_g"),
("cwe_vkite_shield_6d", "shield_veteran_tevton_h"),
("cwe_vkite_shield_7a", "shield_veteran_tripoli_e"),
("cwe_vkite_shield_7b", "shield_veteran_tripoli_f"),
("cwe_vkite_shield_7c", "shield_veteran_tripoli_g"),
("cwe_vkite_shield_7d", "shield_veteran_tripoli_h"),

("cwe_knight_shield_1a", "shield_knight_antioh_a"),
("cwe_knight_shield_1b", "shield_knight_antioh_b"),
("cwe_knight_shield_1c", "shield_knight_antioh_c"),
("cwe_knight_shield_1d", "shield_knight_antioh_d"),
("cwe_knight_shield_2a", "shield_knight_hospitaller_a"),
("cwe_knight_shield_2b", "shield_knight_hospitaller_b"),
("cwe_knight_shield_2c", "shield_knight_hospitaller_c"),
("cwe_knight_shield_2d", "shield_knight_hospitaller_d"),
# ("cwe_knight_shield_3a", "shield_knight_ibelin_a"),
# ("cwe_knight_shield_3b", "shield_knight_ibelin_b"),
("cwe_knight_shield_3a", "shield_knight_jerusalem_a"),
("cwe_knight_shield_3b", "shield_knight_jerusalem_b"),
("cwe_knight_shield_3c", "shield_knight_jerusalem_c"),
("cwe_knight_shield_3d", "shield_knight_jerusalem_d"),
("cwe_knight_shield_4a", "shield_knight_templar_a"),
("cwe_knight_shield_4b", "shield_knight_templar_b"),
("cwe_knight_shield_4c", "shield_knight_templar_c"),
("cwe_knight_shield_4d", "shield_knight_templar_d"),
("cwe_knight_shield_4e", "shield_knight_templar_e"),
("cwe_knight_shield_4f", "shield_knight_templar_f"),
("cwe_knight_shield_4g", "shield_knight_templar_g"),
("cwe_knight_shield_4h", "shield_knight_templar_h"),
("cwe_knight_shield_4k", "shield_knight_templar_k"), #no i/j for some reason
("cwe_knight_shield_5a", "shield_knight_templar_a"),
("cwe_knight_shield_5b", "shield_knight_templar_b"),
("cwe_knight_shield_5c", "shield_knight_templar_c"),
("cwe_knight_shield_5d", "shield_knight_templar_d"),
("cwe_knight_shield_5e", "shield_knight_templar_e"),
("cwe_knight_shield_5f", "shield_knight_templar_f"),
("cwe_knight_shield_5g", "shield_knight_templar_g"),
("cwe_knight_shield_5h", "shield_knight_templar_h"),
("cwe_knight_shield_6a", "shield_knight_tripoli_a"),
("cwe_knight_shield_6b", "shield_knight_tripoli_b"),
("cwe_knight_shield_6c", "shield_knight_tripoli_c"),
("cwe_knight_shield_6d", "shield_knight_tripoli_d"),
("cwe_knight_shield_7a", "shield_knight_ibelin_a"),
("cwe_knight_shield_7b", "shield_knight_ibelin_b"),
 
Hell yeah!

Played around with the coding this morning. I think this is the OSP that's going to pull me back into modding  :grin:

 
Yeah I was. As I recall, many of the WFAS outfits would be easy to modify since they mostly use similar meshes and break apart into seperate coats, pants, belts, and pouches, etc
 
Small update with a bunch of helmets, namely Narf's sallets that I thought I uploaded. Note that these uses 2 feather textures from CWE, so remove duplicate definitions if both OSP are used.

Code:
["kettle_cloth", "Kettle Hat", [("chapel_cloth",0)], itp_merchandise| itp_type_head_armor | itp_attach_armature,0, 125 , weight(2.75)|abundance(100)|head_armor(35)|body_armor(0)|leg_armor(0)|difficulty(7), imodbits_plate,
 [(ti_on_init_item,
  [
    (store_trigger_param_1, ":agent_no"),
    (store_trigger_param_2, ":troop_no"),
    (str_clear, s1),
    (try_begin),
      (item_get_slot, ":armor", "itm_kettle_cloth", slot_item_player_slots_begin),
      (eq, ":armor", -1),
      (call_script, "script_randomize_chapel_de_fer", ":agent_no", ":troop_no"),
    (else_try),
      (call_script, "script_init_chapel_de_fer", ":agent_no", ":troop_no", 0, ":armor"),
    (try_end),
    (cur_item_add_mesh, s1),
    ])
  ]],
["kettle_hood", "Kettle Hood", [("sallet_hood_red",0)], itp_merchandise| itp_type_head_armor | itp_attach_armature,0, 132 , weight(2.75)|abundance(50)|head_armor(35)|body_armor(1)|leg_armor(0)|difficulty(7), imodbits_plate,
 [(ti_on_init_item,
  [
    (store_trigger_param_1, ":agent_no"),
    (store_trigger_param_2, ":troop_no"),
    (str_clear, s1),
    (item_get_slot, ":start", "itm_kettle_hood", slot_item_materials_begin),
    (item_get_slot, ":end", "itm_kettle_hood", slot_item_materials_end),
    (store_sub, ":total", ":end", ":start"),
    (try_begin),
      (gt, ":troop_no", -1),
      (troop_is_hero, ":troop_no"),
      (item_get_slot, ":color", "itm_kettle_hood", slot_item_player_color),
      (neq, ":color", -1),
    (else_try),
      (store_random_in_range, ":color", 0, ":total"),
      (try_begin),
        (troop_is_hero, ":troop_no"),
        (store_add, ":color", ":troop_no", 1),
      (else_try),
        (agent_is_active, ":agent_no"),
        (store_add, ":color", ":agent_no", 2),
      (try_end),
    (try_end),
    (val_mod, ":color", ":total"),
    (val_add, ":color", ":start"),
    (str_store_string, s1, ":color"),
    (cur_item_set_material, s1, 0),

    (try_begin),
      (item_get_slot, ":armor", "itm_kettle_hood", slot_item_player_slots_begin),
      (eq, ":armor", -1),
      (call_script, "script_randomize_chapel_de_fer", ":agent_no", ":troop_no"),
    (else_try),
      (call_script, "script_init_chapel_de_fer", ":agent_no", ":troop_no", 0, ":armor"),
    (try_end),
    (cur_item_add_mesh, s1),
    ])
  ]],
["kettle_mail", "Kettle Coif", [("chapel_mail",0)], itp_merchandise| itp_type_head_armor | itp_attach_armature,0, 175 , weight(2.75)|abundance(100)|head_armor(36)|body_armor(2)|leg_armor(0)|difficulty(7), imodbits_plate,
 [(ti_on_init_item,
  [
    (store_trigger_param_1, ":agent_no"),
    (store_trigger_param_2, ":troop_no"),
    (try_begin),
      (item_get_slot, ":armor", "itm_kettle_mail", slot_item_player_slots_begin),
      (eq, ":armor", -1),
      (call_script, "script_randomize_chapel_de_fer", ":agent_no", ":troop_no"),
    (else_try),
      (call_script, "script_init_chapel_de_fer", ":agent_no", ":troop_no", 0, ":armor"),
    (try_end),
    (cur_item_add_mesh, s1),
    ])
  ]],
  

["narf_kettle_hat1", "Kettle Hat with Bevor", [("sallet_kettlehat",0)], itp_type_head_armor|itp_merchandise|itp_attach_armature,0, 293 , weight(1.5)|abundance(75)|head_armor(37)|body_armor(2)|leg_armor(0)|difficulty(7) ,imodbits_armor,
 # [add_mesh(["@sallet_bevor","@sallet_strap_bevor","@sallet_kettlehat_feather"])],],
 [(ti_on_init_item, [
    (store_trigger_param_1, ":agent_no"),
    (store_trigger_param_2, ":troop_no"),
    (str_clear, s1),
    (str_clear, s2),
    (try_begin),
      (call_script, "script_init_narf_kettle_hat", ":agent_no", ":troop_no", 0, 0),
      (cur_item_add_mesh, s1),
      (cur_item_add_mesh, s2),
    (try_end),
    (try_begin),
      (troop_is_hero, ":troop_no"),
      (neg|item_slot_eq, "itm_narf_kettle_hat1", slot_item_player_slots_end - 1, 0),
      (call_script, "script_init_narf_kettle_hat", ":agent_no", ":troop_no", 1, 0),
      (cur_item_add_mesh, s1),
    (try_end),
  ])
]],


["narf_kettle_hat2", "Kettle Hat with Hood", [("sallet_hood_red",0)], itp_type_head_armor|itp_merchandise|itp_attach_armature,0, 193 , weight(1.5)|abundance(75)|head_armor(35)|body_armor(1)|leg_armor(0)|difficulty(7) ,imodbits_armor,
 # [add_mesh(["@sallet_bevor","@sallet_strap_bevor","@sallet_kettlehat_feather"])],],
 [(ti_on_init_item, [
    (store_trigger_param_1, ":agent_no"),
    (store_trigger_param_2, ":troop_no"),
    (str_clear, s1),
    
    (item_get_slot, ":start", "itm_narf_kettle_hat2", slot_item_materials_begin),
    (item_get_slot, ":end", "itm_narf_kettle_hat2", slot_item_materials_end),
    (store_sub, ":total", ":end", ":start"),
    (try_begin),
      (gt, ":troop_no", -1),
      (troop_is_hero, ":troop_no"),
      (item_get_slot, ":value", "itm_narf_kettle_hat2", slot_item_player_color),
      (neq, ":value", -1),
      (val_mod, ":value", ":total"),
      (val_add, ":value", ":start"),
    (else_try),
      (store_random_in_range, ":value", ":start", ":end"),
    (try_end),
    (str_store_string, s1, ":value"),
    (cur_item_set_material, s1, 0),
    
    #add actual helmet next
    (call_script, "script_init_narf_kettle_hat", ":agent_no", ":troop_no", 2, 0),
    (cur_item_add_mesh, s1),
    (try_begin), #feather
      (troop_is_hero, ":troop_no"),
      (neg|item_slot_eq, "itm_narf_kettle_hat2", slot_item_player_slots_end - 1, 0),
      (call_script, "script_init_narf_kettle_hat", ":agent_no", ":troop_no", 1, 0),
      (cur_item_add_mesh, s1),
    (try_end),
  ])
]],

["narf_sallet1", "Open Sallet", [("sallet_strap_bevor",0)], itp_merchandise|itp_type_head_armor|itp_attach_armature,0, 479 , weight(2.25)|abundance(75)|head_armor(44)|body_armor(3)|leg_armor(0)|difficulty(8), imodbits_plate,
 # [add_mesh(["@sallet_strap_chin","@sallet_a_open_feather"])],],
 [(ti_on_init_item, [
    (store_trigger_param_1, ":agent_no"),
    (store_trigger_param_2, ":troop_no"),
    (str_clear, s1),
    (try_begin), #bevor
      (item_get_slot, ":armor", "itm_narf_sallet1", slot_item_player_slots_begin),
      (eq, ":armor", -1),
      (assign, ":armor", 0),
    (try_end),
    (try_begin), #add helmet + bevor
      (call_script, "script_init_narf_sallet", ":agent_no", ":troop_no", 2, 0),
      (neg|str_is_empty, s1),
      (cur_item_add_mesh, s1),
      (call_script, "script_init_narf_sallet", ":agent_no", ":troop_no", 0, ":armor"),
      (neg|str_is_empty, s1),
      (cur_item_add_mesh, s1),
    (try_end),
    
    (try_begin),
      (troop_is_hero, ":troop_no"),
      (assign, ":color", 3),
      (try_for_range, ":slots", slot_item_player_slots_end - 3, slot_item_player_slots_end), #feather
        (val_sub, ":color", 1),
        (item_slot_eq, "itm_narf_sallet1", ":slots", 1),
        (call_script, "script_init_narf_sallet", ":agent_no", ":troop_no", 1, ":color"),
        (cur_item_add_mesh, s1),
      (try_end),
    (try_end),
  ])
]],

["narf_sallet2", "Closed Sallet", [("sallet_strap_neck",0)], itp_merchandise|itp_type_head_armor|itp_attach_armature|itp_covers_beard, 0, 479, weight(2.5)|abundance(100)|head_armor(45)|body_armor(4)|leg_armor(0)|difficulty(8), imodbits_plate,
 # [add_mesh(["@sallet_c_feather","@sallet_bevor","@sallet_strap_bevor"])],],
 [(ti_on_init_item, [
    (store_trigger_param_1, ":agent_no"),
    (store_trigger_param_2, ":troop_no"),
    (str_clear, s1),
    (try_begin), #bevor
      (item_get_slot, ":armor", "itm_narf_sallet2", slot_item_player_slots_begin),
      (eq, ":armor", -1),
      (assign, ":armor", 1),
    (try_end),
    (try_begin), #add helmet + bevor
      (call_script, "script_init_narf_sallet", ":agent_no", ":troop_no", 2, 1),
      (neg|str_is_empty, s1),
      (cur_item_add_mesh, s1),
      (call_script, "script_init_narf_sallet", ":agent_no", ":troop_no", 0, ":armor"),
      (neg|str_is_empty, s1),
      (cur_item_add_mesh, s1),
    (try_end),
    
    (try_begin),
      (troop_is_hero, ":troop_no"),
      (assign, ":color", 3),
      (try_for_range, ":slots", slot_item_player_slots_end - 3, slot_item_player_slots_end), #feather
        (val_sub, ":color", 1),
        (item_slot_eq, "itm_narf_sallet2", ":slots", 1),
        (call_script, "script_init_narf_sallet", ":agent_no", ":troop_no", 1, ":color"),
        (cur_item_add_mesh, s1),
      (try_end),
    (try_end),
  ])
]],

["narf_sallet3", "Footmen Sallet", [("sallet_strap_chin",0)], itp_merchandise|itp_type_head_armor|itp_attach_armature, 0, 479, weight(2.0)|abundance(100)|head_armor(44)|body_armor(0)|leg_armor(0)|difficulty(8), imodbits_plate,
 # [add_mesh("@sallet_strap_neck")]],
  [(ti_on_init_item, [
    (store_trigger_param_1, ":agent_no"),
    (store_trigger_param_2, ":troop_no"),
    (str_clear, s1),
    (try_begin), #bevor
      (item_get_slot, ":armor", "itm_narf_sallet3", slot_item_player_slots_begin),
      (eq, ":armor", -1),
      (assign, ":armor", 2), #strap
    (try_end),
    (call_script, "script_init_narf_sallet", ":agent_no", ":troop_no", 0, ":armor"),
    (try_begin), #add helmet + bevor
      (neg|str_is_empty, s1),
      (cur_item_add_mesh, s1),
      (neg|str_is_empty, s2),
      (cur_item_add_mesh, s2),
    (try_end),
    
    (try_begin),
      (troop_is_hero, ":troop_no"),
      (assign, ":color", 3),
      (try_for_range, ":slots", slot_item_player_slots_end - 3, slot_item_player_slots_end), #feather
        (val_sub, ":color", 1),
        (item_slot_eq, "itm_narf_sallet3", ":slots", 1),
        (call_script, "script_init_narf_sallet", ":agent_no", ":troop_no", 1, ":color"),
        (cur_item_add_mesh, s1),
      (try_end),
    (try_end),
  ])
]],
 
["narf_sallet4", "Sallet with Visor", [("sallet_d",0),("inv_sallet_d", ixmesh_inventory)], itp_unique|itp_type_head_armor|itp_covers_beard|itp_attach_armature, 0, 479, weight(2.25)|abundance(100)|head_armor(45)|body_armor(0)|leg_armor(0)|difficulty(8) ,imodbits_plate, [],],
Code:
    (try_for_range, ":item_no", "itm_kettle_cloth", "itm_narf_kettle_hat1"),
      (item_set_slot, ":item_no", slot_item_init_script, "script_init_chapel_de_fer"),
      (item_set_slot, ":item_no", slot_item_player_color, -1),
      (item_set_slot, ":item_no", slot_item_player_slots_begin, -1),
      (item_set_slot, ":item_no", slot_item_num_components, 1),
    (try_end),
    (try_for_range, ":item_no", "itm_narf_kettle_hat1", "itm_narf_sallet1"),
      (item_set_slot, ":item_no", slot_item_init_script, "script_init_narf_kettle_hat"),
      (item_set_slot, ":item_no", slot_item_player_slots_begin, -1),
      (item_set_slot, ":item_no", slot_item_player_slots_end - 1, -1),
      (item_set_slot, ":item_no", slot_item_num_components, 2),
    (try_end),

    (assign, ":armor", 0),
    (try_for_range, ":item_no", "itm_narf_sallet1", "itm_narf_sallet4"),
      (item_set_slot, ":item_no", slot_item_init_script, "script_init_narf_sallet"),
      (item_set_slot, ":item_no", slot_item_player_slots_begin, ":armor"),
      (val_add, ":armor", 1),
      (store_sub, ":slot", slot_item_player_slots_end, ":armor"),
      (item_set_slot, ":item_no", ":slot", -1), #correct feather, others are off
      (item_set_slot, ":item_no", slot_item_num_components, 2),
    (try_end),
    (item_set_slot, "itm_narf_kettle_hat2", slot_item_materials_begin, "str_hood_r"),
    (item_set_slot, "itm_narf_kettle_hat2", slot_item_materials_end, "str_brigandine_r"),
    (item_set_slot, "itm_narf_kettle_hat2", slot_item_num_components, 3),
Code:
  # script_init_narf_kettle_hat
  # 2 variants, one with bevor and the other with hood
  ("init_narf_kettle_hat",
    [
    (store_script_param, ":agent_no", 1),
    (store_script_param, ":troop_no", 2),
    (store_script_param, ":sub_mesh", 3),
    (store_script_param, ":sub_material", 4),
    (assign, "$g_custom_armor_param_count", 1),
    (assign, "$g_custom_armor_mandatory", 1),
    (str_clear, s1),
    (str_clear, s2),
    (try_begin), #bevor
      (eq, ":sub_mesh", 0),
      (eq, ":sub_material", 0),
      (str_store_string, s1, "@{!}sallet_bevor"),
      (str_store_string, s2, "@{!}sallet_strap_bevor"),
    (else_try), #feather
      (eq, ":sub_mesh", 1),
      (assign, "$g_custom_armor_mandatory", 0),
      (eq, ":sub_material", 0),
      (str_store_string, s1, "@{!}sallet_kettlehat_feather"),
    (else_try),
      (eq, ":sub_mesh", 2),
      (eq, ":sub_material", 0), 
      (str_store_string, s1, "@{!}sallet_kettlehat"),
    (else_try),
      (assign, "$g_custom_armor_param_count", 0),
      (assign, "$g_custom_armor_mandatory", 0),
    (try_end),
    ]
  ),
  
  ("init_narf_sallet",
    [
    (store_script_param, ":agent_no", 1),
    (store_script_param, ":troop_no", 2),
    (store_script_param, ":sub_mesh", 3),
    (store_script_param, ":sub_material", 4),
    (assign, "$g_custom_armor_param_count", 3),
    (assign, "$g_custom_armor_mandatory", 1),
    (str_clear, s1),
    (str_clear, s2),
    (try_begin), #helmet
      (eq, ":sub_mesh", 0),
      (is_between, ":sub_material", 0, 3),
      (try_begin),
        (eq, ":sub_material", 0),
        (str_store_string, s1, "@{!}sallet_a_open"),
        # (str_store_string, s2, "@{!}sallet_bevor"),
      (else_try),
        (eq, ":sub_material", 1),
        (str_store_string, s1, "@{!}sallet_a_closed"),
        # (str_store_string, s2, "@{!}sallet_bevor_closed"),
      (else_try),
        (eq, ":sub_material", 2),
        (str_store_string, s1, "@{!}sallet_c"),
      (try_end),
    (else_try), #feather
      (eq, ":sub_mesh", 1),
      (assign, "$g_custom_armor_mandatory", 0),
      (is_between, ":sub_material", 0, 3),
      (try_begin),
        (eq, ":sub_material", 0),
        (str_store_string, s1, "@{!}sallet_a_open_feather"),
      (else_try),
        (eq, ":sub_material", 1),
        (str_store_string, s1, "@{!}sallet_a_closed_feather"),
      (else_try),
        (eq, ":sub_material", 2),
        (str_store_string, s1, "@{!}sallet_c_feather"),
      (try_end),
    (else_try),
      (eq, ":sub_mesh", 2),
      (is_between, ":sub_material", 0, 2),
      (try_begin),
        (eq, ":sub_material", 0),
        (str_store_string, s1, "@{!}sallet_bevor"),
      (else_try),
        (eq, ":sub_material", 1),
        (str_store_string, s1, "@{!}sallet_bevor_closed"),
      (try_end),
    (else_try),
      (assign, "$g_custom_armor_param_count", 0),
      (assign, "$g_custom_armor_mandatory", 0),
    (try_end),
    ]
  ),



  #script_init_chapel_de_fer
  #input: agent_no, troop_no
  #output: s1
  ("init_chapel_de_fer",
    [
    (store_script_param, ":agent_no", 1),
    (store_script_param, ":troop_no", 2),
    (store_script_param, ":sub_mesh", 3),
    (store_script_param, ":sub_material", 4),
    (str_clear, s1),

    (try_begin),
      (eq, ":sub_mesh", 0),
      (assign, "$g_custom_armor_param_count", 3),
      (assign, "$g_custom_armor_mandatory", 1),
      (is_between, ":sub_material", 0, 3),
      (try_begin),
        (eq, ":sub_material", 0),
        (str_store_string, s1, "@{!}chapel-de-fer1"),
      (else_try),
        (eq, ":sub_material", 1),
        (str_store_string, s1, "@{!}chapel-de-fer2"),
      (else_try),
        (eq, ":sub_material", 2),
        (str_store_string, s1, "@{!}chapel-de-fer3"),
      (try_end),
    (else_try),
      (assign, "$g_custom_armor_param_count", 0),
      (assign, "$g_custom_armor_mandatory", 0),
    (try_end),
    ]
  ),
  #script_randomize_chapel_de_fer
  #input: agent_no, troop_no
  #output: s1 from calling init script
  ("randomize_chapel_de_fer",
    [
    (store_script_param_1, ":agent_no"),
    (store_script_param_2, ":troop_no"),
    (str_clear, s1),
    (store_random_in_range, ":class_no", grc_infantry, grc_cavalry + 1), #default range    
    (try_begin), #use fixed hat for heroes based on class
      (troop_is_hero, ":troop_no"),
      (try_begin), #$g_player_troop
        (eq, ":troop_no", "trp_player"),
        (troop_get_slot, ":class_no", slot_troop_banner_scene_prop, ":troop_no"),
      (else_try),
        (troop_get_class, ":class_no", ":troop_no"),
      (try_end),
    (else_try),
      # (store_trigger_param_1, ":agent_no"),
      (agent_is_active, ":agent_no"),
      (assign, ":class_no", ":agent_no"),
    (else_try),
      (assign, ":class_no", ":troop_no"),
    (try_end),
    (val_mod, ":class_no", 3),
    (call_script, "script_init_chapel_de_fer", ":agent_no", ":troop_no", 0, ":class_no"),
    ]
  ),
 
 
Just what I needed! :iamamoron: Thanks for the great tutorial!

However, I have run into a problem after copy pasting The framework and the Baraban plate code to a pure module system.
The only change I have made is importing "header_items" into "module_presentation.py", because it was missing "imod_plain".

The result is here:
MNmBYSWm.png

There are no dropdown menus for accessories like knee guard, pauldrons, etc.
The only option is:
COLOR (no cloak) / platemail cloak white / platemail cloak fur / platemail cloak purple
The option changes/removes the cloak consistently, and randomize everithing else.

How can I get the options for the rest of the armor segments?
I already have two days in it, but I keep trying anyway.
 
Yes, the missing buttons are my problem.
I have pasted the same initialization script, right after 

("game_start",
  [
      (item_set_slot, "itm_plate_custom"...

Isn't that the place of init scripts?

Only suspicious things are the warnings during initialization:

Exporting scripts...
WARNING: Local variable never used: agent_no, at: init_plate_custom
WARNING: Local variable never used: troop_no, at: init_plate_custom



 
The message is:

Code:
[85]:-1
[86]:-1
[87]:-1
[88]:-1
[89]:-1
[90]:-1
[91]:-1
[92]:-1

Everything is -1, only  [92]: varies from -1 to 2, when I klick Color button.

EDIT:
I have changed the initialization script to set all slot values to 1 instead of -1. Now, the armor is fix, the color button changes only the cape without randomising the other parts. That is the right behaviour. It could be a tableou display problem. I have zero experirnce with it, but I am going to dig in it next year.  :party:
 
:idea: SOLVED: The problem was I have copied "init_plate_custom" just at the begining of the "module_sripts.py", right after "scripts = [", but the presentation assumes that :script_no is greater than 0 for a customizable item, otherwise it lefts out most of the options.

Thanks for help Somebody, and for sharing this pure awesomeness!!  :grin:
 
Was able to implement a very simplified version of this to TLD.

It could be used for the 'defilement' feature that was planned a long time ago, where the Evil factions would be able to 'steal' the Good side's armours and 'defile' them, by adding Hand / Eye symbols on them, etc... For now, this is just a proof of concept to show to the team, and also potential artists who could help us with this :smile:

mb60.jpg

Will also be helpful for troop armour variation, but that requires more retextures of the mesh.

Thanks again to Somebody for the help!
 
Interesting OSP,
was thinking, maybe it could also be used to circumvent the limitations of heraldic meshes having submeshes with differing materials as well? 🧐
 
Did a little bit of testing, it might actually not be an issue to do the setup in the ti_on_init_item.
Basically i did apply the tableau_material first (which before would just override all the sub-meshes material to the same by itself) and make the submeshes "remember their original material" by passing an array of strings with said material_names.

Ended into the following code snippets:
Python:
# CoC - Dunde's 1 Liner Heraldic Code # CoC - not anymore
def heraldic(item_tableau, submats = []):
    result = [
        (store_trigger_param_1, ":agent_no"),
        (store_trigger_param_2, ":troop_no"),
        (call_script, "script_shield_item_set_banner", item_tableau, ":agent_no", ":troop_no"),
      ]
      if submats:
        for i in range(len(submats)) if not isinstance(submats, basestring) else [submats]:
            result.append((str_store_string, s1, submats))
            result.append((cur_item_set_material, s1, i + 1))
      return (ti_on_init_item, result)
Python:
["byrnie", "Byrnie", [("byrnie_b",0)], itp_merchandise| itp_type_body_armor  |itp_covers_legs ,0, 800 , weight(13)|abundance(100)|head_armor(0)|body_armor(50)|leg_armor(14)|difficulty(7) ,imodbits_armor,[heraldic("tableau_heraldic_shirt_a", ["@byrnie_a"])],[fac_kingdom_4] ],
and setup tableau materials as usual.


Despite an issue in the inventory screen (mail looks kinda distorted) it works great, the mesh is fully shown and seems to have no issues in-scene (lighted correctly, maybe no perf-issues as well?)
Here the results (brown color is the "neutral"-faction-color in my mod):


Thanks to this thread, i was not aware about these operations at all.
Helped me to realize a long-wished feature and made me come back to modding Warband :grin:
 
Last edited:
Back
Top Bottom