[BUG] 187562, the case of the broken effects index

+
Hi, you may want to have a look at this. This bug still exists, and was not fixed in the latest patch:
In fact, hundreds of lines of unnecessarily redundant code were written to hack around this issue.

CheckInteractionWith() fills overridenEffectsIdxs[] backwards to forwards:
for(i=size-1; i>=0; i-=1)
Then, ApplyEffect() reads them backwards to forwards:
for ( i=size-1; i>=0; i-=1 )
So, if overridenEffectsIdxs[] was 10, 7, 3.... it reads them backwards as 3, 7, 10, then removes index 3 and fails on 7:
RemoveEffectOnIndex(overridenEffectsIdxs, true);
This is due to the effects array being modified, when an item is removed, changing the remaining index values.

The effect is that only a single effect (in case of 2), incorrect effects, or incorrect number of effects are removed.

For the official record, swapping the ApplyEffect() 'for' statement to read overridenEffectsIdxs[] forwards resolved it.


I also rewrote the entire CheckInteractionWith() function, if you check my mod files. I'll upload an update shortly.

In fact, I had to rewrite quite a bit of code, to finally get effect interactions to function correctly, including the enum:

enum EEffectInteract
{
EI_Undefined,
EI_Deny,
EI_Override,
/**** princessmassacre ****/
EI_Cancel,
EI_Pass, //new effect passes interaction (it can be overriden, passed or cumulated based on the other effect's preference)
EI_Cumulate //some old effect will cumulate with this effect (old one will be changed, new will not be applied)
}


Checks interaction between effects
Interaction matrix:

|-|D|O|P| <- old
|D|D|D|D|

|O|D|O|O| <- new
|P|D|D|P|

Original post (Jan 4, 2023): https://forums.cdprojektred.com/ind...extgen-version.11111278/page-11#post-13556701

Well, the mod is completely ported to patch v4.04, except the azerty and and qwertz keyboard layouts, but need to clean a few bits of code up. The only "bug" I can't seem to work around is a Toussaint Gwent tournament Dwarves fist fight, since I lost my saved games, won't happen any time soon.

It’s better to report issues like that via the support website:

I already fixed and reported the bug, a long time ago, in the official patch thread. The updated mod will be uploaded in the following days.
 
Last edited:
Top Bottom