Tutorial: Dbmaker, Hex Editing and Custom Monsters

Discussion in 'Modding and Scripting Support' started by The Pigeon, Jul 16, 2012.

Remove all ads!
Support Terra-Arcanum:

GOG.com

PayPal - The safer, easier way to pay online!
  1. The Pigeon

    The Pigeon Member

    Messages:
    305
    Likes Received:
    5
    Joined:
    Nov 28, 2007
    Tutorial WIP: Dbmaker-Hex-Hex Editing-Creatures

    Edit: 21st March 2013
    - If you have any comments or suggestions please let me know!


    This tutorial teaches you how to create a custom monster, although it can easily be applied to custom npcs and uniques as they use an almost identical process.

    While you can create custom guys (or gals!) in WorldEd, you won’t be able to use them in Random Battles. The monster prototype ranges haven’t been increased in the Arcanum data folder and the monster data isn’t in that folder either. They will be once you’ve done this tute though!

    Also, once you’re comfortable with this process, it’s quick and easy to add more creatures and it saves you manually editing a monster in WorldEd every time you want an exact copy.

    P.s. if there's anything you don't understand or have any comments please let me know in the comments.

    P.p.s. I was going to finish this later, but eh I felt inspired to sit down and finish it today so it is right here right now.

    Thanks to;

    Wims for dbmaker information. Dark Underlord for dbmaker information
    DrogAlt for dbmaker information, working with Hex, prototypes and monster.txt. The Edit Docs and Google Search for working with Hex. And thanks everyone else who's inspired me to do this stuff. If I've missed anyone here, let me know!

    By the end of this tutorial you will be able to:
    1) Extract data from module DAT files
    2) Read hexadecimal
    3) Add numbers together in hex
    4) Edit an exe file with a hex editor
    5) Create a Custom Monster with description.mes and monter.txt.

    Note: There is already a tutorial on dbmaker here http://terra-arcanum.com/amtut/amtut/undat_tutorial.htm but I'll include a cut down version here for your convenience. There are also hex tutorials in the edit docs and on the internet, but I’ve included the bare bones (hopefully in an understandable format!).

    Steps:
    Part 1: Setting up Arcanum and Dbmaker
    Part 2: Hex and Hex Editing
    Part 3: Monster Name and Stats

    ---------------------------------------
    ---------------------------------------
    Part 1: Setting up Arcanum and DB Maker
    ---------------------------------------
    ---------------------------------------

    You will need to have the 1074 Patch and Drog’s UAP patch installed for this tutorial. They are located at http://terra-arcanum.com/downloads/. You will also need dbmaker.exe to extract data from one of the Arcanum dat files. To do this, follow the following steps:

    1) Go to http://terra-arcanum.com/downloads/
    2) Click "Arcanum Modding"-> "Arcanum Modding Tools" and select "dbmaker.zip" under the ".dat utilities" section.
    A new webpage will open saying "This link will work only once - link to this page to share this file.".
    3) Click the link and save the file at "Arcanum\modules\modundatted".
    If you do not have a modundatted folder in modules, then create it.
    4) Extract the exe file and create a shortcut of it in the same folder.
    5) Copy the file "Arcanum5.dat" from you main Arcanum directory into "Arcanum\modules\modundatted".
    6) Right click the shortcut you made and click "Properties".
    7) Click the shortcut tab if it isn't selected already.
    8) In the "Target" box put the following text:

    C:\Games\Arcanum\modules\modundatted\dbmaker.exe -u "Arcanum5.dat"

    Note that the file path to dbmaker may differ on your computer, be sure to have it correct!
    9) Make sure the "Start in:" box has the correct path as well, e.g.:

    C:\Games\Arcanum\modules\modundatted

    10) Click "Apply" then double click the shortcut.
    You'll see a black console window open with the names of extracted files appear.
    11) Move the folders which appear to Arcanum\data.
    If asked if you want to overwrite anything click yes but. Note that here I am assuming you have no extracted data from any Arcanum dat file yet, but there should be a few folders here already. You now have access to some files which will be necessary for later steps, but before we look at that, we must first briefly cover hex and hex editing.

    ---------------------------------------
    ---------------------------------------
    Part 2: Hex and Hex Editing
    ---------------------------------------
    ---------------------------------------

    Arcanum has limits placed on the maximum number of creatures allowed and these are hard coded into the game. We can change these hard coded values with hex editing. First we must get a hex editor. I use HxD located here http://download.cnet.com/HxD-Hex-Editor ... 91068.html . I have no idea what separates one hex editor from another but I haven’t had any problems with this one, not yet anyway.

    12) With your Hex Editor downloaded and installed, open it up.
    13) In your Arcanum directory, make a backup of your Arcanum.exe in a zip file.
    14) Click “file -> open” and select “Arcanum.exe”.
    We won’t make any modifications just yet, first I’ll explain just what you’re looking at. If you’re using HxD you’ll see a lot of pairs of black numbers with some blue numbers above and to the left of them. The blue numbers above (00 01 02 03 04 05 06 07 08 09 0A etc) are the column names. The values on the left most column (00000000 00000010 00000020 00000030 etc) are the row names.

    The pairs of numbers and letters which are not blue are the data of the file in question. If you want to find a particular pair, you want what is called the offset. This is a single number which is the row number (e.g. row 0000 0010) and column (e.g. 01). Since the row’s last value is always 0 and the column is a single number, an offset for row 0000 0010 and column 1 is 0000 00011.

    If you are unfamiliar with hex, you might be confused why some of the hex values have letters. This is because unlike decimal which goes up to 10 (0 1 2 3 4 5 6 7 8 9 10), hex goes up to 16, using letters to represent numbers (0 1 2 3 4 5 6 7 8 9 A B C D E F 10). Note that 10 in hex is 16, because it is 1 lot of 16 and 0 lots of 1’s. In the same way 21 is 2x16 + 1 = 33.

    In Arcanum.exe hex numbers might be 1 value long, 2 values (so one of the pairs talked about ealier), 4 values (so 1 pair in one column and 1 pair in the column next to it) or more. For this tutorial all we care about are the 4 value numbers. The number we are going to increase 386F.

    IMPORTANT NOTE! For some numbers – such as this one – it is actually added up as 6F38, but for some reason the 38 and 6F are back to front. This makes the number:

    6x16^3 + Fx16^2 + 3x16 + 8 = 28472.


    This number is the upper limit to the amount of different monsters in Arcanum. There are multiple places it is located. In Arcanum.exe (you open it with the hex editor), they are 1B3898 and 9B354. The numbers are also in WorldEd.exe, at locations 1781D4 and 50BD4. Before I ask you to increase the number at these locations, I’ll quickly cover some addition in hexadecimal.

    Now we know that 38 is the pair we want to increase. If we wanted to only add 1 monster, 38 + 1 = 39. What if we wanted to add 2? It’s not 38+2=40, its 38+2 = 3A since A represents 10. 38 + 3 = 3B, 38+7 = 3F and 38+8 = 40. So now we know how to add we want to go to the hex offsets mentioned before. The first value’s location is 1B3898. So the row is 1B3890 and the column is 08. A quick way of finding an offset in HxD is using Ctrl+G.

    15) In HxD (having opened Arcanum.exe with it) press Ctrl and G.
    This opens up a small window with a text box and the description “offset” above it.
    16) In this text box type in 1B3898 and click “ok”.
    You should now see the value 38 at 1B3898, and the value 6F at 1B3899. Together they make the number we want to increase.

    Certain hex editors I hear require you to be in something called “overwrite mode” or something like that but it does not seem to be the case with HxD.

    17) Left click immediately before the ‘3’ of the ‘38’. Type in ‘39’.

    You should see 39 in red in the column 1B3898. If you save the file, the text will change to black.

    18) Go to location 9B354 and change the ‘38’ to ‘39’.

    19) Save the file and close HxD.

    20) Open HxD again and open WorldEd.exe with it.

    21) Go to offsets 1781D4 and 50BD4 and change the ‘38’ to ‘39’.

    22) Save the file and close HxD.

    We are now done editing hex values - unless in the future you wish to add more than one monster. When you do, DON’T FORGET WHAT VALUES YOU CHANGED IT TO SO YOU DON’T FREAK OUT WHEN YOU DON’T SEE 386F! It’s a good idea to write it down somewhere.

    Now we have the data extracted from Arcanum5.dat and we’ve increased the amount of creatures allowed by 1. Time to give our monster a name and set its stats!

    ---------------------------------------
    ---------------------------------------
    Part 3: Monster Name and Stats
    ---------------------------------------
    ---------------------------------------


    23) Go to Arcanum\data\mes and open “description.mes”

    This file is like the description file you’re used to working with for your own modules, but with a few important exceptions. One, you only add entries here if you’ve increased the maximum number of creatures (or items or whatever you happen to need a name for). Two, the number must match the increased value for allowed creatures. So if we have increased the value to 28472, then our creature name would look like {28472}{SomeNameHere}. If at a later date you want to change the name of the creature, feel free. Also, if you’ve increased the number by more than one (e.g. 3) it would look like this;

    {28472}{SomeNameHere}
    {28473}{SomeOtherName}
    {28474}{AwesomeCreature}

    24) Search for “{28471}{Undead Champion}”.

    This will take you to the point you want to start adding monster names after.

    25) Added in {28472}{CustomDude1}

    The last 4 entries should now look like this:

    {28469}{Ragged Fighter}
    {28470}{Skeleton Warrior}
    {28471}{Undead Champion}
    {28472}{CustomDude1}

    Now we need to edit our creature’s stats.

    26) Go to “Arcanum\data\rules” and open “monster.txt”

    27) Scroll down to the very bottom of the file.

    The last entry should be 28471 // Undead Champion

    Now you’ll note that there are many parameters here, which are faily self-explanatory. You can set level, flags, stats etc. This creature doesn’t have every parameter possible, so if you want others, look at previous entries, as well as in npc.txt and unique.txt.

    28) Copy the entry for Undead Champion and paste directly under it.

    29) Change the line
    Description: 28471 // Undead Champion
    in the copy to
    Description: 28472 // CustomDude1

    This is important or it won’t work properly. It’s also worth noting if you get the description number in description.mes as identical to a pre-existing one, you’ll get problems too! Always double check you haven’t made a mistake.

    We’ll leave the stats the same for this tutorial, but you can change as you like later. One thing before we leave monster.txt: Undead Champion is missing a “category” parameter. This means we’ll have to do something to make it appear in world ed which I’ll show you in a moment.

    If we wanted our guy to appear under animals, we’d use Category: 12. If we wanted undead, it’d be Category: 11. Let’s leave it unassigned for now.

    30) Go to “Arcanum\data\proto” and delete all the files there.

    Prototype files store data about creatures which the monster.txt file overwrites. However, if we want to see any changes in the appearance or stats of our guy, we must delete the prototype files so the game will automatically create new ones with the updated stats. If you ever see a guy in his underwear instead of a undead monster, or the name hasn’t been updated or the stats are wrong, this is probably why. Delete all prototypes every time you want to see a change in world ed or Arcanum.

    41) Create a shortcut to WorldEd.exe

    42) Right click the shortcut and click “Properties”

    You’ll see a line called “Target” with a text box next to it with the file path to the exe. E.g.

    C:\Arcanum\WorldEd.exe

    We want to add the parameter “-unassigned” to this so we can see creatures and stuff which don’t have a category. Our undead guy doesn’t have one.

    43) Add “-unassigned” at the end of the file path. E.g.

    C:\Arcanum\WorldEd.exe -unassigned

    At the bottom right of the window is an “Apply” button.

    44) Click “Apply” and then click “Ok”.

    45) Open WorldEd using this new shortcut.
    46) Open your module.

    47) In the critters tab, click the face and in the category drop down box, select “unassigned npcs”.

    48) Click “select”, then keep clicking “next” till you see “undead champion” as one of the named creatures.

    Your guy CustomDude1 should be immediately after him. Congratulations! You have now successfully made a custom creature : )

    One last tip, when you add creatures with categories, remember that they won’t appear under unassigned NPCs, they’ll appear at the end of the list of creatures for their category.
     
  2. Mr.Mole

    Mr.Mole New Member

    Messages:
    15
    Likes Received:
    0
    Joined:
    Jan 14, 2013
    Would it make any difference if I do not have the unofficial Patch?
     
  3. The Pigeon

    The Pigeon Member

    Messages:
    305
    Likes Received:
    5
    Joined:
    Nov 28, 2007
    I think it does, if I remember correctly the hex locations would be in different places. Pretty sure I had that come up when I was learning how to do it. I'll get back to you this evening (morning where I am) but I'd say for now make sure you have the patch.

    Update:

    Yeah, you should use the UAP, otherwise it won't work.
     
  4. Mr.Mole

    Mr.Mole New Member

    Messages:
    15
    Likes Received:
    0
    Joined:
    Jan 14, 2013
    Well, shit. Thanks for checking, I have modded the crap out of mine, and I'm pretty sure uap would wipe out my work. If I figure out a way, I'll post. Thanks for checking.
     
  5. Mr.Mole

    Mr.Mole New Member

    Messages:
    15
    Likes Received:
    0
    Joined:
    Jan 14, 2013
    FYI, you may already know this or have mentioned it, but some great palettes are attached to Tech-CloudHit_F.art, and SMALL-Conjure-1 & -2 in the eye candy folder. I have used them to create different colored shields of protection an all sorts of stuff, I am currently applying them to the elemental creatures' art (since I may not be able to create new creatures without a decompiler or hours of hex-edit experimentation :( ).
     
  6. The Pigeon

    The Pigeon Member

    Messages:
    305
    Likes Received:
    5
    Joined:
    Nov 28, 2007
    I haven't tried doing stuff with art yet (except for little bit with creating custom monsters) I'll keep that in mind.

    "Well, shit. Thanks for checking, I have modded the crap out of mine, and I'm pretty sure uap would wipe out my work. If I figure out a way, I'll post. Thanks for checking."

    Glad I could help, good luck with your modding!
     
  7. Mr.Mole

    Mr.Mole New Member

    Messages:
    15
    Likes Received:
    0
    Joined:
    Jan 14, 2013
    I am hoping this reaches you, Pigeon, or anyone else. I believe I can figure out how to add in new monsters without the Unofficial Patch, but I need a copy of of Arcanum.exe from someone who has installed the unofficial patch and I will need to know whether or not you have added any monsters. PM if you have it, I have some "goodies" I can email you in return (eventually I want to post them to downloads, anyhow, please help and I will post my progress).
     
  8. The Pigeon

    The Pigeon Member

    Messages:
    305
    Likes Received:
    5
    Joined:
    Nov 28, 2007
    Sent a PM but just wanted to add that I have added monsters, need to find my notes on how many I added. I'll send it tomorrow evening.
     
  9. Mr.Mole

    Mr.Mole New Member

    Messages:
    15
    Likes Received:
    0
    Joined:
    Jan 14, 2013
Our Host!