I tried to be detailed below, so that it’s easy to confirm what I am seeing. But, the short version is that I am seeing incorrect GetEffectCasterLevel()
results for spell effects cast using an item (a scroll). Curious if anyone else is seeing this.
Playing with some effect stuff, I did a little test where I modified Cat’s Grace (NW_S0_CatGrace
) so that the last line of the impact script is
PrintString("nw_s0_catsgrace: GetCasterLevel()="+IntToString(GetCasterLevel(OBJECT_SELF))+", GetEffectLinkId()="+GetEffectLinkId(eLink));
Then, I set up a short script in the in-game debug console (with implicit main):
object oCreature = OBJECT_SELF;
effect eEff = GetFirstEffect(oCreature);
string sLinkID, sSpellName;
int nSpellID, nCasterLevel;
while ( GetIsEffectValid(eEff) )
{
sLinkID = GetEffectLinkId(eEff);
nSpellID = GetEffectSpellId(eEff);
sSpellName = GetStringByStrRef(StringToInt(Get2DAString("spells", "Name", nSpellID)));
nCasterLevel = GetEffectCasterLevel(eEff);
PrintString("checking for spell "+sSpellName+" ("+IntToString(nSpellID)+"): nCasterLevel="+IntToString(nCasterLevel)+", LinkID="+sLinkID);
eEff = GetNextEffect(oCreature);
}
I picked an NPC as OBJECT_SELF and then used a Cat’s Grace scroll (caster level 3) on that NPC. Then I ran the console script. Here’s what was in my log.
nw_s0_catsgrace: GetCasterLevel()=3, GetEffectLinkId()=1e00f
[CHAT WINDOW TEXT] [Mon Sep 18 00:19:02] Arba Styl uses Cat's Grace
[CHAT WINDOW TEXT] [Mon Sep 18 00:19:03] Lost Item: Cat's Grace
checking for spell Cat's Grace (13): nCasterLevel=10, LinkID=1e00f
checking for spell Cat's Grace (13): nCasterLevel=10, LinkID=1e00f
[CHAT WINDOW TEXT] [Mon Sep 18 00:19:16] [RunScriptChunk:2296,Valid] OK
As you can see, the spell script correctly reported the caster level as 3. But, GetEffectCasterLevel()
reported it as 10. And, I waited out the spell and it expired in 6 minutes, so it was at caster level 3.
So, the question is: What am I missing here? Am I using GetEffectCasterLevel()
incorrectly? Is it broken? The lexicon notes that this (new to EE) function is used internally in the dispel effect functions. But, it seems likely someone would have noticed if dispelling weren’t working properly.
BTW, it’s maybe noteworthy that, when I have my PC (a wizard) actually cast the spell (rather than use an item), the caster level is reported correctly. As dumb as it sounds, it almost seems like GetEffectCasterLevel()
is using GetEffectCreator()
and then getting that creator’s caster level, which would give this odd result.