Beamdog / nwn-issues

Neverwinter Nights: Enhanced Edition Technical Bug Tracker
http://nwn.beamdog.com
31 stars 1 forks source link

Regression: Darkness crash #113

Open Shad000w opened 4 years ago

Shad000w commented 4 years ago

To Reproduce

Specifics

If needed, describe the bug

I still don't know all the details. I thought this is related to the npc model, but it doesn't seems so. Fire beetles also doing this. It also won't happen if I delete AI scripts from npc. I only kept single script on those npcs and that is OnCombatRoundEnd one: nw_c2_default3. It also seems to happen only if the npcs have true seeing itemproperty on their claw (possibly any item but untested).

In EE, after you cast darkness on them, they turn visible. Which seems to be the time it crashes, but sometimes it won't immediately. If it won't then it crashes on a removal of the dead npc from area (CNWSCreature::EventHandler nEvent = 11 (thats where my 8186 server was crashing).

crashdump.zip crash dump related to this

niv commented 4 years ago

I cannot repro this according to the steps; however, analysing the crashdump:

This crash seems not related to the sharks, except where they trigger hostility as they come out of Darkness.

Specifically, this crash is happening via DetermineCombatRound/ActionEquipMostDamagingMelee, which unequips the bow and it blows up somewhere inside trying to remove an icon effect.

That's probably a double free somewhere (a double removal), probably related to the itemproperty/effect assiocation cleanup change from years ago. I cannot repro that locally either though!

Are there any custom 2da files, icon effect entries that I am missing, or custom item properties?

(Also the character in this savegame seems to have some custom content (base?)items on the last inventory page that fail to load on my end, but that's probably unrelated.)

    nwmain.exe!CGameEffect::GetInteger(int nStorageLocation) Line 261   C++
    nwmain.exe!CNWSEffectListHandler::OnRemoveEffectIcon(CNWSObject * pObject, CGameEffect * pEffect) Line 8125 C++
    nwmain.exe!CNWSObject::RemoveEffect(CGameEffect * e) Line 4491  C++
    nwmain.exe!CNWSItemPropertyHandler::OnItemPropertyRemoved(CNWSItem * pItem, CNWItemProperty * pItemProperty, CNWSCreature * pCreature, unsigned int nInventorySlot) Line 454    C++
    nwmain.exe!CNWSItem::RemoveItemProperties(CNWSCreature * pCreature, unsigned int nInventorySlot) Line 2310  C++
    nwmain.exe!CNWSCreature::UnequipItem(CNWSItem * pItem, int bUnequipWhilePolymorphed) Line 5083  C++
    nwmain.exe!CNWSCreature::EquipMostDamagingMeleeWeapon(unsigned int oidVersus, int bOffHand, int bEquipGeneralWeapon) Line 17964 C++
>   nwmain.exe!CNWVirtualMachineCommands::ExecuteCommandActionEquipMostDamagingMelee(int nCommandId, int nParameters) Line 22008    C++
    nwmain.exe!CVirtualMachine::ExecuteCode(int * nInstructionPointer, char * pCode, int nCodeSize, CVirtualMachineDebuggingContext * pDebuggingContext) Line 1314  C++
    nwmain.exe!CVirtualMachine::RunScriptFile(int nInstructionPointer) Line 3104    C++
Shad000w commented 4 years ago

damn I missed the last stable NWN shares user folder with my play/test NWN install with old version

you are right, I did not clear override and after some investigation I find the file causing it - itemprops.2da itemprops.zip

This 2da allows some itemproperties to be placed on bow, properties that cannot be placed there in vanilla. And the bow that character is using has such itemproperty on it. Without this 2da, that itemproperty gets stripped when loading game and it won't crash. It looks like it is caused by Vampiric Regeneration +2 property as it was reported on a monk with gloves that had vampiric regeneration as well (unlike bow, it actually works on gloves). Quick test and yeah, monk gloves with vampiric regeneration also crashed it.

There are two weird things however. 1) Why is engine using AI functions on player? the characters don't have altered script events that would run monster AI which might call that 2) Why are npcs with true seeing, hit by darkness of caster who has vampiric regeneration on bow/gloves losing the darkness effect (assumption) or rather why they suddenly can be seen by caster despite they are inside darkness and he has no UV/TS?