Jump to content

BG2:ToB - A few notes concerning some STATS.IDS entries


Recommended Posts

Firstly, it appears that the MORALEBREAK stat can be used as a resist fear check. If a character's morale break is set to 1 or 0 than he is most likely immune to fear. In the unmodded game, this will detect characters under Resist/Remove Fear, all Cavaliers by default (since their morale break is permanently set to 0) and Barbarians under Rage, but oddly not Berserkers under Enrage (since Enrage doesn't set the morale break parameter). Unfortunately, most items which grant immunity to fear don't seem to set the morale break parameter in unmodded BG2 either.


	DisplayStringHead(Myself,10953) // Resist Fear



Next, the VISUALRANGE stat predictably represents the visual range (i.e. the field of vision which clears the fog of war) of a character. The default value is 14, and the Blindness effect reduces it to 2.


	DisplayStringHead(Myself,1474) // Blinded


And finally, the KIT stat can be used to detect kits, regardless of the broken KIT.IDS which shipped with the original game. On the first glance, the kit numbers appear to be semi random.


	DisplayStringHead(Myself,25151) // Berserker



Ok, that was fairly straightforward, but now look at these entries:



0 = Trueclass (no kit)
1 = Berserker
128 = Conjurer
16387 = Kensai
16388 = Cavalier
16389 = Inquisitor
16390 = Undead Hunter
16391 = Archer
16392 = Stalker
16393 = Beastmaster
16394 = Assassin
16395 = Bounty Hunter
16396 = Swashbuckler
16396 = Swashbuckler
16398 = Jester
16399 = Skald
2097152 = Blade
9663676416 = Barbarian


I discovered these via trial and error by using CheckStatGT(Myself,x,KIT) and CheckStatLT(Myself,y,KIT) and finally CheckStat(Myself,n,KIT) for confirmation on a few kitted characters. I can't make any sense of the results but I should be noted that they work equally well in the unmodded game (with the broken KIT.IDS) and with the fixed KIT.IDS from the G3 BG2 Fixpack. I could probably get the rest of the kit numbers via trial and error eventually, but that's highly time consuming, and I'd rather figure out whether it's possible to somehow calculate these numbers based on KIT.IDS entries or something. Any ideas?

Link to comment
16385 should be Berserker too.


Nope, as mentioned above, I got the values by using CheckStatGT(Myself,x,KIT) and CheckStatLT(Myself,y,KIT) as limiters which helped me narrow down my search, and during my experiments, CheckStatGT(Myself,1,KIT) never returned true for Berserkers. I just tested it on Korgan to double check and, as expected, it doesn't work.


EDIT - It appears that you were right after all: a PC Berserker returns true for CheckStat(Myself,16385,KIT) while Korgan returns true for CheckStat(Myself,1,KIT). Bah, apparently this stat is not that useful after all since the target's race has to be taken into account as well. EDIT2 <- Character race does not affect it after all, see my namesake's explanation a few posts below.

Link to comment

Assuming it's just the value of the kit field, you may have been hit with the "old-style" vs. "new-style" kit IDs.


The first will only check hardcoded morale failure; it can be assumed they're immune to panic, but it's not absolute (they require separate immunity effects).


Visual range doesn't seem useful... STATE_BLIND should work fine, no?

Link to comment
The first will only check hardcoded morale failure; it can be assumed they're immune to panic, but it's not absolute (they require separate immunity effects).


Yeah, but since all BG2 Resist Fear type spells and innate abilities set MORALEBREAK, I figured it's pretty safe to use. :help:


Visual range doesn't seem useful... STATE_BLIND should work fine, no?


Yup, STATE_BLIND is sufficient enough in most cases, I just noticed that VISUALRANGE can be used for this purpose as well and I thought I'd mention it. BTW, I think you can modify the visual range (and maybe even expand it?) with effect #262.

Link to comment

Yes, kits could have 2 different values.

One is a bitfield value.

1 - berserker

2 - wizardslayer

4 - kensai

8 - cavalier


The other is a 0x40XX value. Where XX is the row in kitlist.


etc. (These bitfields are overlapped by the mage schools).


Korgan's kit value is set to 1, instead of 0x4001.

So, this isn't a race thing.

Link to comment

MORALEBREAK: It's safe on PCs, but lots of NPCs will have natural 0s or 1s (all the demons please stand up!). But in almost all cases, they'll be immune to panic too, and it obviates the need to use the old, broken detectable spells or to wait for a new revision.


KIT: The engine uses 0x40xx, but BioWare's toolset mostly use the bit field, so it can't be guaranteed that PCs other than Player1 have the same value (although, the fixpack "corrects" the kit values of all PC CREs to be usable with Kit.ids). But you can always just OR() it (like Avenger says, it will only ever be one of two possible, known values).


VISUALRANGE: There's a cheat key to toggle the visual range between 3 or 4 possible values (IIRC, something like DOUBLE, NORMAL, HALF, BLIND); I'd guess the effect does the same, yeah (if it works at all).

Link to comment

Is it possible to discover what some of the more obscure stats do in the unmodded game without running a zillion trial and error tests? Specifically, I was wondering about the following:




For the record, it appears that the various berserk checks don't retur true on any kind of in-game berserk ability (Minsc, Berserker, Barbarian Rage, Berserking Sword).

Link to comment
' date='Dec 14 2007, 09:33 PM' post='107946']

Firstly, it appears that the MORALEBREAK stat can be used as a resist fear check. If a character's morale break is set to 1 or 0 than he is most likely immune to fear.


Just a minor addition here. Apparently, the Protagonist (Player1) has his MORALEBREAK permanently set to 0 within the CRE regardless of his class, while joinable NPCs (party members) don't. Weird...

Link to comment

The protagonist doesn't suffer morale failure (like demons and devils, he's auto-immune).


All the stats you listed are used by various effects. Probably no point in ever checking them. SCRIPTINGSTATEs are the open stat values you can use (via the modify scripting state effect). The rest of the values up to 201 are used by various other effects, although STATS.IDS wasn't updated with them.

Link to comment

hm, it would be cool to have outdoor daytime visual range greater. But making the check occur without bogging down the engine might be an interesting project.


^E seems to have 24 steps between the minimum and maximum, but only the inner 12 steps do anything (limit fog of war clearing).


Oddly, the ^E does not change the VisualRange Stat, and, in fact, selecting a weapon resets any ^E change.


Doing a check script, I find that 24 is the maximum visual range that can be set - that is, using 262 inc 1 when you already have visualrange 24 does not set visualrange 25.


Extended Visual Range does not clear extra fog of war, but does allow ranged attacks at the extended range, if you have some way to clear the fog of war there.


So, yes, I could now set up a set up scripts that would limit visual range when it's dark and/or extend the visual range to 24 for outside daytime, which would at least help parties with ranged attacks, and some spells.


Well, having implemented this (6 indoors, 12 outdoor at night, 24 day outside), the 24 Visual Range is interesting - if you scout out that far, you can still See anything in an area that isn't black; but your Fog of War limits your contact distance. Definitely a cool thing to have for parties.


my current implementation is via DPlayer scripts, which needs work; theoretically, it should be as the Default script, or perhaps in the Baldur.bcs, or some other script that doesn't turn off with the player's AI toggle.

Link to comment
Not actually true, I have had it happen in a solo game. But it's very rare.
I've never seen it happen, but it's possible you got hit with a morale break modifier (a very few spells and items may increment morale break, causing instant morale failure).


In any case, it's effective immunity (the morale is still there, it's just not something you'll normally be able to fail).

Link to comment

While working with the Player AI scripts for IWD2, I was trying to iron out a noticeable lag before the AI would cause the party to attack sighted enemies.


I thought the cause might be related the visual range settings, so I included some code to reset the VisualRange for the party.


Imagine my suprise when every goblin in town made a b-line straight for my party. :help:


So it seems that, at least in the IWD2 version of the engine, the VisualRange setting effects all the creatures on the map.

Link to comment


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

  • Create New...