Some additional reading:
Thanks to Sixshot, Dusho, and Phanjam for your initial advice and help last year. I'd still be lost without your input! :lol:
You will need the following programs installed, in this order preferably.
First, grab the Blender Import script for Ogre: http://www.ogre3d.org/tikiwiki/BlenderImport . You want to place this script in your c:\blender\blender-2.49b-windows\.blender\scripts\*
Now open it up with notepad or some text editing program and go to line 127. You need to edit this line and tell it where your ogrexmlconverter.exe is located (what you downloaded in #5 above). For example, here is how I have mine set-up:
IMPORT_SCALE_FACTOR = 1 IMPORT_OGREXMLCONVERTER = "C:\OgreCommandLineTools\OgreXmlConverter.exe" #IMPORT_OGREXMLCONVERTER = "F:\\Projekte\\rastullah\checkout\\rl\\branches\python\dependencies\ogre\Tools\Common\\bin\\release\\OgreXmlConverter.exe
Second, you need the Blender export script found here: http://www.ogre3d.org/forums/viewtopic.php?t=45922 . The link is on the first post of the forumn in .zip format. This script will tell Blender how to export your 3d model in Blender to the appropriate format so that Torchlight recognizes it (or something like that I think). Place the ogrehelp, ogrepkg, and ogremeshexporter.py in the same folder that you placed your other python import script. I don't believe you need to text edit the export script like you did for the import script.
Third, you need this importTL.py script here for any armor editing you plan on doing, as they require you to have a both a .mesh and .skeleton merged together. The script is here, courtesy of Dusho: http://code.google.com/p/torchlight-to-blender/downloads/detail?name=importTL.py&can=2&q= . Preference really, but I found this import script to be far easier and noob friendly then doing the merging of both .mesh and .skeleton manually. Although it's user preference. Dusho has written up a very nice guide for doing it manually here: http://www.dusho.net/tutorials.tl_SkeletMesh.htm . Regardless, when you install the importTL.py script, you need to edit it in a notepad or text editing program. Go to line 61 and make sure you direct it to where your ogrexmlconverter.exe is located, just like you did with the initial import script. Here's how mine reads:
# here place path to your OgreXmlConverter ogreXMLConverter = "C:\OgreCommandLineTools\OgreXmlConverter.exe -q"
Fourth, you need to download the armatureexport.zip, again, posted by Dusho from his write-up here: http://www.dusho.net/tutorials.tl_SkeletMesh.htm . The link is 3/4 down the page under the “Exporting Mesh” section - grab it, and replace it with the one already found in your '.blender\scripts\ogrepkg\' directory.
This should be all of the downloads you need to start modding.
If you get an error message when you try to open Blender, saying something about the side by side configuration could not be established…blahblahblah, I found a workaround for it. Download the Microsoft Visual C++ 2008 SP1 Redistributable Package (x64) from: http://www.microsoft.com/download/en/confirmation.aspx?displayLang=en&id=2092 . For whatever reason, this resolved that error for myself and many other blender users who encountered that error.
Noob modders and those with no prior experience using these programs should start here. Importing new weapons and shields into Torchlight is fairly simple and straightforward. Once you feel confident here, you can move on to Part II. Helmets & Shoulders.
Disclaimer: I'm a bit OCD, so the way I do things may involve a couple more steps. But I've found that if things go south, or you need to find and edit that 89th sword you imported last week, it's much easier to grab it if you organize yourself before you start modding away into the night.
I set-up my mod folder in Torchlight like this: C:\Users\Robert\AppData\Roaming\runic games\torchlight\mods\*
The * is any mod folder within your TL mod directory. Let's name this folder WoW Mod for simplicity sake. Now, let's go ahead and setup our WoW Mod Folder's hierarchy. It should look like this:
WoW Mod\media\models\weapons\ WoW Mod\media\models\weapons\armor\shields\
Every weapon or shield you put into TL needs to go into it's own named folder within either of these respective directories. When you import a new weapon into TL, you'll place it all in a named folder, like Starsword, and place the starsword.mesh, starsword.material, and starsword_texture.png within that folder. You then place it in WoW Mod\media\models\weapons\Starsword. Pretty self-explanatory.
Secondly, you'll need to place these additional folders in your WoW Mod folder (I'll explain why as we go):
WoW Mod\media\UI\itemicons WoW Mod\media\units\items
Third, within your WoW\media\units\items\ folder you need to place a sub-folder with the corresponding weapon type or shield. This is so TL knows where to search for your item and what type of item it is.
WoW Mod\media\units\items\axes WoW Mod\media\units\items\swords WoW Mod\media\units\items\polearms WoW Mod\media\units\items\rifles WoW Mod\media\units\items\staves WoW Mod\media\units\items\swords WoW Mod\media\units\items\wands WoW Mod\media\units\items\maces WoW Mod\media\units\items\pistols WoW Mod\media\units\items\crossbows WoW Mod\media\units\items\bows WoW Mod\media\units\items\shields
Within each of weapon folders, you will place your .dat file (a text document with .dat at the end) that will essentially tell TL where to find your mesh, what it's name is, and all it's stats. Very important! We'll cover the .dat file section a little later in this tutorial.
If you've installed everything right, Blender should open with no problems. If you get a python error, it means one of many things, but most often it means that you don't have the correct version of python running Blender.
Make sure you have Blender 2.49b and python script version 2.6 running, as they are compatible. When you open blender, a second dialog box always opens: yours should look like this:
If it does, pass go and keep going. If not, then check your python errors or google them (I'm not a python script guru).
Now, open up your WMV and tell it where to find your WoW.exe so it can parse the data. Then, on the left-hand side of the menu, navigate to the the weapons and pick one.
For the purposes of this tutorial I'll pick the updated Sulfuras Mace that was just redone for the new 4.2 Firelands Patch - it's pretty cool!
To export this model into blender, hit File → Export Model → OgreXML (Note: the first time you run WMV, you may need to set your preferred exporter to ogrexml under export options). Then you need to tell WMV where you want the file exported to. I have a WIP folder on my desktop that I solely use for modding, so I'm going to export it there. Once export is complete, it's time to go to blender.
With Blender up and running, you'll see it always opens to a default screen with a stupid box. DELETE IT. It should have a pink out-line around showing you that it's currently selected. Just hit the 'del' key and then 'enter' …then *poof* the annoying box is gone. Now select File → Import → OGRE (.mesh.xml)
Select your Sulfurus.mesh.xml from whatever directory you told WMV to export it in.
You should now have your imported model right in front of you - your screen should like like this:
Note: If this is your crash course in Blender, I'm going to give you detailed tips of how to manipulate these with minimal effort. Blender uses ALOT of keyboard keys as shortcuts, and it can be a bit daunting to figure it out if you're not used to how Blender works. Fear not!
Tip 1: see the pink outline around your mace? That means it's selected. What you want to do immediately here is as follows.
Commentary: The '1' and '3' on your keypad change the point of view in blender. As you have it right now, you're looking at the mace from the left side of your character in TL. If you ported this in right now, not only would it not be textured (to be covered next) but it would be positioned horizontially across their waste, which you don't want. Go ahead and zoom in with your mouse wheel. You can press and hold your mouse wheel button down and move the image so you can see around it as well. If you need to re-center, just hit '1' and then '3'.
Your screen should look just like this:
Now we're going to rotate the mace so that it aligns with the point of contact with the TL characters hand. Press the 'R' key to rotate it and line it up vertically as shown in the picture below.
Next, press 'R' twice, then rotate the mace so that it's facing the opposite way, as shown in the picture below. Also note that you may need to physically grab the weapon and center the hilt on the pink dot (press the G key to grab your weapon while it's actively selected):
Keep in mind that the pink dot you see is the point of contact the item will have with the TL character's hand in-game. Adjusting the weapons this way avoids you having to manually make 100 minor adjustments post-export because the model isn't lining up correctly in-game.
Now, this next step is something you can do immediately after importing your weapon models, but I decided to leave it until now for simplicity sake. We need to split the screen into 4 sections - quite simple. Hover your mouse arrow between the top bar and the grid until the arrow turns into a vertical two sided arrow - then right-click and select 'split area' from the drop down menu box.
Split the lower bar in half as well, the same-way. Your screen should look like this:
Now, click on the little square boxes in the corner of each sub-divided section. How you set them up is personal preference, but I do mine like as shown below in the spoiler/image. The top section is the 'outliner' option from the pop-up menu. The lower section is the 'UV/Image Editor'. You MUST have these two sections open and active on any modding you do.
1. Alt-tab out of blender and open the folder that you had WMV export your sulfurus.mesh.xml assets to. In there should be a .tga file with the idential .mesh.xml file name as the model it's associated with, which is the models texture. Open up that file with a photo-editing software program (I use adobe photoshop) and simply save it as a .png file. I'll name mine sulfurustex.png for this tutorial.
2. Now, place the sulfurustex.png in your WoW Mod/media/models/weapons/sulfurus/ folder (as described in the part I. Set-up section).
3. Alt-tab back into blender.
4. If you split your screen like mine, then you have your UV/Image Editor in the lower right hand section. Select Image → Open → and then select the directory where you just placed your sulfurustex.png.
5. With your texture now selected in the UV/Image Editor, it's time to change the Draw Type from 'solid' where it is at default in blender to 'textured'. The picture below shows you where that button is. Now your model should be nicely textured!
6. Rename your mesh and material files listed in the 'Outliner' section that you split earlier. You do this by holding CTRL and left clicking on the material. You will become a pro at this, as you will have to do this every time you want to import any mesh into TL, be it a weapon/shield or armor.
While you CAN name them practically anything, a few words of wisdom.
I named mine as follows, and I'll tell you what each of the colored boxes means below the image.
Commentary: you'll note that some of the WoW weapons you import may have 1 material or 7+ depending on their complexity. While TL only really needs 1 material associated with a texture to render the item textured correctly in-game, it's best not to delete these materials when porting in weapons or shields into TL[/u]. Helmets and shoulders, which I'll cover in a later section in this tutorial, are a different matter and only have 1 material per mesh, but you need not worry about that yet. Just remember this for weapons and shields.
7. You now need to assign the texture we opened in step 4 to each of the materials. Simply 'left-click' on the first material to select it. You'll know which material is active because you'll see a faint grey circle surrounding the black circle icon next to each material.
Now, look at the bottom of your screen - we've been ignoring the panels that run the length of the bottom of the screen up until now because, well, I didn't find them necessary to mention until now. With your material active, you need to then switch from the material button (which is always the default screen on the bottom when you select a material) to the texture button. You can either click it or press the 'F6' key - whichever is easier. Look at the picture below as a diagram, which I'll be explaining next.
Now you should see a 'Map Image' box appear to the right. The [color=#FFFF00]yellow circle[/color] is there to show you that you need to DE-SELECT the 'usealpha' button.
Next, move over to the 'Image' box and click the up/down arrow box next to the 'load' button, [color=#FF8000]see the orange circle[/color]. This will pull up the sulfurastex.png that you opened up back in step 4.
8. You're almost done texturing the model! I'll walk you through this last part in the spoiler/image below.
First, switch back to the 'material button' by clicking on the red circle or pressing 'F5' as shown by the [color=#BF0000]red circle #1[/color] in the image above.
Second, click on the 'map input' tab, as shown by the [color=#4080FF]blue circle #2[/color] in the image above.
Finally, switch to 'UV' by selecting it, as shown by the [color=#FFBF40]orange circle #3[/color] in the image above.
You are now officially done with texturing this material. However, you need to go back and repeat these steps for each additional material associated with the mesh. Simply select the second material in your 'outliner' section and repeat. Once you've assigned a texture to each material you're outliner should look like this:
Note that the green circle is showing you that you now have a texture associated with the material for this mesh. You are now ready to export this model and try it out in Torchlight.
1. First, make sure that your model is still actively selected. You can make sure it's active by looking in your 'Outliner' section and see that your project name, which we called Sulfuras, is showing as white text. See the pic below for a visual:
2. Second, select File → Export → Ogre Meshes
3. Set-up your Ogre Meshes Exporter screen as shown in the image below:
4. The yellow circle[/color] is the 'preference' button - click on this now.
5. In the preferences section, you'll need to do several things as outlined in the image below:
The first time you export a model in blender, you'll need to tell it where to find your OgreXMLconverter.exe
Commentary: part of ogrecommandlinetools that you downloaded way back at the start of all this! Select the 'manual' button as shown in the orange circle. Then you'll have to manually select the ogreXMLconverter.exe, then click 'select converter'. Notice that you'll then see that blender has found your ogrexmlconverter.exe path as shown in the red circle. Next, DE-SELECT both 'reorganize vertex buffers' and 'edge lists' as shown by the blue circles. Finally, click 'OK' (as shown by the light green circle). This takes you back to the initial export screen you were just at. Simply click 'export'.
6. You'll see blender spit out a scrolling list of junk. None of which concerns you - but here's the screenshot just so you can see it. (I'm a bit OCD, remember? :lol: )
7. Now you're done with blender. Let's place the files in your mod folder and set up the .dat files so we can test Sulfuras!
Now if you've already set-up your new mod folder as I described at the beginning under Set-up in Part I, then we can proceed. If you haven't done that yet, then please set up your mod folder then return to this step.
1. First, we start the oh-so-fun task of playing everyone's favorite game, “WheredidBlenderexportmymeshandmaterialfilestoo?” :lol: Normally, and I say this loosely, blender will export your *.mesh, *.mesh.xml, and *.material files to wherever you intalled blender. For me, it normally spits them out into c:\blender\blender-2.49b-windows\ folder.
Go there, make a shortcut link to save yourself the headache of manually finding it in the future. Since we named our model sulfuras.mesh and sulfuras.material, go find those. Here they are in my folder, as shown in the image below:
2. Select both the sulfuras.mesh and sulfuras.material (note: I always place the *.mesh.xml file in the mod folder along with the actual .mesh and .material in case I have to go back and re-edit the model in the future.
Blender can only import a .mesh.xml file, not just a .mesh. While you don't have to keep your sulfuras.mesh.xml file, I prefer it…you know, the whole OCD thing and all.) Cut and paste them into your Mod folder as shown below:
You want to place both your sulfuras.mesh and sulfuras.material in the same folder that your sulfurastex.png was placed originally. For our tutorial, we're placing them in the sulfuras folder located within the weapons folder.
3. Now, we need to create a sulfuras.dat file and place it in the following directory:
I'm placing it in the polearm folder because I want it to be a 2-hander. However, if you'd prefer it to be a 1-handed mace, place it the units\items\maces folder instead.
Think of your .dat file as the roadmap that tells torchlight where to find the item you just created for your mod. Below is the actual working sulfuras.dat file that I have in my mod folder right now. You can cut-and-paste this to get you started. I won't be going into all the finer details of .dat editing, assigning affixes, etc - that's for another tutorial. But for our purposes, this will do.
[UNIT] <STRING>BASEFILE:media\units\items\polearms\base_polearm_unique.dat <STRING>RESOURCEDIRECTORY:media/models/weapons/sulfuras2 <STRING>ICON:sulf2_icon <INTEGER>RARITY:50 <INTEGER>LEVEL:90 <STRING>FALL_SOUND:Item Fall <STRING>LAND_SOUND:MetalDrop <STRING>TAKE_SOUND:MetalGet <STRING>NAME:ragdrop2 <INTEGER>SPEED_DMG_MOD:100 <INTEGER>SPEED:125 <INTEGER>DAMAGE_PHYSICAL:100 <INTEGER>DAMAGE_FIRE:200 <FLOAT>STRIKERANGE:3 <INTEGER>RARITY:100 <STRING>SOCKETS:2 <INTEGER>ICON_SHEET:1 <TRANSLATE>DISPLAYNAME:Sulfuron, Heart of Ragnaros <INTEGER>STRENGTH_REQUIRED:116 <INTEGER>DEFENSE_REQUIRED:0 <STRING>GAMBLER_ICON:hammer_02 <STRING>MESHFILE:sulfuras2 <STRING>MISSILE:ORDRAKFIREBALL <INTEGER>VALUE:100 <INTEGER>RARITY_HARDCORE:50 <INTEGER>MINLEVEL:50 <STRING>UNIT_GUID:6014076367632863712 <TRANSLATE>DESCRIPTION:The Firelord has returned! [AFFIXES] <STRING>AFFIX:UNIQUE_ATTACK_SPEED5 <STRING>AFFIX:UNIQUE_CRIT_CHANCEXXX <STRING>AFFIX:UNIQUE_CRITICAL_DAMAGE_BONUS8XXX <STRING>AFFIX:UNIQUE_DAMAGE_ADD_4WEAPONSXXX <STRING>AFFIX:UNIQUE_DEGRADE_ARMOR5 <STRING>AFFIX:UNIQUE_DIRECT_BURN_PERCENT_ALWAYS <STRING>AFFIX:UNIQUE_FIREDEFENSE5 <STRING>AFFIX:UNIQUE_FLEE_SHORT_DURATIONXXX <STRING>AFFIX:UNIQUE_GOLD_DROP9 <STRING>AFFIX:UNIQUE_ICEDEFENSE5 <STRING>AFFIX:UNIQUE_KNOCKBACKXXX <STRING>AFFIX:UNIQUE_LIFE_STEALXXX <STRING>AFFIX:UNIQUE_LUCKXXX <STRING>AFFIX:UNIQUE_MANA_STEALXXX <STRING>AFFIX:UNIQUE_MAX_HPXXX <STRING>AFFIX:UNIQUE_MAX_MANAXXX <STRING>AFFIX:UNIQUE_MELEE_DAMAGE_BONUS5 <STRING>AFFIX:UNIQUE_OFFLAME9 <STRING>AFFIX:UNIQUE_PERCENT_DAMAGE_TAKENXXX <STRING>AFFIX:UNIQUE_PET_DAMAGEXXX <STRING>AFFIX:UNIQUE_PET_HEALTH9 <STRING>AFFIX:UNIQUE_PET_VELOCITY5 <STRING>AFFIX:UNIQUE_THORNS9 <STRING>AFFIX:UNIQUE_TURN_ALIGNMENT_LONG_DURATIONXXX <STRING>AFFIX:UNIQUE_VELOCITY5 [/AFFIXES] [/UNIT]
Make sure you change the .dat file directories to whatever you named your own. I already had a sulfuron folder in my weapons directory so I had to name this one sulfuras2
Change sulfuras2 with whatever you named your folder under the WoW Mod\media\models\weapons\*
Make sure you tell TL where your newly export sulfuras.mesh file is located and what it's called.
Note that I named mine sulfuras2, but if you're following the tutorial literally, just name it sulfuras. This tells TL to pull the sulfuras.mesh file from your directory that you assigned in the code directly above this.
Next, DELETE THIS STRING
This Unit_GUID:# is what TL assigns to each item in the game. The first time you're importing a newly created item, you need not have this string in your .dat file. TL will automatically write this string and # upon loading the game.
Next, input a name that you can enter into the console to spawn the item for the testing in-game.
Note that I named mine ragdrop2, but you can name it whatever you want. In the game, open up your console by hitting 'SHIFT' + '~' and then type 'ragdrop2' then 'ENTER'. If your .dat file is setup correctly, the item will drop. If TL crashes to the desktop, 9 times out of 10 that means you didn't input your directories correctly in the .dat file and TL couldn't generate the item. Go back and check your .dat file again for errors.
Commentary: There's been some talk on the forumns in the past about the the .dat.adm files. As far as I've seen, once TL has read your .dat file upon loading, it'll generate a second .dat.adm file. Just ignore them. If you ever need to change your .dat file, due to errors or whatnot, when you re-load TL it'll generate a new .dat.adm and overwrite the old .dat.adm file.
Lastly, if you want to create a custom icon for the item you just created, you can put the icon name here in the .dat file:
you can name the icon anything, but it must always end with _icon - for myself, I named the icon I created sulf2_icon.
Creating a custom icon is quite simple, but optional. TL will spawn your newly imported item with no icon attached, but that's no fun is it? You'll need to take a screenshot of your weapon in WMV.
With WMV open to the weapon you imported (in our case, Sulfuras), select File → Save Screenshot then designate a place to save the screenshot. I always send my screenshots to my WIP folder on my desktop. It'll spit it out as a .bmp format. You'll need to open the image in a photo editing program, rotate it to your liking, then resize it to 64W x 96H pixels. Save it as something like sulfuras_icon.png (I save all mine in .png format, icons and textures - never tried another format so can't speak to it).
Now place your sulfuras_icon.png in your Mod folder directory as shown below:
Next, you'll need to create an .imageset file and name it the same as your icon file. For the purposes of this tutorial, we'll name it sulfuras.imageset I bet you're asking, how the hell do I create an .imageset file?
Here's how: open up any text editing program (notepad will do) and cut and paste the following into it:
<?xml version="1.0" encoding="UTF-8"?> <Imageset Name= "sulfuras" Imagefile="media/ui/itemicons/sulfuras_icon.png" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="true" > <Image Name="sulfuras_icon" XPos="0" YPos="0" Width="64" Height="96" /> </Imageset>
Save the file as sulfuras.imageset and then place it in the same folder with your sulfuras_icon.png. You're all set! You can repeat this for any new items you create, just switch out the name sulfuras for whatever you want the item to be called - duh! :roll:
So after all those steps, we're finally at the end. Go ahead and boot up TL or torchED (whichever you prefer, it matters not). Personally, I find it quicker to test newly imported weapons via torchED but whatever.
If all goes according to plan, when you pull up your console ('SHIFT' + '~') and type sulfuras, the item should drop like this:
Equip it and go smash some monsters - have fun!
Regarding shields, they are essentially the same to import/export as weapons are. Mostly, you need to play around with how you line up the shield in blender. See this pic for details:
View it from the side (marked 1) to make sure the pink dot (our point of contact) is somewhere in the middle. Then view it from the middle (marked 2 and 3) to make sure the pink dot is pretty much centered. Beyond that it's more trial and error with adjustments than anything.
Here's a screenshot of a shield correctly aligned:
Here is a working shield .dat files for reference:
[UNIT] <STRING>BASEFILE:media\units\items\shields\base_shield_unique.dat <STRING>RESOURCEDIRECTORY:media/models/armor/shields/elementiumbulwark <STRING>MESHFILE:bulwark <STRING>ICON:bulwark_icon <STRING>NAME:elebulwark <INTEGER>RARITY:175 <INTEGER>VALUE:9999 <BOOL>ALWAYS_IDENTIFIED:true <BOOL>MERCHANTINFINITE:false <INTEGER>LEVEL:28 <INTEGER>MINLEVEL:1 <INTEGER>MAXLEVEL:9999999 <INTEGER>ARMORMIN:20 <INTEGER>ARMORMAX:20 <TRANSLATE>DISPLAYNAME:Elementium Bulwark <TRANSLATE>DESCRIPTION:Chromaggus's prized possession. <BOOL>SHADOWS:true <STRING>GAMBLER_ICON:skeletonshield <STRING>UNIT_GUID:1086234675334091232 <INTEGER>RARITY_HARDCORE:175 <INTEGER>RARITY_AMR_MOD:200 <INTEGER>SPECIAL_AMR_MOD:100 <INTEGER>ARMOR_PHYSICAL:75 <INTEGER>BLOCK_CHANCE:25 <INTEGER>ARMOR_FIRE:25 [WARDROBE] <STRING>CLASS:ALCHEMIST [/WARDROBE] [AFFIXES] <STRING>AFFIX:UNIQUE_ARMOR_BONUS3 <STRING>AFFIX:UNIQUE_ARMOR_PERCENT_BONUS2 <STRING>AFFIX:UNIQUE_DEFENSE_BONUS2 <STRING>AFFIX:UNIQUE_LIFE_STEAL2 <STRING>AFFIX:UNIQUE_LUCK3 <STRING>AFFIX:UNIQUE_MAX_HP3 <STRING>AFFIX:UNIQUE_MISSILE_REFLECT2 <STRING>AFFIX:UNIQUE_THORNS2 [/AFFIXES] [/UNIT]