Clangeddin's Collection bug found


#1

The Mod_Fixes portion of the Clangeddin’s Collection is bugged. The clangfix_equip script is NOT actually being fired by the x2_mod_def_equ and x2_mod_def_unequ scripts provided by the fix. A “concealed” icon also incorrectly shows next to your character in the party bar if you equip a shield.

Upon troubleshooting this in the toolset, I discovered that the x2_mod_def_equ and x2_mod_def_unequ scripts in the Mod_Fixes folder simply needed to be recompiled. After applying the fixed scripts, the clangfix_equip script is now working as advertised. Additionally, the sneak attack immunity icon now properly shows.

Note: This fix is savegame compatible. However, BEFORE applying this fix, load your savegame and unequip all shields. Then make a new save. Failing to do this will cause the “concealed” icon to permanently show next to your character in the party bar.

Needs confirmation.


#2

I can confirm you findings except that if I recompile everything, the concealed icon won’t show even if I have shields on characters.


#3

That’s good. The concealed icon isn’t supposed to show just because you have a shield equipped.


#4

A small fix of mine for Clangeddin’s Rebuild:
https://drive.google.com/open?id=1DVfIdcNvycYkbfEpmj4F82kQk99FlEYT

The player character doesn’t lose history feats anymore after performing the full or partial rebuild (history feats are feats that the player character picks up as he or she progresses through the campaign). Changes are made to the FinalizeRebuild() and PartialRebuild() functions in gui_clang_rebuild.nss.

	// Aqvilinus: Create the list of history feats before changing the level.
	int nFEATROWS = GetNum2DARows("feat");
	int nFEAT;
	string sHISTORYFEATS;
	for (nFEAT = 0; nFEAT <= nFEATROWS; nFEAT++)
	{
		if (Get2DAString("feat","REMOVED",nFEAT) == "0"
		 && Get2DAString("feat","FeatCategory",nFEAT) == "HISTORY_FT_CAT")
		{
			if (GetHasFeat(nFEAT, oPC, TRUE))
			{
				if (sHISTORYFEATS != "") sHISTORYFEATS += ",";
				sHISTORYFEATS += IntToString(nFEAT);
			}
		}
	}
	SetXP(oPC, 0);
	....

	// Aqvilinus: Give the history feats back to the PC.
	SetXP(oPC, nXP);
	int nNUMTOKENS = GetNumberTokens(sHISTORYFEATS, ",");
	int i;
	for (i = 0; i < nNUMTOKENS; i++)
	{
		nFEAT = StringToInt(GetTokenByPosition(sHISTORYFEATS, ",", i));

		if (!GetHasFeat(nFEAT, oPC, TRUE))
			FeatAdd(oPC, nFEAT, FALSE, FALSE, FALSE);
	}

#5

Thanks for pointing this out.
The concealment icon from shields is caused by a wrong version of the .ncs file I uploaded, where shields give concealment against ranged attacks, it was meant for another mod I never finished (or for sigil city of doors servers, where shields give ranged attack concealment), but I guess I just uploaded the wrong file.
Just recompiling it should fix the issue.

I will eventually upload a 1.1 version with the fix + some other stuff.


#9

1.1 version has been uploaded, both issues should have been fixed.


#10

Found another bug (v1.1)…

When I have multiple items giving me a damage immunity equaling more that 100%, the immunity is cancelled (i.e. no immunity).

The problem was residing in the “clangfix_equip” script.

I changed this portion of the script…

void FixIMM(object oPC)
{
	object oEQUIP;
	effect eFX;
	int nEQUIP;
	int nITEM;
	int nTOTAL;
	int nELEMENT = 1; //DAMAGE_TYPE_BLUDGEON is 1, the first of the valid damage types.
	while (nELEMENT < 2050) //DAMAGE_TYPE_SONIC is 2048 and they progress as power of 2.
	{
		nEQUIP = 0;
		nTOTAL = 0;
		while (nEQUIP < 18)
		{
			oEQUIP = GetItemInSlot(nEQUIP, oPC);	
			nTOTAL = nTOTAL + GetLocalInt(oEQUIP, "CLANGFIX_ELEMENT_" + IntToString(nELEMENT));
			nEQUIP = nEQUIP + 1;
		}
		if (nTOTAL > 99) eFX = EffectLinkEffects(eFX, EffectDamageResistance(nELEMENT, 9999));
		else if (nTOTAL > 0) eFX = EffectLinkEffects(eFX, EffectDamageImmunityIncrease(nELEMENT, nTOTAL));
		else if (nTOTAL < 0) eFX = EffectLinkEffects(eFX, EffectDamageImmunityDecrease(nELEMENT, -nTOTAL));
		nELEMENT = nELEMENT * 2;
	}
	ApplyEffectToObjectFaster(oPC, eFX, -1.0, SUBTYPE_SUPERNATURAL, CLANG_FXEQUIP);
} 

To this…

void FixIMM(object oPC)
{
	object oEQUIP;
	effect eFX;
	int nEQUIP;
	int nITEM;
	int nTOTAL;
	int nELEMENT = 1; //DAMAGE_TYPE_BLUDGEON is 1, the first of the valid damage types.
	while (nELEMENT < 2050) //DAMAGE_TYPE_SONIC is 2048 and they progress as power of 2.
	{
		nEQUIP = 0;
		nTOTAL = 0;
		while (nEQUIP < 18)
		{
			oEQUIP = GetItemInSlot(nEQUIP, oPC);	
			nTOTAL = nTOTAL + GetLocalInt(oEQUIP, "CLANGFIX_ELEMENT_" + IntToString(nELEMENT));
			nEQUIP = nEQUIP + 1;
		}
		if (nTOTAL > 0) eFX = EffectLinkEffects(eFX, EffectDamageImmunityIncrease(nELEMENT, nTOTAL));
		else if (nTOTAL < 0) eFX = EffectLinkEffects(eFX, EffectDamageImmunityDecrease(nELEMENT, -nTOTAL));
		nELEMENT = nELEMENT * 2;
	}
	ApplyEffectToObjectFaster(oPC, eFX, -1.0, SUBTYPE_SUPERNATURAL, CLANG_FXEQUIP);
}

EffectDamageResistance was causing the issue. So I removed it and just used the EffectDamageImmunityIncrease, which appears to cap at 100%, which is what we want.

Needs confirmation.

FYI - EffectDamageImmunityDecrease appears to cap at -100%. This is used for Damage Vulnerability.

On a side note - If you have both Damage Immunity and Damage Reduction, the immunity percentage is taken into account first. I wasn’t sure if that was the case. But while testing this, it was indeed.


#11

@travus
The EffectDamageImmunityIncrease function is bugged and if a creature has more than 100% immunity to a specific damage type, it actually turns into a vulnerability. For this reason when nTotal reaches 100 you have to use EffectDamageResistance(DAMAGE_TYPE_*, 9999, 0).


#12

I don’t know what to tell ya. Here’s my data based on a constant damage of 10 from a bludgeoning source and another from an acid source:

WITHOUT Clangeddin’s Collection
50% bludgeon immunity - PASS - blocked 5, took 5
100% bludgeon immunity - PASS - blocked 10
150% bludgeon immunity - FAIL! - took 20!
50% acid immunity - PASS - blocked 5, took 5
100% acid immunity - PASS - blocked 10
150% acid immunity - FAIL! - took 20!

WITH Clangeddin’s Collection
50% bludgeon immunity - PASS - blocked 5, took 5
100% bludgeon immunity - FAIL! - blocked 10, took 10!
150% bludgeon immunity - FAIL! - blocked 10, took 10!
50% acid immunity - PASS - blocked 5, took 5
100% acid immunity - PASS - blocked 10
150% acid immunity - PASS - blocked 10

WITH Clangeddin’s Collection AND edits by Travus
50% bludgeon immunity - PASS - blocked 5, took 5
100% bludgeon immunity - PASS - blocked 10
150% bludgeon immunity - PASS - blocked 10
50% acid immunity - PASS - blocked 5, took 5
100% acid immunity - PASS - blocked 10
150% acid immunity - PASS - blocked 10

Anybody else get the same data?

Update:
In-case anyone is curious, I did do the same test with Vulnerabilities (bludgeon and acid).
WITHOUT Clangeddin’s Collection installed, any vulnerability over 100% turns into an immunity (100%).
WITH Clangeddin’s Collection installed, everything passed in all cases.
Note that you’ll never take more than 100% extra damage from a vulnerability, even if it’s greater than 100%.


#13

The Damage resistance function does not work for physical damage types, that bug is on Obsidian’s shoulders, not mine. This fix was mostly intended for the elemental immunities, which have a much higher likelyhood to surpass 100% from items rather than the physical one. In fact I dont even think it’s possible to hit 100% immunities on physical from equipment from standard (OC+MOTB+SOZ) gear.

I too, was under the impression that the EffectDamageImmunityIncrease function was bugged (I actually never bothered to check it, I just read it on a thread somewhere), and beyond 100% you had to use resitance instead of immunities, so I don’t know what to say about this either.

Anyways you might wanna add this line above the first if check, -just in case -something goes wrong for someone with values over 100…

if (nTOTAL > 100) nTOTAL = 100;

alternatively, there could be a separate check for physical immunities while retaining the damage resistance for elemental ones, though at that point it seem too convoluted for something that will likely happen in a testing session or a poorly balanced custom module.


#14

They probably got it fixed in the 1.23 patch or this bug might be related to other things. I guess it’s the latter since that patch was released in 2009, but Kaedrin made this change in 2010:

http://nwn2customcontent.wikidot.com/forum/t-235531/1-40-1-progress

All spells that use EffectDamageImmunityIncrease with an immunity amount of 100% will be changed to use a damage resistance of 9999.

And yes, don’t use the damage resistance with physical damage since it’s bugged (as it was said above).