# Baldur's Gate  Enhanced Edition  Hex Editing Codes

**URL:** <https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477>\
**Category:** The Game Room\
**Created:** [January 15, 2020, 9:44pm UTC](https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477 "2020-01-15T21:44:35Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Damuri\_Ajashi](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@Damuri\_Ajashi](https://boards.straightdope.com/u/Damuri_Ajashi)\
**Post date:** [January 15, 2020, 9:44pm UTC](https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477/1 "2020-01-15T21:44:35Z")

</div>

So I am getting back into Baldur’s Gate but i want to customize the game. I have the game on my phone and i can’t figure out how to use EEKeeper.

But I do know how to use a hex editor.

The main thing i want to do is change alignments and classes. I want Jaheira=Ranger/Cleric, Khalid= Paladin, Minsc=Berserker, Imoen=Thief/Mage multi-class, Dynaheir=Sorcerer

I know where the class hex location is and I know the class codes for:

Mage=1  
Fighter=2  
Cleric=3  
Thief=4

But I do not have and cannot find class codes for any of the others and i fear I am starting to destroy saved games to figure it out.

Does anyone have these class codes

I would also like to know a few alignment and race codes and hex locations so that I can change Khalid to LG, etc.

---

<div class="post-metadata">

**Author:** ![GESancMan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/gesancman/32/2923_2.png) [@GESancMan](https://boards.straightdope.com/u/GESancMan)\
**Post date:** [January 15, 2020, 10:17pm UTC](https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477/2 "2020-01-15T22:17:05Z")

</div>

I’m guessing since you’re on your phone you don’t have a way to access the game resources. There is a file called class.ids, which defines the constants for all classes and races (including monsters and whatnot). These numbers are in base 10, not hex. The first 21 lines are:

1 MAGE  
2 FIGHTER  
3 CLERIC  
4 THIEF  
5 BARD  
6 PALADIN  
7 FIGHTER\_MAGE  
8 FIGHTER\_CLERIC  
9 FIGHTER\_THIEF  
10 FIGHTER\_MAGE\_THIEF  
11 DRUID  
12 RANGER  
13 MAGE\_THIEF  
14 CLERIC\_MAGE  
15 CLERIC\_THIEF  
16 FIGHTER\_DRUID  
17 FIGHTER\_MAGE\_CLERIC  
18 CLERIC\_RANGER  
19 SORCERER  
20 MONK  
21 SHAMAN

Everything after that is races and monsters.

If you’re looking to also assign kits, there is a file called kit.ids, which defines all kit constants, this time in hexadecimal.

---

<div class="post-metadata">

**Author:** ![GESancMan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/gesancman/32/2923_2.png) [@GESancMan](https://boards.straightdope.com/u/GESancMan)\
**Post date:** [January 15, 2020, 10:30pm UTC](https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477/3 "2020-01-15T22:30:25Z")

</div>

Oops! Missed the last line of your post.

race.ids:

1 HUMAN  
2 ELF  
3 HALF\_ELF  
4 DWARF  
5 HALFLING  
6 GNOME  
7 HALFORC  
align.ids:

0x00 NONE  
0x11 LAWFUL\_GOOD  
0x12 LAWFUL\_NEUTRAL  
0x13 LAWFUL\_EVIL  
0x21 NEUTRAL\_GOOD  
0x22 NEUTRAL  
0x23 NEUTRAL\_EVIL  
0x31 CHAOTIC\_GOOD  
0x32 CHAOTIC\_NEUTRAL  
0x33 CHAOTIC\_EVIL  
0x01 MASK\_GOOD  
0x02 MASK\_GENEUTRAL  
0x03 MASK\_EVIL  
0x10 MASK\_LAWFUL  
0x20 MASK\_LCNEUTRAL  
0x30 MASK\_CHAOTIC

I fired up Near Infinity, and looked at a few NPCs, at it appears race is located at 0272, while alignment is located at 027b. This _should_ be uniform for all NPCs.

---

<div class="post-metadata">

**Author:** ![Damuri\_Ajashi](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@Damuri\_Ajashi](https://boards.straightdope.com/u/Damuri_Ajashi)\
**Post date:** [January 15, 2020, 10:47pm UTC](https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477/4 "2020-01-15T22:47:30Z")

</div>

> [@Damuri\_Ajashi](#):
>
> So I am getting back into Baldur’s Gate but i want to customize the game. I have the game on my phone and i can’t figure out how to use EEKeeper.
> 
> But I do know how to use a hex editor.
> 
> The main thing i want to do is change alignments and classes. I want Jaheira=Ranger/Cleric, Khalid= Paladin, Minsc=Berserker, Imoen=Thief/Mage multi-class, Dynaheir=Sorcerer
> 
> I know where the class hex location is and I know the class codes for:
> 
> Mage (M)=01  
> Fighter(F)=02  
> Cleric(C)=03  
> Thief(T)=04
> 
> But I do not have and cannot find class codes for any of the others and i fear I am starting to destroy saved games to figure it out.
> 
> Does anyone have these class codes
> 
> I would also like to know a few alignment and race codes and hex locations so that I can change Khalid to LG, etc.

Mage(M)=01  
Fighter(F)=02  
Cleric(C)=03  
Thief(T)=04  
Bard(B)=05  
Paladin=06  
F/M=07  
F/C=08  
F/T=09  
F/M/T=0a  
Druid(D)=0b  
Ranger(R)=0c  
M/T=0d  
C/M=0e  
C/T=0f  
F/D=10  
F/M/C=11  
C/R=12  
Sorcerer=13  
Monk=14  
Shaman=15  
[empty]=16+

The hex location for the class is 6 rows down and 5 columns to the right of the Charisma stat (or 53 spots after the Charisma stat)

Other hex locations are responsible for the class kit and alignment. I will update as I can

---

<div class="post-metadata">

**Author:** ![Damuri\_Ajashi](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@Damuri\_Ajashi](https://boards.straightdope.com/u/Damuri_Ajashi)\
**Post date:** [January 15, 2020, 10:52pm UTC](https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477/5 "2020-01-15T22:52:17Z")

</div>

> [@GESancMan](#):
>
> I’m guessing since you’re on your phone you don’t have a way to access the game resources. There is a file called class.ids, which defines the constants for all classes and races (including monsters and whatnot). These numbers are in base 10, not hex. The first 21 lines are:
> 
> 1 MAGE  
> 2 FIGHTER  
> 3 CLERIC  
> 4 THIEF  
> 5 BARD  
> 6 PALADIN  
> 7 FIGHTER\_MAGE  
> 8 FIGHTER\_CLERIC  
> 9 FIGHTER\_THIEF  
> 10 FIGHTER\_MAGE\_THIEF  
> 11 DRUID  
> 12 RANGER  
> 13 MAGE\_THIEF  
> 14 CLERIC\_MAGE  
> 15 CLERIC\_THIEF  
> 16 FIGHTER\_DRUID  
> 17 FIGHTER\_MAGE\_CLERIC  
> 18 CLERIC\_RANGER  
> 19 SORCERER  
> 20 MONK  
> 21 SHAMAN
> 
> Everything after that is races and monsters.
> 
> If you’re looking to also assign kits, there is a file called kit.ids, which defines all kit constants, this time in hexadecimal.

I don’t see those flags on the saved game hex data. Where do I find the class.id file you speak of?

---

<div class="post-metadata">

**Author:** ![Damuri\_Ajashi](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@Damuri\_Ajashi](https://boards.straightdope.com/u/Damuri_Ajashi)\
**Post date:** [January 15, 2020, 10:54pm UTC](https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477/6 "2020-01-15T22:54:08Z")

</div>

Do you know where the address is for kits? I’d like Minsc to be a Berserker but i can’t figure out how kits work.

---

<div class="post-metadata">

**Author:** ![GESancMan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/gesancman/32/2923_2.png) [@GESancMan](https://boards.straightdope.com/u/GESancMan)\
**Post date:** [January 16, 2020, 12:38am UTC](https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477/7 "2020-01-16T00:38:43Z")

</div>

> [@Damuri\_Ajashi](#):
>
> I don’t see those flags on the saved game hex data. Where do I find the class.id file you speak of?

On the PC, In the unmodded game, the files are all packed away in zipped files called biffs. There are a mess of them, I’m not sure it’s possible to locate which biff has which files. You need a program like Near Infinity to access them. Unfortunately, I don’t know how it works with a tablet or phone. Near Infinity is written in Java and is cross-platform (I use it on linux), so it’s possible it will work with Android (assuming that’s what you’re using).

If a mod touches a file, then it gets put in a folder called override, within the game folder. Then the file can be accessed directly. .ids files are just text files, so they can be opened right up.

The .ids file just defines constants. For our purposes, it’s a list of which integer indicates which class.

---

<div class="post-metadata">

**Author:** ![GESancMan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/gesancman/32/2923_2.png) [@GESancMan](https://boards.straightdope.com/u/GESancMan)\
**Post date:** [January 16, 2020, 12:41am UTC](https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477/8 "2020-01-16T00:41:31Z")

</div>

> [@Damuri\_Ajashi](#):
>
> Do you know where the address is for kits? I’d like Minsc to be a Berserker but i can’t figure out how kits work.

Looks like the kit offset is 0244. Here’s kit.ids:

0x4000 TRUECLASS  
0x4001 BERSERKER  
0x4002 WIZARDSLAYER  
0x4003 KENSAI  
0x4004 CAVALIER  
0x4005 INQUISITOR  
0x4006 UNDEADHUNTER  
0x0040 MAGESCHOOL\_ABJURER  
0x0080 MAGESCHOOL\_CONJURER  
0x0100 MAGESCHOOL\_DIVINER  
0x0200 MAGESCHOOL\_ENCHANTER  
0x0400 MAGESCHOOL\_ILLUSIONIST  
0x0800 MAGESCHOOL\_INVOKER  
0x1000 MAGESCHOOL\_NECROMANCER  
0x2000 MAGESCHOOL\_TRANSMUTER  
0x4000 MAGESCHOOL\_GENERALIST  
0x4007 FERALAN  
0x4008 STALKER  
0x4009 BEASTMASTER  
0x400A ASSASIN  
0x400B BOUNTYHUNTER  
0x400C SWASHBUCKLER  
0x400D BLADE  
0x400E JESTER  
0x400F SKALD  
0x4013 GODTALOS  
0x4014 GODHELM  
0x4015 GODLATHANDER  
0x4010 TOTEMIC  
0x4011 SHAPESHIFTER  
0x4012 BEASTFRIEND  
0x40000000 BARBARIAN  
0x80000000 WILDMAGE  
0x4020 Blackguard  
0x4021 SHADOWDANCER  
0x4022 DWARVEN\_DEFENDER  
0x4023 DRAGON\_DISCIPLE  
0x4024 DARK\_MOON  
0x4025 SUN\_SOUL  
0x4027 GRIZZLY\_BEAR  
0x4028 OHTYR  
0x4029 OHTEMPUS

Be careful assigning kits, though. If you want Minsc to be a bezerker, then his base class needs to be changed to fighter. I don’t know what kind of bizarre things might happen if a kit is assigned to a class it’s not meant for. 🙂 But it probably will just fail to work.

---

<div class="post-metadata">

**Author:** ![GESancMan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/gesancman/32/2923_2.png) [@GESancMan](https://boards.straightdope.com/u/GESancMan)\
**Post date:** [January 16, 2020, 12:54am UTC](https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477/9 "2020-01-16T00:54:50Z")

</div>

For a little further clarification, I looked at Jan in Near Infinity. He’s a mage/thief with the illusioninst kit.

0x0400 MAGESCHOOL\_ILLUSIONIST

Looks like the kit is 4 bytes long, starting at 0244, so the hex looks like:

… 04 05 06 07  
00000240 00 00 00 04

It seems that 0244 and 0245 are always 00. Weird that they did it that way.

---

<div class="post-metadata">

**Author:** ![GESancMan](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/gesancman/32/2923_2.png) [@GESancMan](https://boards.straightdope.com/u/GESancMan)\
**Post date:** [January 16, 2020, 1:05am UTC](https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477/10 "2020-01-16T01:05:13Z")

</div>

I just realized something… everything I’ve been saying refers to modifying the NPC’s creature file, but you’re talking about editing your savegame file. Doh!

Ok, so looking at this another way: in a NPC creature file, the class starts at offset 0273, and the kit starts at 0244. So if you’ve located the NPC’s class in your savegame file, you can figure out how far to back up to locate the kit.

---

<div class="post-metadata">

**Author:** ![Damuri\_Ajashi](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@Damuri\_Ajashi](https://boards.straightdope.com/u/Damuri_Ajashi)\
**Post date:** [January 16, 2020, 1:00pm UTC](https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477/11 "2020-01-16T13:00:39Z")

</div>

I’m on an android device.

BTW. I just realized this should probably be in game room.

---

<div class="post-metadata">

**Author:** ![Damuri\_Ajashi](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@Damuri\_Ajashi](https://boards.straightdope.com/u/Damuri_Ajashi)\
**Post date:** [January 16, 2020, 7:14pm UTC](https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477/12 "2020-01-16T19:14:09Z")

</div>

In the slot immediately below Charisma (8 spots later) is the fighter kit address on line 00000458 column 3

00=Basic Fighter  
01=Berserker  
02=Wizard Slayer  
03=Kensai  
04-09 does nothing and defaults to normal fighter

But this is all I need to turn Minsc into a Berserker.

Now I’m gonna try and figure out how to turn Khalid into a Cavalier.

---

<div class="post-metadata">

**Author:** ![Damuri\_Ajashi](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@Damuri\_Ajashi](https://boards.straightdope.com/u/Damuri_Ajashi)\
**Post date:** [January 16, 2020, 7:22pm UTC](https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477/13 "2020-01-16T19:22:05Z")

</div>

04=Cavalier  
05=Inquisitor  
06=Undead Hunter  
20=Blackguard

---

<div class="post-metadata">

**Author:** ![Damuri\_Ajashi](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@Damuri\_Ajashi](https://boards.straightdope.com/u/Damuri_Ajashi)\
**Post date:** [January 16, 2020, 7:47pm UTC](https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477/14 "2020-01-16T19:47:43Z")

</div>

Barbarian requires a 40 in row 00000458 column 2 right below the Constitution stat  
It also requires changing row 00000458 column 4 from 40 to 00

Wild Mage is 80 in that slot with an 01 in the class slot  
40 Abjurer  
80 Conjurer

one slot to the right of that  
01 Diviner  
02 Enchanter  
04 Illusionist  
08 Invoker  
10 Necromancer  
20 Transmuter  
40 generalist

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [January 16, 2020, 8:32pm UTC](https://boards.straightdope.com/t/baldurs-gate-enhanced-edition-hex-editing-codes/846477/15 "2020-01-16T20:32:26Z")

</div>

[Moderating]

Huh, I’d seen this thread before, but I thought it was in the Game Room. Fixing that now.
