B Tutorial 3D Tutorial for heraldic armors, and mini-mod for testing some of them

Currently Viewing (Users: 0, Guests: 1)

dunde

Count
WB
Best answers
0
Somebody said:
In that case, it's unnecessary. Didn't read through the top part of this tutorial, but I've always had one planar mesh + two materials.
Thank you for the confirmation. I never make any heraldic before, so I find that this tutorial is very helpful. Thank you, Von Krieglitz.
Only 2 things that confuse me : 1st is unused meshes that explained by somebody, and 2nd is what numbers on "heraldic_XXX" tableau do.

For the 2nd, I finally make some script to help doing trial and error in the numbers setting.
What's need :
- heraldics items, completed with textures and codes like the tutorial do.
- Paper and pen to make notes.

Steps :
- Make heraldics items like the tutorial steps, only we use variable (reg) for the constants on the tableau like this :
Code:
  ("heraldic_XXX", 0, "sample_heraldic_XXX_banner", 512, 512, 0, 0, 0, 0,
   [
       (store_script_param, ":banner_mesh", 1),

       (set_fixed_point_multiplier, 100),
        (store_sub, ":background_slot", ":banner_mesh", arms_meshes_begin), #banner_meshes_begin),
       (troop_get_slot, ":background_color", "trp_banner_background_color_array", ":background_slot"),
       (cur_tableau_set_background_color, ":background_color"),

       (init_position, pos1),
       (cur_tableau_add_mesh_with_vertex_color, "mesh_heraldic_armor_bg", pos1, reg21, 100, ":background_color"),
       (init_position, pos1),
       (position_set_x, pos1, reg22),
       (position_set_y, pos1, reg23),
       (position_set_z, pos1, reg24),
       (cur_tableau_add_mesh, ":banner_mesh", pos1, reg25, 0),
       (init_position, pos1),
       (position_set_z, pos1, reg26),
       (cur_tableau_add_mesh, "tableau_mesh_heraldic_XXX_banner", pos1, 0, 0),
       (cur_tableau_set_camera_parameters, 0, 200, 200, 0, 100000),
       ]),
Then create a presentation :
Code:
#Heraldic Test
("heraldic_test", 0, mesh_load_window,
 [(ti_on_presentation_load,
  [(set_fixed_point_multiplier, 1000),
   # Initializations
   (init_position, pos1), (init_position, pos2),
   (try_begin),
      (eq, reg30, 0),
	  (assign, reg21, 200), (assign, reg22, -10),  (assign, reg23, 160),  (assign, reg24, 50),  (assign, reg25, 113),   (assign, reg26, 100),
   (try_end),	  
   # Tittles
   (position_set_y, pos1, 700),  (position_set_x, pos1, 500),  # Tittle Position
   (position_set_x, pos2, 2000), (position_set_y, pos2, 2000), # Tittle Size
   (create_text_overlay, reg2, "@Heraldic Test", tf_center_justify),
   (overlay_set_size, reg2, pos2), (overlay_set_position, reg2, pos1),   
   # Up/Down Buttons   
   (position_set_x, pos1, 350), 
   (position_set_y, pos1, 600),   
   (create_game_button_overlay, "$g_presentation_obj_1", "@<", tf_center_justify),
   (overlay_set_position, "$g_presentation_obj_1", pos1),
   (position_set_y, pos1, 500),      
   (create_game_button_overlay, "$g_presentation_obj_2", "@<", tf_center_justify),
   (overlay_set_position, "$g_presentation_obj_2", pos1),
   (position_set_y, pos1, 400),      
   (create_game_button_overlay, "$g_presentation_obj_3", "@<", tf_center_justify),
   (overlay_set_position, "$g_presentation_obj_3", pos1),
   (position_set_y, pos1, 300),      
   (create_game_button_overlay, "$g_presentation_obj_4", "@<", tf_center_justify),
   (overlay_set_position, "$g_presentation_obj_4", pos1),
   (position_set_y, pos1, 200),      
   (create_game_button_overlay, "$g_presentation_obj_5", "@<", tf_center_justify),
   (overlay_set_position, "$g_presentation_obj_5", pos1),
   (position_set_y, pos1, 100),      
   (create_game_button_overlay, "$g_presentation_obj_6", "@<", tf_center_justify),
   (overlay_set_position, "$g_presentation_obj_6", pos1),
   (position_set_x, pos1, 700), 
   (position_set_y, pos1, 600),   
   (create_game_button_overlay, "$g_presentation_obj_11", "@>", tf_center_justify),
   (overlay_set_position, "$g_presentation_obj_11", pos1),
   (position_set_y, pos1, 500),      
   (create_game_button_overlay, "$g_presentation_obj_12", "@>", tf_center_justify),
   (overlay_set_position, "$g_presentation_obj_12", pos1),
   (position_set_y, pos1, 400),      
   (create_game_button_overlay, "$g_presentation_obj_13", "@>", tf_center_justify),
   (overlay_set_position, "$g_presentation_obj_13", pos1),
   (position_set_y, pos1, 300),      
   (create_game_button_overlay, "$g_presentation_obj_14", "@>", tf_center_justify),
   (overlay_set_position, "$g_presentation_obj_14", pos1),
   (position_set_y, pos1, 200),      
   (create_game_button_overlay, "$g_presentation_obj_15", "@>", tf_center_justify),
   (overlay_set_position, "$g_presentation_obj_15", pos1),
   (position_set_y, pos1, 100),      
   (create_game_button_overlay, "$g_presentation_obj_16", "@>", tf_center_justify),
   (overlay_set_position, "$g_presentation_obj_16", pos1),
   #Texts
   (position_set_x, pos2, 1000),(position_set_y, pos2, 1000), 
   (position_set_x, pos1, 500), 
   (position_set_y, pos1, 600),   
   (create_text_overlay,  reg2, "@Scale 1 :", tf_right_align),
   (overlay_set_size, reg2, pos2), (overlay_set_position, reg2, pos1),   
   (position_set_y, pos1, 500),   
   (create_text_overlay,  reg2, "@Pos X :", tf_right_align),
   (overlay_set_size, reg2, pos2), (overlay_set_position, reg2, pos1),   
   (position_set_y, pos1, 400),   
   (create_text_overlay,  reg2, "@Pos Y :", tf_right_align),
   (overlay_set_size, reg2, pos2), (overlay_set_position, reg2, pos1),   
   (position_set_y, pos1, 300),   
   (create_text_overlay,  reg2, "@Pos Z :", tf_right_align),
   (overlay_set_size, reg2, pos2), (overlay_set_position, reg2, pos1),   
   (position_set_y, pos1, 200),   
   (create_text_overlay,  reg2, "@Scale 2 :", tf_right_align),
   (overlay_set_size, reg2, pos2), (overlay_set_position, reg2, pos1),   
   (position_set_y, pos1, 100),   
   (create_text_overlay,  reg2, "@Scale 3 :", tf_right_align),
   (overlay_set_size, reg2, pos2), (overlay_set_position, reg2, pos1),   
   (position_set_x, pos1, 600), 
   (position_set_y, pos1, 600),   
   (create_text_overlay,  "$g_presentation_obj_21", "@{reg21}", tf_right_align),
   (overlay_set_size, "$g_presentation_obj_21", pos2), (overlay_set_position, "$g_presentation_obj_21", pos1),   
   (position_set_y, pos1, 500),   
   (create_text_overlay,  "$g_presentation_obj_22", "@{reg22}", tf_right_align),
   (overlay_set_size, "$g_presentation_obj_22", pos2), (overlay_set_position, "$g_presentation_obj_22", pos1),   
   (position_set_y, pos1, 400),   
   (create_text_overlay,  "$g_presentation_obj_23", "@{reg23}", tf_right_align),
   (overlay_set_size, "$g_presentation_obj_23", pos2), (overlay_set_position, "$g_presentation_obj_23", pos1),   
   (position_set_y, pos1, 300),   
   (create_text_overlay,  "$g_presentation_obj_24", "@{reg24}", tf_right_align),
   (overlay_set_size, "$g_presentation_obj_24", pos2), (overlay_set_position, "$g_presentation_obj_24", pos1),   
   (position_set_y, pos1, 200),   
   (create_text_overlay,  "$g_presentation_obj_25", "@{reg25}", tf_right_align),
   (overlay_set_size, "$g_presentation_obj_25", pos2), (overlay_set_position, "$g_presentation_obj_25", pos1),   
   (position_set_y, pos1, 100),   
   (create_text_overlay,  "$g_presentation_obj_26", "@{reg26}", tf_right_align),
   (overlay_set_size, "$g_presentation_obj_26", pos2), (overlay_set_position, "$g_presentation_obj_26", pos1),   
   # Buttons 
   (position_set_y, pos1, 25), (position_set_x, pos1, 900),                   
   (create_game_button_overlay, "$g_presentation_obj_7", @OK", tf_center_justify),          # OK Button
   (overlay_set_position, "$g_presentation_obj_7", pos1),
   (position_move_x, pos1, -16),
   (create_game_button_overlay, "$g_presentation_obj_8", "@Close", tf_center_justify),       # CLOSE Button
   (overlay_set_position, "$g_presentation_obj_8", pos1),            
   (presentation_set_duration, 999999),  ]), 
 (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_8"),                            
       (assign, reg30, 2),
       (presentation_set_duration, 0),       
       (jump_to_menu, "mnu_test_heraldic"),
    (else_try),
       (eq, ":object", "$g_presentation_obj_7"),
       (assign, reg30, 1),
       (presentation_set_duration, 0),       
       (jump_to_menu, "mnu_test_heraldic"),
   (else_try),
       (eq, ":object", "$g_presentation_obj_1"),
       (val_sub, reg21, 10),
       (try_begin),
          (key_is_down, key_left_shift),
	  (val_add, reg21, 9),
       (try_end),
      (overlay_set_text, "$g_presentation_obj_21", "@{reg21}"),
   (else_try),
       (eq, ":object", "$g_presentation_obj_2"),
       (val_sub, reg22, 10),
      (try_begin),
         (key_is_down, key_left_shift),
 	  (val_add, reg22, 9),
      (try_end),
      (overlay_set_text, "$g_presentation_obj_22", "@{reg22}"),
   (else_try),
       (eq, ":object", "$g_presentation_obj_3"),
       (val_sub, reg23, 10),
      (try_begin),
         (key_is_down, key_left_shift),
        (val_add, reg23, 9),
     (try_end),
     (overlay_set_text, "$g_presentation_obj_23", "@{reg23}"),
  (else_try),
     (eq, ":object", "$g_presentation_obj_4"),
     (val_sub, reg24, 10),
     (try_begin),
        (key_is_down, key_left_shift),
       (val_add, reg24, 9),
    (try_end),
    (overlay_set_text, "$g_presentation_obj_24", "@{reg24}"),
 (else_try),
    (eq, ":object", "$g_presentation_obj_5"),
    (val_sub, reg25, 10),
    (try_begin),
       (key_is_down, key_left_shift),
       (val_add, reg25, 9),
    (try_end),
    (overlay_set_text, "$g_presentation_obj_25", "@{reg25}"),
  (else_try),
     (eq, ":object", "$g_presentation_obj_6"),
     (val_sub, reg26, 10),
     (try_begin),
        (key_is_down, key_left_shift),
       (val_add, reg26, 9),
   (try_end),
   (overlay_set_text, "$g_presentation_obj_26", "@{reg26}"),  
   (else_try),
       (eq, ":object", "$g_presentation_obj_11"),
       (val_add, reg21, 10),
       (try_begin),
          (key_is_down, key_left_shift),
	  (val_sub, reg21, 9),
      (try_end),
      (overlay_set_text, "$g_presentation_obj_21", "@{reg21}"),
   (else_try),
       (eq, ":object", "$g_presentation_obj_12"),
       (val_add, reg22, 10),
       (try_begin),
         (key_is_down, key_left_shift),
        (val_sub, reg22, 9),
      (try_end),
      (overlay_set_text, "$g_presentation_obj_22", "@{reg22}"),
  (else_try),
     (eq, ":object", "$g_presentation_obj_13"),
     (val_add, reg23, 10),
     (try_begin),
         (key_is_down, key_left_shift),
	 (val_sub, reg23, 9),
    (try_end),
    (overlay_set_text, "$g_presentation_obj_23", "@{reg23}"),
 (else_try),
    (eq, ":object", "$g_presentation_obj_14"),
    (val_add, reg24, 10),
    (try_begin),
       (key_is_down, key_left_shift),
       (val_sub, reg24, 9),
    (try_end),
    (overlay_set_text, "$g_presentation_obj_24", "@{reg24}"),
 (else_try),
    (eq, ":object", "$g_presentation_obj_15"),
    (val_add, reg25, 10),
    (try_begin),
        (key_is_down, key_left_shift),
        (val_sub, reg25, 9),
    (try_end),
    (overlay_set_text, "$g_presentation_obj_25", "@{reg25}"),
 (else_try),
    (eq, ":object", "$g_presentation_obj_16"),
    (val_add, reg26, 10),
    (try_begin),
       (key_is_down, key_left_shift),
       (val_sub, reg26, 9),
    (try_end),
    (overlay_set_text, "$g_presentation_obj_26", "@{reg26}"),
 (try_end), ]), ]),
a mission template :
Code:
  (
    "heraldic_test",0,-1,
    "You start training.",
    [(0,mtef_visitor_source,0,aif_start_alarmed,0,[]), ],
    [(ti_before_mission_start, 0, 0, [], [(set_rain, 1,100), (set_fog_distance, 10)]),
     (ti_tab_pressed,           0, 0, [],                        [(assign, reg30, 3), (finish_mission,0)]),
     (ti_inventory_key_pressed, 0, 0, [(set_trigger_result,1),], []), ],
  ),
a set of menu :
Code:
  ("test_heraldic",0,"Heraldic Test","none",
   [(try_begin),
       (eq, reg30, 1),
       (modify_visitors_at_site,"scn_tutorial_training_ground"),
       (reset_visitors, 0),
       (set_player_troop, "trp_player"),
       (set_visitor,0,"trp_player"),
       (set_jump_mission,"mt_heraldic_test"),
       (jump_to_scene,"scn_tutorial_training_ground"),
       (change_screen_mission),  
    (else_try),
       (eq, reg30, 2),	
       (jump_to_menu, "mnu_module_test"),
    (else_try),
       (eq, reg30, 3),
       (start_presentation, "prsnt_heraldic_test"),
    (try_end), ],
   [("setting",[], "Setting",                  [(start_presentation, "prsnt_heraldic_test"), ]),
    ("back",   [], "Back.",                    [(jump_to_menu, "mnu_camp"), ]), ]), 
and an option on camp menu to call the menu :
Code:
("her",    [], "Heraldic Test.",           [(assign, reg30, 0), (jump_to_menu, "mnu_test_heraldic"),  ]),
How to use :
1. Give all your heraldic items to the player at game start scrpit.
2. Start a new game
3. Camp, and call the menu
4. Set the parameters, and press OK, and try to wear any heraldic item.
5. Press TAB to quit. You can do re-setting the params and press OK to try the heraldic items or press CLOSE to quit.
6. If you're happy with the looks of the heraldics item, note the setting params.
7. base on the notes, change reg21 to reg26 on the tableau with constants from the note for any heraldic items.
8. Delete this menu and the presentation for you don't need them anymore.

Almost forget : To add/subtract the constant by one instead of ten, hold left shift key when click the buttons.
 

kjs

Regular
WF&S
Best answers
0
hmm i tryed to follow ur tuturial exact but what i get is just a transperand armor any idea what i did wrong ???
 

Von Krieglitz

Squire
Best answers
0
kjs said:
hmm i tryed to follow ur tuturial exact but what i get is just a transperand armor any idea what i did wrong ???
Difficult to guess.
It seems that the "tableau_mesh_heraldic_XXX_banner" don't apply to your armor. Perhaps have you done an error inthe last steps, in applying the new properties of the armor in module_items...
Have you checked in items kinds that the line corresponding to your armor is modified and has a new line?
Exemple :
Original armor (not heraldic)
itm_corrazina_red Coat_of_Plate_Harness Coat_of_Plate_Harness 1  corrazina_red 0  16777229 0 6553 704643238 30.000000 30 0 54 16 9 0 0 0 0 0 0 0
0

Heraldic version:
itm_cor_herald Heraldic_Coat_of_Plate_Harness Heraldic_Coat_of_Plate_Harness 1  cor_herald 0  16842765 0 4500 704643238 30.000000 100 0 54 16 8 0 0 0 0 0 0 0
1
-50.000000  3 2071 1 1224979098644774912 2072 1 1224979098644774913 1 4 936748722493063448 1729382256910270507 1224979098644774912 1224979098644774913

 

warmasterant

Recruit
Best answers
0
I was following your tutorial very closely but I kept getting an error regarding step 3b, and when I used build_module it would give me an error message at tableau_materials saying it had an illegal name for the "tableau_mesh_heraldic_XXX_banner" entry. After looking at your module_tableau_material.py file I noticed that it should be named "mesh_tableau_mesh_heraldic_XXX_banner" instead. I added the "mesh_" to mine and it worked, so maybe you should update that, unless I'm the only one who's had the problem.
 

Amman d Stazia

Master Knight
Best answers
0
hey, thanks for writing this up.

I use pixia to edit tga and jpeg files but when I try this, the bits I 'delete' to make transparent end up being black.
I'll try with that other graphics software you mentioned and 'report back'...
 

Amman d Stazia

Master Knight
Best answers
0
yes, they are black.  The original textures seem to work along the lines of they have transparent areas (black, some also white, when you look at the file) and the tab_mesh overlay then shows up through the transparent area.
But when I edit them, the 'transparent' areas become solid colour.
It's either my editing tool or else the conversion of images from .dds format to .tga and back ....
 

Marcquez

Veteran
Best answers
0
Von Krieglitz said:
Some explanation about the material I have uploaded here:
http://www.mbrepository.com/file.php?id=2039

You will have:
- a minimod, a native almost unmodified but with heraldic armors added in itemskind. So they were in the shops, but no units will use them.
- the source of the minimod, with the precious data of the "module_tableau_material.py" and less precious of "module_items.py" and "module_meshes.py"

This is not intended to be a playable mod, it's a modding resource, an help for my tutorial.
You are free to use my work BUT the meshes and original textures were not from me.
The original creators of the meshes and texture of these armors:
- mail armors, and mail and plate armors: meshes and textures from the mod "Britain at War", thanks to Rath0s and to Archangel2k
- corrazina, early transitionnal armor, milanese and gothic plate: meshes and textures from Narf of Picklestink armor's packs
- banded armor, cuir bouilli and brigandine from Warband, thanks to Armagan
- all the other were models from Native Mount&Blade, thanks to Armagan, and the editing of the texture were made by Rucchi in the mod "Fire Arrow, Turn in Inferno".

But you can freely use any of the tableau I have made for the heraldic armor, if you have the permission of the original creator.
I would love to use this in my warband game, but it I can't get it working with Warband :sad:
Could you release a module system for warband?

Tried to do it myself, but just can't get it to work :smile:

Would really love that :smile:
 

Deathbytac0

Regular
WB
Best answers
0
Whenever I build my module it says:
Code:
Error: Unable to find object:tableau_mesh_heraldic_lamellar_c_banner
ERROR: Illegal Identifier:tableau_mesh_heraldic_lamellar_c_banner
Then, I don't know if thats the reason but, the texture shows up in the inventory but not in a scene. HELP! I even followed the heraldic armor tutorial exactly how it said!
 

Sir Ownzor

Recruit
Best answers
0
Deathbytac0 said:
Whenever I build my module it says:
Code:
Error: Unable to find object:tableau_mesh_heraldic_lamellar_c_banner
ERROR: Illegal Identifier:tableau_mesh_heraldic_lamellar_c_banner
Then, I don't know if thats the reason but, the texture shows up in the inventory but not in a scene. HELP! I even followed the heraldic armor tutorial exactly how it said!
I had the same problem as you. I just did what warmasterant suggested and it WORKED! Here it is:

warmasterant said:
I was following your tutorial very closely but I kept getting an error regarding step 3b, and when I used build_module it would give me an error message at tableau_materials saying it had an illegal name for the "tableau_mesh_heraldic_XXX_banner" entry. After looking at your module_tableau_material.py file I noticed that it should be named "mesh_tableau_mesh_heraldic_XXX_banner" instead. I added the "mesh_" to mine and it worked, so maybe you should update that, unless I'm the only one who's had the problem.
 

Sir Ownzor

Recruit
Best answers
0
Sorry for the double post. I followed exactly what the tutorial said on non-armor items, such as tunics and shirts. When I test them, my character's outfit has some sort of shiny metal patterns that change depending on the view angle.

Also, the banner isn't appearing on the outfit, only the banner's background color. I'm pretty sure I got the coordinates correct because I've already done this successfully on other costumes.

I don't have the screenshots yet but I will post soon. Is there something I have to adjust in the BRF editor?
 

Somebody

Code Pope
Baron
WBWF&S
Best answers
1
Post screenshots of your BRF mesh/material settings and code for your tableau material.
 

Sir Ownzor

Recruit
Best answers
0
BRF material settings for new_heraldic_XXX_banner:

BRF material settings for sample_heraldic_XXX_banner:

Code:
  ("heraldic_shirt_a", 0, "sample_heraldic_shirt_a_banner", 512, 512, 0, 0, 0, 0,
  [
      (store_script_param, ":banner_mesh", 1),

      (set_fixed_point_multiplier, 100),
        (store_sub, ":background_slot", ":banner_mesh", arms_meshes_begin), #banner_meshes_begin),
      (troop_get_slot, ":background_color", "trp_banner_background_color_array", ":background_slot"),
      (cur_tableau_set_background_color, ":background_color"),

      (init_position, pos1),
      (cur_tableau_add_mesh_with_vertex_color, "mesh_heraldic_armor_bg", pos1, 200, 100, ":background_color"),
      (init_position, pos1),
      (position_set_x, pos1, 15),
      (position_set_y, pos1, 130),
      (cur_tableau_add_mesh, ":banner_mesh", pos1, 90, 0),
      (init_position, pos1),
      (position_set_z, pos1, 30),
      (cur_tableau_add_mesh, "mesh_tableau_mesh_heraldic_shirt_a_banner", pos1, 0, 0),
      (cur_tableau_set_camera_parameters, 0, 200, 200, 0, 100000),
      ]),

What it looks like in-game:


 

Somebody

Code Pope
Baron
WBWF&S
Best answers
1
Your sample_heraldic_shirt_a_banner should be a copy of the shirt_a material (as specular_shader_skin needs a specular map) using your own texture for the diffuse channel. I assume you've set up the alpha channel correctly? The render order for new_heraldic_shirt_a_banner should also be changed to 4 or something.
Since shirt_a.dds is 1024^2, you should change the tableau code dimensions from 512. Make sure mesh_tableau_mesh_heraldic_shirt_a_banner references the proper mesh (all of which should be using the new_heraldic, not sample material).

I've uploaded a sample fur coat here for reference purposes and such.
 

Sir Ownzor

Recruit
Best answers
0
Awesome! :grin: Works like a charm.

Just a few clarifications on what Somebody suggested. The material sample_heraldic_XXX_banner should have EXACTLY the same BRF material settings as the original XXX material (look for it in materials.brf for reference) except for diffuse.

The material new_heraldic_XXX_banner should have a render order of 4. This setting can be found under flags. For any further reference on what the other BRF settings (except for diffuse) of this material should be like, look in any heraldic_armor_x material (also found in materials.brf).

After doing this, I encountered an additional problem: some parts of the shirt are discolored (sleeves have darker color than the torso area). I also figured out how to solve this. Delete the following line in the module_tableau_materials code:

Code:
       (cur_tableau_add_mesh_with_vertex_color, "mesh_heraldic_armor_bg", pos1, 200, 100, ":background_color"),
 

zagibu

Regular
Best answers
0
Here is a more detailed repetition of the tutorial for the complete noob:

Note that this procedure only works for native armors, for which the BRF files are in M&B\CommonRes and the textures are in M&B\textures. If you want to edit other armors, you have to copy the original meshes, materials and textures (don't forget textures for specular and bump maps, if available) of these armors along with all the other stuff detailed below, or the game won't be able to find them.

Tools needed:

- OpenBRF: http://www.mbrepository.com/file.php?id=1466
- Gimp: http://www.gimp.org/downloads/
- Gimp dds plugin: http://code.google.com/p/gimp-dds/downloads/list
- Python 2.x (not ver. 3.x): http://www.python.org/download/releases/
- M&B Module System: http://download2.taleworlds.com/mb_warband_module_system_1143.zip

Install Python, put OpenBRF somewhere and make a shortcut to the desktop. Also make a shortcut for your M&B game folder (for me, it's at "C:\Program Files\Steam\SteamApps\common\mountblade warband\", i'll call this "M&B" from now on). Go into this folder and into the "Modules" subfolder. Make a copy of the "Native" folder, and name it however you like (I name mine "Mod1"). Extract the module system into this folder, so that you have the following paths: "M&B\Modules\Mod1\Module_data 1.143" and "M&B\Modules\Mod1\Module_system 1.143". If you want, you can make a shortcut to the Module_system folder on the desktop. You'll visit this folder often, later on.

Start OpenBRF. Click Open and browse to "M&B\CommonRes". Most of the armors are in one of the "armors_*.brf", but some older ones are in item_meshes1.brf, and there are various others for arabian armors or heraldic armors. Just keep looking until you've found the armor you want to make heraldic. Once you've found it, click on the "Material" link in the middle pane of the window. Write down the name of this material (e.g. "cuir_bouilli_a". Click on the DiffuseA link in the center pane of the window. Write down the texture size displayed under "res". Click the back link at the top of the Data section to go back to your material. Click Edit->Copy. I'm going to copy the cuir_bouilli_a Material, which is for the "Cuir Bouilli" armor found in armors_h.brf.

Create a new BRF by clicking File->New. Click Edit->Paste. Now you should have the material of your armor in OpenBRF. Rename it to "sample_heraldic_whatever_banner", e.g. "sample_heraldic_cuir_bouilli_banner". The name will not be displayed to the player, it's just an identifier.

Now rightclick on your material, and choose Duplicate. Rename this new Material to "heraldic_whatever_banner", e.g. "heraldic_cuir_bouilli_banner". Give it the following settings in the center pane of the window:

Code:
Shader: simple_shader_no_mip
DiffuseA: heraldic_whatever, e.g. heraldic_cuir_bouilli (this will be the name of the texture we'll create in a moment)
DiffuseB: none
Bump: none
Enviro: none
Specular: none
Spec RGB: 0 0 0
Coeff: 1
Flags: 4000100
Now save your BRF in "M&B\Modules\Mod1" under whatever name pleases you. Click File->Open and open heraldic_armors.brf (it's in M&B\CommonRes). Click on one of the tableau_bla meshes and click Edit->Copy. Click File and choose your own BRF from the quick open list below the New, Open, etc. Options. Click Edit->Paste. You should now have a tableau_bla mesh in your BRF Mesh list. Rename it to "tableau_mesh_heraldic_whatever", e.g. "tableau_mesh_heraldic_cuir_bouilli". In the Material input field, type the name of the armor's original material that you have written down earlier (e.g. "cuir_bouilli_a"). Duplicate this mesh. Name the new mesh "tableau_mesh_heraldic_whatever_banner", e.g. "tableau_mesh_heraldic_cuir_bouilli_banner". Set the Material input field of this new mesh to the "heraldic_whatever_banner" that you've created earlier (not the one starting with "sample", the other one).

That's it for the BRF (for the moment). Save it and close OpenBRF. Now to make sure that the game is actually loading your BRF, go to "M&B\Modules\Mod1" and edit the file "module.ini". Find the line "load_resource = town_houses_e", and on the next line, write "load_mod_resource = whatever_you_called_your_brf". For me, this would be "load_mod_resource = heraldic_cuir_bouilli", note that I've omitted the dot and file extension.

Now it's time to go into the Module System folder of your mod. First of all, edit "module_info.py" and set export_dir to the following:
export_dir = "../" Then save the file and close it.

Now, there are three files that need information about your new armor, module_meshes.py, module_tableau_materials.py and module_items.py. Open module_meshes.py and find the line "("tableau_mesh_heraldic_armor_d", 0, "tableau_mesh_heraldic_armor_d",  0, 0, 0, 0, 0, 0, 1, 1, 1),". Duplicate this line twice below the original line, then rename the first and the third value on each line to match the meshes in your BRF. For me, the end result will look like this:

Code:
  ("tableau_mesh_heraldic_cuir_bouilli", 0, "tableau_mesh_heraldic_cuir_bouilli",  0, 0, 0, 0, 0, 0, 1, 1, 1),
  ("tableau_mesh_heraldic_cuir_bouilli_banner", 0, "tableau_mesh_heraldic_cuir_bouilli_banner",  0, 0, 0, 0, 0, 0, 1, 1, 1),
Save and close the file. Now open module_tableau_materials.py and find the line "("heraldic_armor_a", 0, "sample_heraldic_armor_a", 512, 512, 0, 0, 0, 0,". This is the first part of a longer section (23 lines). Duplicate the whole section. Replace the first and third values with the names of your materials, e.g. "heraldic_cuir_bouilli" and "sample_heraldic_cuir_bouilli". The next two values must be replaced with the resolution of your texture, in my case, 1024 two times. The last value you have to replace is "mesh_tableau_mesh_heraldic_armor_d" on the third last line. Replace it with "mesh_tableau_mesh_heraldic_whatever", e.g. "mesh_tableau_mesh_heraldic_cuir_bouilli". My section looks like this now:

Code:
  ("heraldic_cuir_bouilli", 0, "sample_heraldic_cuir_bouilli", 1024, 1024, 0, 0, 0, 0,
   [
       (store_script_param, ":banner_mesh", 1),

       (set_fixed_point_multiplier, 100),
       (store_sub, ":background_slot", ":banner_mesh", arms_meshes_begin), #banner_meshes_begin),
       (troop_get_slot, ":background_color", "trp_banner_background_color_array", ":background_slot"),
       (cur_tableau_set_background_color, ":background_color"),

       (init_position, pos1),
       (cur_tableau_add_mesh_with_vertex_color, "mesh_heraldic_armor_bg", pos1, 200, 100, ":background_color"),
#       (cur_tableau_add_mesh, "mesh_heraldic_armor_bg", pos1, 200, 0),
       (init_position, pos1),

       (position_set_z, pos1, 50),
       (position_set_x, pos1, -25),
       (position_set_y, pos1, 130),
       (cur_tableau_add_mesh, ":banner_mesh", pos1, 103, 0),
#       (cur_tableau_add_mesh, "mesh_banner_a01", pos1, 116, 0),
       (init_position, pos1),
       (position_set_z, pos1, 100),
       (cur_tableau_add_mesh, "mesh_tableau_mesh_heraldic_cuir_bouilli", pos1, 0, 0),
       (cur_tableau_set_camera_parameters, 0, 200, 200, 0, 100000),
       ]),
Save and close. We'll come back to this file later on, to finetune the position of the banner on the mesh.

Open the file module_items.py. Find the original line of your armor e.g. by searching for the name of the original mesh/material (in my case, cuir_bouilli_a). Copy the whole line, and, if the entry is spanning two lines (which is the case for some of the armors), copy them both. Scroll down to the end of the file, and insert your line(s) above the line starting with "items_end". The first two values can be anything you like, but note that the first one must be unique and the second one is what's displayed to the player. The third value must match the mesh name, which means you can leave it alone, if you are editing a native mesh, but otherwise you have to replace it with the mesh name in your brf (not one of the tableau_ ones, mind you). I'm editing a native armor, so I can leave it alone. A good idea is to set the gold value (number before the weight value) to 1, so you will actually be able to buy it with a new character, when starting out. Now scroll to the end of your entry, and replace the square bracket and the comma with the following:

Code:
, [(ti_on_init_item, [(store_trigger_param_1, ":agent_no"),(store_trigger_param_2, ":troop_no"),(call_script, "script_shield_item_set_banner", "tableau_heraldic_cuir_bouilli", ":agent_no", ":troop_no")])]],
Edit the value "tableau_heraldic_cuir_bouilli" to match the tableau mesh name in your brf. The complete entry should look something like this:

Code:
["heraldic_cuir_bouilli", "Heraldic Cuir Bouilli", [("cuir_bouilli_a",0)], itp_merchandise| itp_type_body_armor  |itp_covers_legs ,0, 1 , weight(24)|abundance(100)|head_armor(0)|body_armor(50)|leg_armor(15)|difficulty(8) ,imodbits_armor, [(ti_on_init_item, [(store_trigger_param_1, ":agent_no"),(store_trigger_param_2, ":troop_no"),(call_script, "script_shield_item_set_banner", "tableau_heraldic_cuir_bouilli", ":agent_no", ":troop_no")])]],
Save and close the file. Now go back to your module system folder and doubleclick the .bat file at the top. If you've made everything correctly, no errors should be displayed. Once the script has ended, hit enter to close the window.

Now comes the hard part: making the texture. Install Gimp. Go into your user folder (for me it's C:\Users\zagibu). There should be a ".gimp-X.X" folder, change into that. This folder should contain a plug-ins folder. Extract the dds plugin (dds.exe) into this folder. Without this plugin, Gimp can't handle dds Files (DirectX textures).

Open Gimp and open the original texture file located in M&B\Textures, if you are editing a native armor, or located wherever, if you are editing another armor. For me, it's the file M&B\Textures\cuir_bouilli_a.dds. A small window should pop up. Uncheck the entry "Load mipmaps". Then the texture image should be displayed in Gimp's main window.

Before you do anything else, save the file somewhere as .xcf file. I put it on my desktop. You do this because you don't want to mess with the image, and then accidentially overwrite the original M&B texture.

Now editing the texture is actually quite involved. We will only do a quick edit to get it working, and I will later provide some tips to improve the result.

In the layers pane, rightclick the main surface and add a layer mask (white, full transparency). The layer mask should now have appeared at the right of your main surface in the layers pane. We will now paint in this layer mask, and the mask will be used as alpha channel when we later save the image as dds texture. White means the content of the main surface layer will be rendered, and black means the content of the heraldic banner will be rendered. It's not just black and white, though, different shades of gray mean different mixture levels of the main surface or the banner. This way, you can draw rips and tears and chafed down areas, where the original texture will shine through the banner.

Choose the brush tool and make sure it's set to full black as drawing color. Choose Circle fuzzy (19) as Brush in the Brush tool options and set the Opacity to 30%. Maybe you also want to scale up the brush a bit in the brush options. Now draw on your image where you want the banner to appear. The original content of the main surface should fade out and a checkerboard should start to shine through. Imagine this checkerboard were the heraldic banner. If the image fades to black instead, undo your strokes with ctrl-z and leftclick the layer mask in the layers pane. Leftclicking either the image layer or the layer mask switches between what you draw on.

My result looks like this:



Once you are content with your work, save the image as "whatever.dds" (e.g. "heraldic_cuir_bouilli.dds") in the M&B\Modules\Mod1\Textures folder. A notification window should appear. Simply export it, so that it converts the layer mask automatically to an alpha channel. Then the DDS options window will appear. Here, select DXT5 as compression and make sure "Generate mipmaps" is checked.

Now it's time to open your BRF one last time. Click Import->New Texture and browse to the texture you've just created. Make sure the checkbox with "also add new materials..." is unchecked. Once it's imported, switch to the alpha radio button to check and see whether you have anything else than a pure pink square. If there are some dark areas in the pink, everything worked fine.

Go back to the material tab and make sure the material not starting with "sample" is using the new texture. Save the BRF.

Now you are done, and it's time to see the result of your hard work. Start M&B and in the launcher window, make sure "Enable cheats" and your module is selected, then launch, create a new singleplayer game, create a character always choosing the top choices ("impoverished noble", "squire", etc.), choose your banner (I suggest one with a symbol and checkerboard background, it makes positioning easier) and go to Sargoth. Kill the bandit in the streets, talk to the Merchant and tell him to go bother someone else, then leave the tavern with tab. On the overland map, hit ctrl + tilde to pop up the console and type cheatmenu, then hit enter. Now go to camp, and choose the cheatmenu option. Find your item and buy it. Leave the camp and go to the city. Wait for some time (noon), then take a walk around the city and put your armor on. Save and exit.

So the banner was probably not properly placed on your armor. To correct it, open module_tableau_materials.py. In your armor's section, these three lines control the size and positioning of the banner:

Code:
       (position_set_x, pos1, -25),
       (position_set_y, pos1, 130),
       (cur_tableau_add_mesh, ":banner_mesh", pos1, 103, 0),
-25 is horizontal position (also try positive numbers if it ends up on the back), 130 is the vertical position and 103 is the size. If it's only slightly off, increment/decrement in units of 10 or less. If it's completely off, try units of 30 to decrease the number of times you have to load the game to check it out. Once you have it properly centered, play around with the size.

If you have it where you like it, you might want to go back to gimp and improve the texture a bit. Here are some tips: <coming soon>
 

gregorsamsa

Recruit
Best answers
0
It seem like no matter how carefully I follow the tutorial, or however I change the texture coordinates, the item (that I´m trying to put an heraldic texture on) is always white, in the game not in Brf. I have no clue what I´m doing wrong, anyone has an intrest of helping me? (It´s an item, NOT an armour!)