This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [DBC] Creating New Factions  (Read 6261 times)

Valkryst

  • Moderators
  • Model Change Addict
  • *****
  • Posts: 224
    • View Profile
    • http://valkryst.com/blog/
[DBC] Creating New Factions
« on: June 04, 2014, 06:44:54 pm »
Hey,

After spending a few hours playing around with the DBC files, scouring Google for information, and a lot of frustration, I've finally managed to create custom factions and have them work/behave as a normal faction would. I haven't tested everything about the custom factions yet, but I know enough to write-up this tutorial. Before I start typing out this guide, I will admit that I'm no expert on DBC editing and that some of this information may be incorrect. If you know of any additional information, notice an error, etc.. just comment and I'll do my best to keep this thread updated. Oh, one last thing to note, I haven't tested any of this with Horde characters or Horde-aligned factions, so some of this may be a bit different for them. If you encounter errors I suggest that you upload your Faction.dbc and FactionTemplate.dbc files somewhere and then post below with your problem and a link to the files.

There are a few things that you'll need before editing a DBC file. I've seen many different programs, and even more people recommending each program over every other program, but the vast majority either didn't work or corrupted the DBC files. I'll only be recommending the programs that work for me. So, before you continue reading, please download this; it contains everything that I use. These programs will only work on Windows.

Just in case anyone wants to know what I'm running:
  • Windows 8, x64 -- Home
  • Debian 7 x32 -- Server
  • TrinityCore -- Latest version as of 5/June/2014
  • WoTLK 3.3.5a

Assuming that you've followed my instructions to download the tools that we'll be using in this tutorial, lets begin!

The questions that you should ask yourself before creating a new faction are:
  • What will the new faction be called?
  • How can I describe the new faction?
  • Is the faction part Alliance, Horde, Neutral, or Monsters?
  • Who should the faction attack Horde players, Alliance players, or Monsters? Maybe all of them? Maybe just players?
  • Who should the faction be friendly with? (Same races as who they should attack.)
  • What is the faction comprised of? (Same races as who they should attack.)
  • Should this faction be under a category of factions? If so, what category?
  • Should the category of this faction, if there is one, be under another category?
  • There are many more questions, but you should be able to figure them out for yourself when you start making factions. =P

The most difficult part about creating a faction is not the DBC editing. The most difficult part of creating a faction is actually figuring out all of the questions listed above. The reason for this is because, once you create your factions and players start using them, any time you give a new MPQ patch to your players that updates and factions that the players have already encountered there is a very high chance that the reputation pane will bug-out and stop displaying the faction or in some other way to all players that have already encountered it. I haven't completely explored this issue, but in my experience this bug occurs quite frequently if not always. My best suggestion would be to create all of the factions, the faction hierarchy, and have everything tested so that it's perfect before you ever give the patch to your users.

Quote
Tip:
When editing any files that can be packed into an MPQ file, you can just go into your Data/enUS/ folder and create a new folder, lets call it "patch-enUS-n.mpq", and place all of the files that you would place into the MPQ file in there. This is extremely useful if you don't want to keep on creating a new MPQ file every time you go to test new edits. When you release the edits you should place them into an MPQ file as it hides everything from the average user.

Credits to MyLilSuccy for this information.

If you already know how to edit DBC files, which I'm going to assume that most of the people reading this don't, then you can skip to the end of this post and check out my notes on the DBC files. Although I would recommend doing a quick read-through of the tutorial. :)

The rest of this will be a simple explanation of how to add a new faction category called New (Master Faction) and a faction called Test Alliance Faction.

-----------------------------------------------------------------------------------------------------------------------------------

Now that you've downloaded the tools and have a folder of clean, unedited, DBC files to work with and revert to incase of any unforeseen errors, lets begin!

The first thing that you need to do is copy Faction.dbc and FactionTemplate.dbc from your folder of clean DBC files into /Tools/DBCUtil/ and double-click on DBCUtil.exe. Next you must go to /Tools/CSVed/ and double-click CSVed.exe to open the program. You should open two instances of CSVed.exe to make this a bit easier. Now click File and then go open Faction.dbc.csv in /Tools/DBCUtil/, if you have a second instance of CSVed.exe running you should open FactionTemplate.dbc.csv in it. I'll be assuming that you have two instances of CSVed.exe open with one of the files in each, if you don't then you may need to read through this tutorial twice to complete it.

This next step needs to be repeated in both instances of CSVed.exe, do it twice in each instance. Scroll to the bottom of the file, right-click on the last row, select Copy Selected Record(s), left-click on the last row, now right-click on the last row, and select Paste Record(s) below Cursor Pos. Now we will proceed by editing Faction.dbc.csv, we will get to FactionTemplate.dbc.csv later on. For an explanation on what each column represents, please refer to my notes as I will not be explaining every value we're going to insert in this part of the tutorial. Double-click on the second-last row to open up the edit form window and type in the following values, for any columns not listed below just leave them blank. When you're finished editing the columns you need to click Apply Changes in the bottom-left corner of the edit form window.

  • Column 1 - 1161
  • Column 2 - 105
  • Column 3 - 1100
  • Column 4 - 690
  • Column 5 - 0x1
  • Column 17 - 0x10
  • Column 19 - 1162
  • Column 24 - Test Alliance Faction
  • Column 41 - Test Description - Test Alliance Faction

Now double-click on the last row and fill in these values:
  • Column 1 - 1162
  • Column 2 - -1
  • Column 3 - 1791
  • Column 24 - New (Master Faction)

Now click File, then Save, and then close this instance of CSVed.exe. In the remaining instance of CSVed.exe double-click on the second-last row and fill in these values:
  • Column 1- 2237
  • Column 2 - 1161
  • Column 4 - 3
  • Column 5 - 2
  • Column 6 - 12
  • Column 11 - 1162

Now apply those changes and double-click on the last row and fill in these values:
  • Column 1 - 2238
  • Column 2 - 1162

Save all of the changes above just like we did the first time and then exit CSVed.exe. Now go into /Tools/DBCUtil/ and, one-by-one, drag Faction.dbc.csv and FactionTemplate.dbc.csv onto DBCUtil.exe, if the .dbc files are still there delete them first. The second last step is to copy Faction.dbc and FactionTemplate.dbc into your server/bin/dbc/ folder and restart your server.

The final step is to create the MPQ file. Goto /Tools/mpqediten64/ and create a folder called Modified Files, then within that folder create another folder called DBCFilesClient, then paste Faction.dbc and FactionTemplate.dbc into /Tools/mpqediten64/Modified Files/DBCFilesClient/. Now go back up to /Tools/mpqediten64/ and double-click MPQEditor.exe, then click New MPQ, enter the name as patch-# (I'll use patch-5), then click Next, and then select Build the MPQ archive from a file or directory and enter the path to /Tools/mpqediten64/Modified Files/, now just keep clicking Next until the MPQ is created, then you can exit the program and copy patch-#.mpq into your /WoW/Data/ folder. After that just restart your server and test out the new factions.


Proof that this works:

Link to the fullsize image.


Link to the fullsize image. Please ignore the Scarlet Factions and New (Master Faction) parts of the faction hierarchy, they aren't currently part of this tutorial.

If you want to stay up-to-date with my latest tutorials or if you just want an easier way to view all of my tutorials and releases in one place then take a look at my blog.

-----------------------------------------------------------------------------------------------------------------------------------

My notes on the DBC files:


Faction.dbc
  • Column 1 - Unique row ID.
  • Column 2 - Unique rep ID, just make sure no other factions use the number and then forget about it. I haven't found any use for it, it just has to be unique. Use -1 if you don't want players to be able to gain reputation with the faction, this will also cause the faction not to show-up on the reputation pane.
  • Column 3 - Sets who the faction is allied with. If Horde-aligned use (Untested) 690, else if Alliance-aligned use 1100, else if Neutral use (Untested) 1791.
  • Column 4 - Sets who the faction is at war with. If Horde-aligned use (Untested) 1100, else if Alliance-aligned use 690, (Untested) else if Neutral use 0.
  • Column 5 - Use 0x1, I believe this says to show the faction name in the tooltip. You can only see the tooltip if you're allied to the NPC. (Ex: Horde only see faction names on Horde NPCs) For Horde try using 0x2.
  • Column 11 - Starting rep when faction is encountered?
  • Column 12 - Lowest possible rep?
  • Column 13 - Something to do with rep probably.
  • Column 15 - See notes further down the post.
  • Column 17 - See notes further down the post.
  • Column 19 - Parent faction, points to a row in Faction.dbc.
  • Column 24 - Faction Name
  • Column 41 - Description (Shows up in the reputation pane of the character screen in-game.)



FactionTemplate.dbc
  • Column 1 - Unique row ID.
  • Column 2 - Points to a row in Faction.dbc.
  • Column 4 - What type of faction are we? (For Alliance use 3. For horde use 5. For monsters use 8.)
  • Column 5 - What type of factions are we allied with? (For alliance use 2. For horde use 4. For monsters use 8 if allied with other monsters, else use 0.)
  • Column 6 - What type of factions are we at war with? (For alliance use 12. For horde use 10. For monsters use 7. If you don't want NPCs of the faction attacking monsters, subtract 8 from the number.)
  • Column 11 - Parent faction, points to a row in Faction.dbc.

All columns not listed in my notes were left at their default values. A few of the columns do certain things, but I don't want to spend another 8 hours trying to figure out how they work.

When editing your new factions to change names, data, etc... there is always a very high chance that any characters that had reputation/knew the faction before your latest edit will bug out and not show the faction in the reputation pane of their character screens. Be absolutely certain about what you're creating and what you have created before you release these patches to your users as it would be a terrible loss to have to delete an old character just for a small faction update.

When creating a faction hierarchy like I have in the second picture above, you just need to create a faction, in Faction.dbc, with a unique ID in Column 2, add in a name for the faction, and leave out the description as you can't view it in-game. Now just reference my notes on the Columns above and add the faction you just created as the parent of whatever factions that you want listed under the faction you just created.

Major Update:

After a solid three hours of trying to get the "At War" button on the reputation pane of the character screen to be unselect/unclickable I've managed do document the previously unknown Columns 15 and 17 of Faction.dbc. I cannot guarantee this information for a Horde-aligned faction or Horde characters, but I strongly believe that it is the same on both factions. Whenever I mention Humans just replace that with Orcs and whenever I mention the other races, just group them together and switch for the other faction's races.

It seems that Columns 15 and 17 only affect the reputation pane of the character screen, and that Column 15 applies to all non-human races whereas Column 17 specifically applies to humans. (The same should be true for Horde races)

Column 15:
  • 0x0 - Default Value
  • 0x1 - Faction shows up on character creation of Dwarves, Night Elves, Gnomes, and Draenei.
  • 0x2 - No change from 0x0 as far as I've seen.
  • 0x4 - Hides the faction, in the reputation pane of the character screen, from Dwarves, Night Elves, Gnomes, and Draenei.
  • 0x8 - Same as 0x4.
  • 0x10 - Greys out the "At War" button from the faction on the description pane of the reputation pane, for Dwarves, Night Elves, Gnomes, and Draenei.
  • 0x16 - Same as 0x4.
  • Any multiples above 0x16 such as 0x32 and above seems to be extremly buggy.
  • Other values probably exist, but I only went by multiples of two. You may be able to add them together like all other flags, but I haven't tested that. Ex: 0x1 + 0x10 = 0x11 Shows up on char creation & has "At War" greyed out.

Column 17:
  • 0x0 - Default Value
  • 0x1 - Faction shows up on character creation of Humans.
  • 0x2 - No change from 0x0 as far as I've seen.
  • 0x4 - Hides the faction, in the reputation pane of the character screen, from Humans.
  • 0x8 - Same as 0x4.
  • 0x10 - Greys out the "At War" button from the faction on the description pane of the reputation pane, for Humans.
  • 0x16 - Same as 0x4.
  • Any multiples above 0x16 such as 0x32 and above seems to be extremly buggy.
  • Other values probably exist, but I only went by multiples of two. You may be able to add them together like all other flags, but I haven't tested that. Ex: 0x1 + 0x10 = 0x11 Shows up on char creation & has "At War" greyed out.

-----------------------------------------------------------------------------------------------------------------------------------

Edit ~ 18/Apr/2014:
  • Added an additional note on faction hierarchies in the notes section.
  • Improved the pre-tutorial section of this post.
  • Confirmed my suspicions about a few Columns in Faction.dbc after finding this tutorial.
  • Added two notes below the images.
  • Edited a few notes, starting work on a rewrite of the tutorial.
  • Finished rewriting the pre-tutorial section.
  • Removed some incorrect information in my notes.
  • Discovered some previously, as far as I know, unknown information about Columns 15 & 17 of the Faction.dbc file. If someone could get in touch of the TrinityCore team and have them update their Wiki with this information, that would probably help out a lot of people. See my notes section for the documentation.
  • Editing the tutorial now, it should be ready for use in about an hour.
« Last Edit: June 05, 2014, 10:53:09 pm by Admin »
MY BLOG IS NOW HERE.

kojak488

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 351
    • View Profile
Re: [DBC] Creating New Factions
« Reply #1 on: June 05, 2014, 04:30:38 am »
I read this guide from you on OwnedCore.  It was a great help in learning factions. ^_^  A few notes from what I've learned:

Faction.dbc:
Columns 3, 4, 5, and 6 are all race masks when converted to binary.  For example, Faction 81 (Thunderbluff) has values of 130, 1101, 16, and 0x20 respectively.  130 in binary is 10000010 and is read from right to left and are as follows:

Human
Orc
Dwarf
Night Elf
Undead
Tauren
Gnome
Troll
Goblin
Blood Elf
Draenei

So 10000010 has a 1 for Orc and Troll.  Therefore, the value of 130 in field 3 means it's setting the Thunderbluff reputation for Orcs and Trolls.  1101 to binary is 10001001101.  This is flagging the alliance characters (Human, Dwarf, Night Elf, Gnome, and Draenei.  The 16 is 10000, which is for Undead.  The 0x20 is for Tauren.  **I think my values here may be off for one because I'm almost certain I edited out the Blood Elf race mask on my project**

Columns 3, 4, 5, and 6 are set by their respective values in columns 11, 12, 13, and 14.  Columns 7, 8, 9, and 10 are also race masks, but I'm not sure what field they interact with.  I presume it's 15, 16, 17, and 18.  

So using the above, field 3 with a value of 130 is defining the race mask of Orcs and Trolls.  Field 11 says that these races start with 3100 reputation with Thunderbluff (100 reputation into friendly).  Field 4 with a value of 1101 defines the alliance races and says they are all at -42000 reputation (hated) with Thunderbluff.  Field 5 with a value of 16 defines that Undead start with 500 reputation from field 13 whilst field 6 defines Tauren starting with 4000 reputation from field 14.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Valkryst

  • Moderators
  • Model Change Addict
  • *****
  • Posts: 224
    • View Profile
    • http://valkryst.com/blog/
Re: [DBC] Creating New Factions
« Reply #2 on: June 05, 2014, 04:40:01 am »
:o This is great information, thanks! Would you mind if I updated all of my threads containing this tutorial with the information, after I do some tests when I get time, with credits OFC.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
MY BLOG IS NOW HERE.

kojak488

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 351
    • View Profile
Re: [DBC] Creating New Factions
« Reply #3 on: June 05, 2014, 04:59:33 am »
Go for it. :)

It's been a while since I tinkered with my factions and I realized I forgot something.  Fields 15, 16, 17, and 18 are the flags for fields 3, 4, 5, and 6 respectively.

For example, I created my own reputation with a value of 1791 in field 3.  1791 is 11011111111 in binary, which means it applies to all factions (except goblins).  In field 15 I put 0x1, which makes it display for all races.  I had a 0 in field 7; so fields 7, 8, 9, and 10 aren't linked to 15, 16, 17, and 18 like I postulated earlier.  Or at least they don't interact in the way I had assumed.

[Edit] By the way 15, 16, 17, and 18 are definitely bit masks that can be added together.  And some of the flags override other flags.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Valkryst

  • Moderators
  • Model Change Addict
  • *****
  • Posts: 224
    • View Profile
    • http://valkryst.com/blog/
Re: [DBC] Creating New Factions
« Reply #4 on: June 08, 2014, 09:59:12 pm »
I've done a two large tests along with a few minor tests to confirm your findings. I've managed to confirm most of it, but I can't get the numbers to give expected results.

I first used this webpage to do a quick base 2 to base 10 conversion. The numbers I used for testing are:

10110010001 = 145 All Alliance races
01001101110 = 110 All Horde races

My two major tests resulted in the following data:

Column 3 = 145
Column 4 = 110
Column 11 = 6000
Column 12 = -42000

All except for Dreanei are hostile.
Orcs/Tauren hostile, Undead/Trolls friendly, Belfs neutral.

Column 3 = 110
Column 4 = 145
Column 11 = 6000
Column 12 = -42000
Human/Draenei neutral, Dwarf/Nelf/Gnome friendly.
OrcsTauren friendly, Undead/Troll hostile, Belf Neutral.

Do you notice anything which I may have misunderstood or gotten wrong? From my understanding of your post the first test should have resulted in the NPCs being friendly with all Alliance characters and hostile with Horde characters and vice-versa for the second test.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
MY BLOG IS NOW HERE.

kojak488

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 351
    • View Profile
Re: [DBC] Creating New Factions
« Reply #5 on: June 09, 2014, 01:41:03 am »
Quote from: "Valkryst"
10110010001 = 145 All Alliance races

That's not correct.  All alliances races would be 10001001101.  As I said in my initial post the race mask is read from right to left.  You're putting in from left to right.  And it translates to a decimal value of 1101.

I don't even know how you got 145 based off that.  145 decimal to binary is 10010001.  Your number of 10110010001 in binary is 1425 in decimal.

Quote from: "Valkryst"
01001101110 = 110 All Horde races

See the above.

Quote from: "Valkryst"
Column 3 = 145
Column 4 = 110
Column 11 = 6000
Column 12 = -42000

column 3 with value of 145 to binary is 10010001.  That translates to humans, undead, and trolls (right to left - remember this).  This means that those three should have 6,000 rep with whatever faction this is.

column 4 with value of 110 to binary is  01101110.  That translates to Orc, Dwarf, Night Elf, Tauren, and Gnome.  This means those five should be hated with the reputation.

Quote from: "Valkryst"
All except for Dreanei are hostile.
Orcs/Tauren hostile, Undead/Trolls friendly, Belfs neutral.

I personally doubt those are how the factions turned out.  That or I'm not getting the correct numbers.  It'd be far easier to see if you uploaded the dbc itself.  In any case you got the race masks backwards and that throws off your expected results.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Valkryst

  • Moderators
  • Model Change Addict
  • *****
  • Posts: 224
    • View Profile
    • http://valkryst.com/blog/
Re: [DBC] Creating New Factions
« Reply #6 on: June 09, 2014, 02:16:56 am »
D'oh. Well, at least I got all of the stupid out of me earlier today. Thanks for checking over and correcting my mistakes. I'll redo the tests a little bit later and stop using a junky online tool to do the base conversion for me, good thing I learned how to do it earlier this year. =P
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
MY BLOG IS NOW HERE.

kojak488

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 351
    • View Profile
Re: [DBC] Creating New Factions
« Reply #7 on: June 09, 2014, 05:50:29 pm »
I use online tools for the binary/dec conversions.  The one you linked is horrible though because it's limited to 8 bits.  It truncated the value to 8 bits and that appears to be how you wound up with weird numbers for the conversions.

Just don't forget your race masks were wrong too.  :ugeek:
« Last Edit: January 01, 1970, 01:00:00 am by Admin »