powerof3 / PapyrusExtenderSSE

MIT License
62 stars 14 forks source link

AddKeywordToForm causes save corruption when used on Magic Effects #22

Open Pop000100 opened 1 year ago

Pop000100 commented 1 year ago
Spell[] Spells = GetAllSpells()
  if Spells
    if cachedSpells != Spells
        int i = Spells.Length
        while i > 0
            i -= 1
            if Spells[i]
                MagicEffect effect = Spells[i].GetNthEffectMagicEffect(0)
                if effect && effect.GetCastingType() == 0 && !effect.HasKeyword(kwAbility)
                    AddKeywordToForm(effect as Form, kwAbility)
                    ;Debug.Trace("trying to add Keyword to " + Spells[i] + " result: " + Spells[i].HasKeyword(kwAbility) as String)
                endif
            endif
        endwhile
        cachedSpells = Spells
    endif
  endif

If I add a spell modified to my character saving then loading causes them to be cleared from my character. It may matter that I injected the keyword into Update.esm.

Pop000100 commented 1 year ago

I guess i should mention this was in version 5.6.1 for skyrim 1.6.640

phalanx commented 7 months ago

I'm not sure I would call it save corruption, but I would like to second this bug. I have noticed inconsistencies with AddKeywordToForm and RemoveKeywordOnForm when used with MagicEffects. I did not test any other Forms. I have seen keywords added fail to persist in save games, as well as keywords that were added and then later removed in the same session persisting the next time the game was loaded. This was with a pair of new keywords added in my own plugin.