Jump to content

0xa4 Remove Intoxication


Recommended Posts

Ok, anyone wondering why 0xa4 doesn't work, the explanation is the same as for 0x2 Awaken.

This effect tries to remove ITSELF, not the real drunkenness opcode.


Wow, the QA must have rocked. A fix is possible by replacing 2 bytes in the .exe


0x12EB0E (0xa4->0x5e)

0x12EB49 (0xa4->0x5e)

Link to comment

Are you sure this isn't just redundant "make sure we're never attached to the CRE" code? Both of the effects you've noted so far have been single-shot (they run and get purged), so I'm wondering if you're just looking at their intended cleanup.


Intoxication is always a direct stat modifier (never attached), so there wouldn't have been any point in removing the effect?

Link to comment

No, single shot is ensured by writing 1 into the 0x110 offset of the effect.

It would go away without this 'purge code'.


For example the 'calm' effect is exactly the same as the 'wake' effect, except that 'calm' removes 'berserk', while 'wake' removes 'wake'.


I'm pretty sure this is simple cut&paste error which slipped QA.


The 0xa4 effect only works because the engine modifies the base stat, and 0xa4 correctly fixes that.


I'll look at the intoxication effect too, because last time i seen it (tried to make intoxicating items), it causes a crash, and i think it is never used in the official game.

Link to comment

Seeing as how remove intoxication doesn't even modify the stat (?), I'm not sure what the point of making it work would be (there's no reason to try and attach the effect, so it'll still end up doing nothing).


Correct that I use Mode 1; I probably never checked 9, but I'd be truly surprised if it crashes as you say (rather than just not working or not getting attached). (I guess it could since the engine has to track the decay and may not like a perpetual modifier, but it'd still be a surprise.)


Awaken is never used in the default game, so it doesn't matter, and detox has the limitation of not touching the main avenue for intoxication (the stat value), so I don't think they would have even cared about fixing any possible bugs.

Link to comment

It modifies the non permanent stat:


0052EADB 89 4D F4			 mov		 dword ptr [ebp-0Ch],ecx
0052EADE 8B 45 08			 mov		 eax,dword ptr [ebp+8]
0052EAE1 66 C7 80 4A 0B 00 00 mov		 word ptr [eax+0B4Ah],0


If it doesn't remove intoxication, then it is because it should modify the base stat, which is (0xb4a-->0x45A)


Originally, cure poison was intended to fix intoxicated conditions, so this is used in the original game, just doesn't work.

If it would remove the real intoxication effect, and would modify the base stat, it would fix cure poison to cure intoxication :(

So yeah, we can call it crappy, but fixable.


You are right in that there is no existing usage of an attached intoxication effect, because the game automagically handles the base stat.


I don't know where the crash happened it was years ago, i just still remember some trouble about the 0x5e effect. I will check today.





Ahh, and i forgot to tell: iwd2 does this correctly, it removes 0x5e instead 0f 0xa4, and modifies the base stat ;)




You are only partially right about the stat stuff and perpetual modifications.

The engine contains different implementations for this. For example:

1. stone skins has 2 stats (golem stone skin and normal), both of them are maintained by attached effects, even though those effects need to be administrated on every hit.

2. mirror image is even more screwed, it has no stat at all! I didn't even find any memory variable outside of the effect. It keeps track of the image numbers in the mirrorimagerun effect. (Bleah)

3. fatigue seems to have attached effects sometimes, though it is handled by the core engine as well. I expected it to work much like intoxication.

Link to comment

As far as "stat" goes, I'm more referring to the CRE value than in-memory stats tracking.


Stoneskin makes sense (stat for detection, but it needs an effect for dispel/magic attack removal).


Mirror Image doubly so for dispelling invisibility and illusions (although, yeah, it probably would have been nice to have a num_of_images stat value).


I don't think there's a single-shot cure fatigue, so I don't think it matters how it's handled (although that it would ever be attached surprises me, unless you're referring to a delayed fatigue mod effect like with Haste).

Link to comment

Haste and Restoration both cause fatigue.

But i don't know if any official code uses non-permanent fatigue.


Still my original argument stands, 0xa4 doesn't work, though a lot of cure spells use it. And it doesn't work because the original coding is wrong.

It doesn't removes attached effects (which as you point out isn't necessary), but it doesn't set the base value to 0 either. It sets the modified value to 0, which is useless if you don't remove the attached effect AND don't set the base value too.

It is also a single shot effect (sets 0x110 to 1), so it doesn't need to remove itself.

Link to comment

Dunno, why else they put 0xa4 in there :(

0xa4 is called remove intoxication in the source, 0xa4 removes intoxication after my patches.


It could be that some rogue programmer wrote 0xa4, and sneaked it in into all of the healing spells, then the ever vigilant QA noticed that healing spells shouldn't cure intoxication, and they fixed it by simply inactivating the effect.

Yeah, anything is possible: BioWare.


But they also shipped 0xa4 to BlackIsle to be able to cure intoxication, so i'm now puzzled. Luckily, BlackIsle won't ask for a refund.

Link to comment


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

  • Create New...