MP Tutorial Module System Adding custom made items to multiplayer

Users who are viewing this thread

Hermodr

Squire
What programs you need

Ok this is a tutorial on how to add new weapons, armors, helmets etc to warband multiplayer. You will need a few programs before you start reading.

-Latest module system - http://forums.taleworlds.com/index.php/topic,111706.0.html
-openBrf - http://forums.taleworlds.com/index.php/topic,72279.0.html
-Wings 3D/Blender 3D - http://www.wings3d.com/
-Photoshop with DDS plugin/DDS converter - http://developer.nvidia.com/object/photoshop_dds_plugins.html

Setting up the module system

1. Download it.
2. Extract it.
3. Look for module_info and open it with notepad.
4. Insert the path to your module folder, for example like this:
export_dir = "C:/Program Files/Mount&Blade Warband/Modules/ModuleIndian/"

Exporting your model

1. Open "openBrf".
2. Click File/open and open your mount and blade warband game folder, then look in the commonRes folder.
3. If you are working on a armor you open up one of the brf files that sais armor.
4. Find a armor in the list and export it by right clicking on it and then click export static mesh.
5. In the modeling program you are using Blender or Wings 3D. Import the .obj file you exported from openBrf.
6. Line up your model to the model you imported. Make sure the pivot point of your model is in the center.
7. Delete the model you imported.
8. Make all the quads of your model triangles.
9. Export your model as a .obj file and make sure you triangulate the .obj file. (This may not work with blender. In that case download and install Wings3D.

Fixing your texture

1. Open up photoshop or the DDS converter program.
2. In photoshop click save as .dds.
3. Check the generate mip maps button.
4. Save it in your module/texture folder.
5. Open up your module.ini file inside your module folder.
6. Make sure this line is somewhere in it. "scan_module_textures = 1"

Creating the .brf file for your item

1. Make sure the .dds file is located inside the Textures folder in your module folder.
2. Open up "openBrf".
3. Click Import/Static mesh.
4. Locate the model your exported from your modeling program and import it.
5. Click Import/New Material.
6. Locate the dds. file that is in your module/texture folder.
7. Check the button saying "Also add a new texture"

8. In the mat (material) tab look what your material is called. It should by default be named like your texture.
9. Open the mes (mesh) tab and paste the material name inside the white area where it sais material.
10. Go to the mat tab again. And change the settings to your liking. I suggest looking at other armors to find out what works the best.
11. Click File/save as and save it inside your module/resources folder.

12. Click File/open and find a armor/weapon in your Common Res folder that has a similar shape to your own item.
13. Right click the item you have chosen. And then click export rigged mesh. Save it as a SMD file.
14. Open up the brf file that you put in the resource folder before.
15. Import the SMD file by clicking Import/rigged mesh.
16. Select the file you just imported then click Edit/Copy frame.
17. Select your own item then click Edit/Paste rigging.
18. Select the other item your imported and erase it by right clicking it and then remove.
19. Save your brf file in the resource folder inside your own module folder.

Making one of your troops have the weapon in multiplayer


1. Open up the module system that you prepared before.
2. Open up your module_items.
3. For example if you want to add a armor search for this line:
Code:
["mail_hauberk", "Mail Hauberk", [("hauberk_a_new",0)], itp_merchandise| itp_type_body_armor  |itp_covers_legs ,0,
 1320 , weight(19)|abundance(100)|head_armor(0)|body_armor(40)|leg_armor(12)|difficulty(7) ,imodbits_armor ],
4. Copy the armor data you find and paste it on the bottom of all the amors. This is the data for the armor.
Code:
["item_ID", "in_game_NAME", [("MESH_NAME",0)], itp_THINGIESTHATDEFINETHEBEHAVIOUR ,0,
 item Price, weight(19)|abundance(100)|head_armor(0)|body_armor(40)|leg_armor(12)|difficulty(7) ,imodbits_Explaing what modifiers the item can have. For an imodbits_armor that would be crude, rusty, battered, thick, reinforced etc. ],
5. After you have given the item a ID and a ingame name. And you have written the name of the mesh of your custom made item. You can save and close the module_items.

6. Open your module_troops. And search for this line:
Code:
#Multiplayer troops
7. Here are all the troops for multiplayer located. Locate the troop you want to give your item to. And then add "itm_ID of the item you made". End it with a comma like this:
Code:
#Multiplayer troops (they must have the base items only, nothing else)
  ["swadian_crossbowman_multiplayer","Swadian Crossbowman","Swadian

Crossbowmen",tf_guarantee_all,0,0,fac_kingdom_1,
   

[itm_bolts,itm_crossbow,itm_sword_medieval_b_small,itm_tab_shield_heater_a,itm_baby_armor,i

tm_ankle_boots],
8. Now close and save.
9. Open up the module_scripts and search for
Code:
game_quick_start
10. Here you will see a bunch of lines like this:
Code:
(item_set_slot, "itm_sword_medieval_a", slot_item_multiplayer_item_class, multi_item_class_type_sword),
You will have to copy one of these lines and paste it on the bottom of the list of items. And change "itm_sword" to the ID of your item.
11. Now search for:
Code:
(call_script, "script_multiplayer_set_item_available_for_troop", "itm_bolts", "trp_swadian_crossbowman_multiplayer"),
12. Look through the list until you find the class that you have given the item to.
13. Copy one of the lines and repeat what you did in step 10.
14. Save and exit.
14b. Now go into your module.ini file. And add this line:
Code:
load_mod_resource = your brf file = barrier_primitives
15. Compile and see if you get any errors. If you get errors first look through all the steps again and make sure you haven't missed anything. Then ask on the forum. If it compiles correctly start the game and see your item in action.

THE END

I would like to know if I have missed something in the tutorial...I also suggest you sticky this. :wink:
 
Well, I can't deny that this is better written than that jangle of posts I made. Maybe it's worth mentioning that itp_merchandise is the thing that makes it available in shops.
 
hmm. I did everything you said. No compiling errors. But, they wont show up ingame. Ive checked many times that did I miss anything. What should I do? Did I place the codes in the wrong place?
Got it working. Export dir was messed up  :lol:
 
Followed it and I must have gone wrong somwhere...
One of my items is working fine on testing on a server, the other is a cutlass and the game seems to be attempting to equip it as a head armor slot, no idea why.
Any help?  :???:
 
bobthe8th said:
Followed it and I must have gone wrong somwhere...
One of my items is working fine on testing on a server, the other is a cutlass and the game seems to be attempting to equip it as a head armor slot, no idea why.
Any help?  :???:

(item_set_slot, "itm_sword_medieval_a", slot_item_multiplayer_item_class, multi_item_class_type_sword),

multi_item_class_type_sword is what defines in which slot the item will show up in Multiplayer.
Make sure you have selected the right one.  :smile:
 
Lucke189 said:
bobthe8th said:
Followed it and I must have gone wrong somwhere...
One of my items is working fine on testing on a server, the other is a cutlass and the game seems to be attempting to equip it as a head armor slot, no idea why.
Any help?  :???:

(item_set_slot, "itm_sword_medieval_a", slot_item_multiplayer_item_class, multi_item_class_type_sword),

multi_item_class_type_sword is what defines in which slot the item will show up in Multiplayer.
Make sure you have selected the right one.  :smile:

This does not appear to be the problem...
I should mention that the weapon works for the AI troops fine...
 
It could work with the AI troops even if you've made a misstake in module_scripts.
I think only the player is affected but what you write there.
 
maybe a good note to all who is watching this the item_ID must never be with capitel letters.
so not itm_Helmet but itm_helmet
 
Creating the .brf file for your item

1. Make sure the .dds file is located inside the Textures folder in your module folder.
2. Open up "openBrf".
3. Click Import/Static mesh.
4. Locate the model your exported from your modeling program and import it.
5. Click Import/New Material.
6. Locate the dds. file that is in your module/texture folder.
7. Check the button saying "Also add a new texture"

8. In the mat (material) tab look what your material is called. It should by default be named like your texture.
9. Open the mes (mesh) tab and paste the material name inside the white area where it sais material.
10. Go to the mat tab again. And change the settings to your liking. I suggest looking at other armors to find out what works the best.
11. Click File/save as and save it inside your module/resources folder.

12. Click File/open and find a armor/weapon in your Common Res folder that has a similar shape to your own item.
13. Right click the item you have chosen. And then click export rigged mesh. Save it as a SMD file.

14. Open up the brf file that you put in the resource folder before.
15. Import the SMD file by clicking Import/rigged mesh.
16. Select the file you just imported then click Edit/Copy frame.
17. Select your own item then click Edit/Paste rigging.
18. Select the other item your imported and erase it by right clicking it and then remove.
19. Save your brf file in the resource folder inside your own module folder.

No matter which of the weapon related brf files from the Common Res folder I open to do steps 12 and 13, None of the weapons show as rigged and are not offering the option of Export rigged mesh when I right click the item in the menu. I do see the option to Export rigged mesh when I goto Settings/Edit reference data those meshes I can export from but the export gives errors when I try to use the sword example with my sword weapon.

Any ideals on how-to get the rigging mesh to export on the games brf files? This seems to be the last thing stopping me from adding my own items to the game so far.  :roll:
 
I added items in quick start
(item_set_slot, "itm_otarmor01", slot_item_multiplayer_item_class, multi_item_class_type_light_armor),
armors from 01 to 17.
Then under #5c-Rhodok Horseman
(call_script, "script_multiplayer_set_item_available_for_troop", "itm_otarmor01", "trp_rhodok_horseman_multiplayer"),
and so on all 17 armors. IDs are fine, because no errors popup, armors are working perfectly fine in single player but I cant choose them in multi.
I skipped this:
#Multiplayer troops (they must have the base items only, nothing else)
  ["swadian_crossbowman_multiplayer","Swadian Crossbowman","Swadian

Crossbowmen",tf_guarantee_all,0,0,fac_kingdom_1,
 

[itm_bolts,itm_crossbow,itm_sword_medieval_b_small,itm_tab_shield_heater_a,itm_baby_armor,i

tm_ankle_boots],
because I dont want any of theese items to be free starter pack.

Recently I added one of theese armors as guarantee pack and he doesnt get it o_O
 
No matter which of the weapon related brf files from the Common Res folder I open to do steps 12 and 13, None of the weapons show as rigged and are not offering the option of Export rigged mesh when I right click the item in the menu. I do see the option to Export rigged mesh when I goto Settings/Edit reference data those meshes I can export from but the export gives errors when I try to use the sword example with my sword weapon.

Any ideals on how-to get the rigging mesh to export on the games brf files? This seems to be the last thing stopping me from adding my own items to the game so far. 

Yeah, same problem here. Not even seeing the export rigged mesh option when I right click any of the weapons. Something is obviously missing if others got this to work, I will hopefully find what went wrong or a work around.

Ok mystery solved. Weapons obviously don't have rigging. I skipped that part and my weapon worked fine in game (beside me messing up my material somewhere, but I fixed that).
See its broken material self in action:
308wha0.jpg


Its deadly too

2qktgna.jpg

FYI: I skipped steps 8-18 the second time and haven't had a problem, but you will need to follow the rigging if doing an armor. Also not sure if 8-11 are obsolete or not but brfedit did all that for me and my material worked fine the second time (was a model problem not brfedit).
8. In the mat (material) tab look what your material is called. It should by default be named like your texture.
9. Open the mes (mesh) tab and paste the material name inside the white area where it sais material.
10. Go to the mat tab again. And change the settings to your liking. I suggest looking at other armors to find out what works the best.
11. Click File/save as and save it inside your module/resources folder.

12. Click File/open and find a armor/weapon in your Common Res folder that has a similar shape to your own item.
13. Right click the item you have chosen. And then click export rigged mesh. Save it as a SMD file.
14. Open up the brf file that you put in the resource folder before.
15. Import the SMD file by clicking Import/rigged mesh.
16. Select the file you just imported then click Edit/Copy frame.
17. Select your own item then click Edit/Paste rigging.
18. Select the other item your imported and erase it by right clicking it and then remove.
 
Any one makeing 3d designs to put in a mod use this program, it exports as obj and its free and its the best out there right now


......
follow the directions and it works perfectly
 
I have a problem while setting up the module system:
when I open build_module.bat, it says:

operable program or batch file
'python' is not recognized as an internal or external command,
operable program or batch file
'python' is not recognized as an internal or external command,
operable program or batch file
'python' is not recognized as an internal or external command,
operable program or batch file
'python' is not recognized as an internal or external command,
operable program or batch file
'python' is not recognized as an internal or external command,
operable program or batch file
'python' is not recognized as an internal or external command,
operable program or batch file
'python' is not recognized as an internal or external command,
operable program or batch file
'python' is not recognized as an internal or external command,
operable program or batch file
'python' is not recognized as an internal or external command,
operable program or batch file
'python' is not recognized as an internal or external command,
operable program or batch file
'python' is not recognized as an internal or external command,
operable program or batch file
Could not find C:\Program Files\Mount&Blade Warband\Modules\Module_system 1.134\*.pyc

_______________________
Script processing has ended.
Press any key to exit...
 
Myrmidone said:
Wait, isn't that cheating? I mean you use a weapon no one else can use.

no, its called moding, you change the game to make it different, when you add items, you change the game, thus creating your own module, with which you cant play native.
 
Well, i have this problem: I made a little mod, using "Morghs M&B Warband Tool", and in Single player works fine. But now, i want to use the same mod, but make it multiplayer playable. so, I wento to Module System, open "module_scripts", search the arrows part, and i added this line:

Code:
(item_set_slot, "itm_sharp_samurai_arrows", slot_item_multiplayer_item_class, multi_item_class_type_arrow),

Just to see if it worked. it loked like this:

Code:
#arrows
      (item_set_slot, "itm_arrows", slot_item_multiplayer_item_class, multi_item_class_type_arrow),      
      (item_set_slot, "itm_barbed_arrows", slot_item_multiplayer_item_class, multi_item_class_type_arrow),      
      (item_set_slot, "itm_bodkin_arrows", slot_item_multiplayer_item_class, multi_item_class_type_arrow),
      (item_set_slot, "itm_khergit_arrows", slot_item_multiplayer_item_class, multi_item_class_type_arrow),
      (item_set_slot, "itm_sharp_samurai_arrows", slot_item_multiplayer_item_class, multi_item_class_type_arrow),
      #bolts
      (item_set_slot, "itm_bolts", slot_item_multiplayer_item_class, multi_item_class_type_bolt),
      (item_set_slot, "itm_steel_bolts", slot_item_multiplayer_item_class, multi_item_class_type_bolt),

etc. Then, i built the module, but when i opened multiplayer, i got this error:

Code:
SCRIPT ERROR ON OPCODE 507 Invalid Item Kind ID: -1; LINE NO: 115: 
At script quick_game_start
At script quick_game_start

Can some help? Thanks
 
Back
Top Bottom