Skip to content

Casting an epic spell properly

I'm trying to figure out how to make an AI to cast an epic spell in a way that actually burns the spell feat use and the spell is cast with proper caster level. I'm having trouble with this and here is what I tried so far:
ActionUseFeat(FEAT_EPIC_SPELL_EPIC_WARDING, OBJECT_SELF);
The actor casts the spell but it ends instantly.
// 695 - epic warding spell id
ActionCastSpellAtObject(695, OBJECT_SELF, METAMAGIC_NONE);
The actor does nothing.
ActionCastSpellAtObject(695, OBJECT_SELF, METAMAGIC_NONE, TRUE);
DecrementRemainingFeatUses(OBJECT_SELF, FEAT_EPIC_SPELL_EPIC_WARDING);
The spell is cast but the caster level is wrong because it's cheat-casted.

Is there a way to make an actor use its epic spell (feat) normally?

Comments

  • ForSeriousForSerious Member Posts: 446
    edited October 2021
    Sorry I think no one has answered because you've done it how we would.
    ActionUseFeat should do it correctly. Maybe add a bunch of extra levels to the creature and see if that makes it last longer?

    The only other thing I can think of is make sure the creature has either epic wizard feat or epic sorcerer feat. The Wiki also mentions 15 levels of Pale Master will enable Epic Warding.

    Some more digging in the lexicon says that the caster has to be a creature or PC. Placeables will not do it correctly. That last option you tried should work for placeables. (Says the caster level is automatically calculated with the code
    min(10, (Innate Spell Level * 2) - 1)
    
    though I have no idea how you define Innate Spell Level for the placeable.)
    Post edited by ForSerious on
  • ShadooowShadooow Member Posts: 402
    I just use caster level override from community patch. It allows even modify values of epic spell like damage done or AC given without need to edit the spellscript itself manually.

    Eitherway you can just edit all epic spells scripts and do something like this

    "if npc set caster level to be get hit dice of self"
  • Str8TStr8T Member Posts: 18
    I figured that ActionUseFeat should normally work for epic spells (it works for PCs), but it doesn't work for creates which has been given epic spell feats in the toolset. My guess is it's because feats assigned to the creature in the toolset are not associated with any class and thus caster level cannot be correctly determined - it's 0, I checked. I tried solving this by using NWNX_Creature_AddFeatByLevel from nwnx_creature plugin which should properly allocate feat to a level, but it doesn't seem to work.

    Finally, I ended up modifying spell scripts with code like this and now it works fine:
    int nDuration = GetCasterLevel(OBJECT_SELF);
    
    if(nDuration == 0) {
        nDuration += GetLevelByClass(CLASS_TYPE_WIZARD);
        nDuration += GetLevelByClass(CLASS_TYPE_SORCERER);
        nDuration += GetLevelByClass(CLASS_TYPE_PALE_MASTER);
    }
    
Sign In or Register to comment.