Jump to content

BG2 starting Bhaal innates and bgmain.exe


Recommended Posts

At the start of BG2, the protagonist gets a semi-random selection of Bhaal innates. The complete selection of innates are stored as strrefs starting at offset 0x757ec8 (ToB v26498). The complete mapping is as follows:


0x757ec8 - evil1 (SPIN104)

0x757ed8 - good1 (SPIN101)

0x757ee8 - evil2 (SPIN105)

0x757ef8 - good2 (SPIN102)

0x757f08 - evil3 (SPIN106)

0x757f18 - good3 (SPIN103)


I have not checked different versions of the executable, nor do I know how Bhaal innates are assigned. But changing the strref at one of the above offsets results in a corresponding change of received Bhaal innate at the start of BG2 (e.g. if you replace SPIN101 with a custom innate, all alignments which previously got SPIN101 now receive the custom innate instead).


Abstart.2da does not appear to anything to do with this process. The selection of Bhaal powers you receive frequently differs from that outlined in abstart.2da. Changing the exe without changing abstart.2da results in a complete replacement of the innate and changing abstart.2da without changing the exe results in no difference in received Bhaal innates.

Link to comment

The interesting thing was that criteria appear to be different from creating a character for Chapter 1 and for the tutorial. I don't believe it's random (there's some definite rule as far as I'm aware); at least, I've never been able to create a character with abilities different from what I expect.

Link to comment
They are assigned based upon your alignment, shown by 3 options for each. Testing and observation show this.




Shown where? In abstart.2da?


Placing a blank (à la Tutu's copy) abstart.2da in the override has no noticeable effect on which innates you get.


Personally, I'm inclined to think it's handled somewhere in the exe and that it is random to some extent (but maybe I'm just seeing hardcoded shadows). E.g. every LG I've created have received all 6 good powers and every CE have received all 6 evil powers, but as you approach TN, the probability of receiving 3 each of good and evil innates appears to increase.

I just created two CN (one in the regular game and one in the tutorial). The regular one got 1 SPIN101, 1 SPIN104, 2 SPIN105 and 2 SPIN103 whereas the tutorial one got 2 SPIN101, 1 SPIN102, 1 SPIN105 1 SPIN103 and 1 SPIN106. Just to be tedious; neither selection matches that of CN in abstart.2da.

I realise this makes me sound like an idiot. If there is a difference between the regular game and the tutorial, it obviously does not do much good to show that there is a difference between the two. The point I was failing to illustrate is that you (or I, at least) receive different innates with two characters created in e.g. the regular game as well.

Three more CNs created within the regular game give the following innates


First one:

2x SPIN101


















If that's not random, I for one do not fancy figuring out the underlying rationale.


Sorry for sounding contentious, it really was not my intention.

Link to comment
Shown where? In abstart.2da?
As you noted, the 2DA is unused and the selection is hardcoded (ABSTART is just leftover crud). It's just generally known that SPIN101-106 are the innates (from BG/TotSC) that you can start with.


Based on your tests, it looks like at least some of the options are assigned randomly, possibly with some exceptions (what those exceptions are, other than the tutorial having a more static assignment and the polar two having 2x2x2, I don't know). I've likely never paid close enough attention to the Bhaal powers to have made the assertion that they're not random; I do that sometimes and just wait to be proven wrong. ;-)


It'd be interesting to check if the tutorial assignments are random at all (if your CN ever gets anything but 2x1x1x1x1).

Link to comment

Yes, it's like this:

align = get_alignment()
prob = prob_array[align]  // defined like mentioned above
for i = 1 to 2:
r = rand()	 // 0..99
if (r >= prob):
	add_spell(spin101, 1)
	add_spell(spin104, 1)

// same loop for spin102/105 and spin103/106

I'm not really sure on the interval for the random number, but this seemed logical.

Link to comment

Yes, this would be roughly consistent with my findings as well.

Though I don't think the probabilities for NG/NE and LG/LE are as extreme as 10/90 and 20/80* and I think the probabilities decrease for each "level". E.g. an evil character seems to get SPIN103 more rarely than SPIN102 or SPIN101.


*At least not for SPIN101/104 and SPIN102/105; tying into what I wrote next. 10/90 and 20/80 may well be true for getting SPIN103/106.

Link to comment


This topic is now archived and is closed to further replies.

  • Create New...