Skip to content

Removing Memorized spells

Is there a function for removing memorized spells of a PC? I've taken a look through the functions and it doesn't seem that there is. I'm trying to remove all memorized spells from a PC so they cannot cast again until they have rested. Any pointers much appreciated.

Comments

  • NeverwinterWightsNeverwinterWights Member Posts: 339
    Probably this one?

    // Decrement the remaining uses per day for this creature by one.
    // - oCreature: creature to modify
    // - nSpell: constant SPELL_*
    void DecrementRemainingSpellUses(object oCreature, int nSpell)

    I haven't used it yet though.
  • ForSeriousForSerious Member Posts: 446
    Some (terrible) initial ideas I have are to set their intelligence/wisdom/charisma to 3 then back. Level drain might be able to get the same result. I know for sure that removing enough XP to make them lose all the levels that give them spells will do it. But even if you give it right back they'd have to level up again.

    I like @NeverwinterWights idea, except for trying to decrement each spell by ID and only by one. Maybe that would be okay if you only have a few spells that you don't want them to be able to use until next rest.
  • vonstormvonstorm Member Posts: 66
    Two excellent solutions, thank you. I have been playing with the following code to get the "washed out weak as a kitten" effect and added casting stats to stop spell casting
    // visual
         effect eVFX;
    
        // Apply a visual effect.
        eVFX = EffectVisualEffect(VFX_FNF_DECK);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);
    
        // Apply some effects.
        eEffect = ExtraordinaryEffect(EffectAbilityDecrease(ABILITY_INTELLIGENCE, 12));
        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oPC, 60.0);
        eEffect = ExtraordinaryEffect(EffectAbilityDecrease(ABILITY_STRENGTH, 12));
        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oPC, 60.0);
        eEffect = ExtraordinaryEffect(EffectAbilityDecrease(ABILITY_WISDOM, 12));
        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oPC, 60.0);
        eEffect = ExtraordinaryEffect(EffectAbilityDecrease(ABILITY_CHARISMA, 12));
        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oPC, 60.0);
    }
    

    If I use DURATION_TYPE_PERMANENT does this reset on rest?
  • ForSeriousForSerious Member Posts: 446
    edited February 2021
    Not sure. It might bug it and make it never come off. I'd just set the time on them to last like an hour: 3600.0. Who's going to wait an hour just to not rest?
  • vonstormvonstorm Member Posts: 66
    good point. Thank you.
  • meaglynmeaglyn Member Posts: 149
    You could block casting with some spell hook code pretty easily. They'd still do the initial casting animation though, I think. But then you could fizzle it.
  • NeverwinterWightsNeverwinterWights Member Posts: 339
    If you wanted to script it you could do something like so:
    //Remove all spells
    void main()
    {
        //0 to 698? Need to further narrow down spells. This does not include epic spells.
        object oPC = GetLastUsedBy();//Define PC. I just used a test placeable
        if (!GetIsPC(oPC)) return;
        int iCheck;
        int iSpell = 0;
    
        while (iSpell <= 698)
        {
            iCheck = GetHasSpell(iSpell, oPC);
            if (iCheck)
            {
                SendMessageToPC(oPC, "You have spell #" + IntToString(iSpell));
                while (iCheck)
                {
                    DecrementRemainingSpellUses(oPC, iSpell);
                    iCheck--;
                }
            }
            iSpell++;
        }
    }
    

    Quick tested. Removes most spells. Not epic though. Need to nail down the spell numbers a bit. I just grabbed a range from "nwscript".
Sign In or Register to comment.