Skip to content

GetEffectCasterLevel as it is currently is almost useless

It is nice we got a bunch of new scripting commands for effects and itemproperties, but some of them have very limited usage at least without adding new functions.

This is a case of GetEffectCasterLevel.

We could already read effect's caster level using GetCasterLevel(GetEffectCreator()). Since SetEffectCasterLevel function wasn't added, the caster level will always match to the value returned by this workaround.

The only situation where this function is useful is when the creator is no longer valid (dead monster, logged out pc).

What we need is SetEffectCasterLevel or even better - as this function would be a bit problematic to use actually a direct way to modify caster level.

eg. SetCreatureCasterLevel - function which will set caster level for current spellscript to desired value. This would then handle:
- caster level in spell duration/damage
- caster level in dispell checks
- caster level inside ResistSpell command

Comments

  • highv_priesthighv_priest Member Posts: 50
    GetEffectCasterLevel is used in a lot of homebrew dispel overhauls to standard dispel(including my own). Where you can't use that workaround if they have item buffs and caster buffs and you want dispel to function differently for certain spells based on equipment. However I agree that just giving us a function or a local integer where we can set what caster is before the first call of GetCasterLevel would go a long way and be easy.

    Something like SetCurrentSpellLevel(int nlvl); where the function just modifies what is returned by GetCasterLevel and spell resistance checks. The function could be used in the normal spellhook and allow us dynamic casting with very little difficulty for everyone involved.
  • TerrorbleTerrorble Member Posts: 179
    I've struggled with not having a function to set caster level for purposes of beating spell resistance and having buffs resist dispel checks - forever. I have an overly complicated alternative GetCasterLevel() in which I add casting levels from other classes; still, it does not account for either of those two things.

    I cannot overstate how much I would like to have a function along these lines.

    Thanks Shadooow for bringing this up.
  • ShadooowShadooow Member Posts: 402
    Terrorble said:

    I've struggled with not having a function to set caster level for purposes of beating spell resistance and having buffs resist dispel checks - forever. I have an overly complicated alternative GetCasterLevel() in which I add casting levels from other classes; still, it does not account for either of those two things.

    I cannot overstate how much I would like to have a function along these lines.

    Thanks Shadooow for bringing this up.

    Exactly. My community patch does this too and has same limitations. I made a nwnx and nwncx plugin for 1.69 that made it work properly but it would be much better to have this kind of functionality in base game.

    btw it is possible to handle both issues with workarounds it is just not clean at all

    SR issue:
    Temporarily apply SR decrease or SR increase effect on target to force correct roll - clean (you can see this in my unofficial patch) but doen't work against monks, if one wanted to make it work against monsk, he would have to redo and replace monk SR feat and grant SR as effecct/itempoperty on skin

    Dispell issue:
    rescript dispells from scratch, but since the GetEffectCasterLevel will only return base value and not your changed caster level it would require to do two things:
    1) store caster level value in local variable based on spell ie "SPELL_X_CL"
    2) remove the buff overlapping and make each spell be present only once on target - this is serious limitation to the normal way of how spells works but without this rescript dispel with modifications into caster level is not possible - also I've seen this workaround on multiple PWs, HG for example, it is also inside PRC but I wouldn't use this myself
  • FreshLemonBunFreshLemonBun Member Posts: 909
    The issue with SR is that you have to manually replace the SR functions to be able to do anything useful with them at all. Even the D&D rules have certain specific types of SR such as SR vs mind affecting or SR vs alignment differences which you can't do cleanly without fully replacing the mechanic.

    I'm interested to see if I can bundle info like custom caster level into the effect tagging but I haven't tried it yet.
  • ShadooowShadooow Member Posts: 402

    I'm interested to see if I can bundle info like custom caster level into the effect tagging but I haven't tried it yet.

    Actually yes, but same as SetEffectCasterLevel (if existed) it is a bit problematic to use.

    You will need to manually modify every spellscript and there is not an option of just making a mass replace. You will have to edit effect link in each spell and add an effecttag here. Thats why the function SetCreatureCasterLevel/SetCurrentSpellLevel would still be preffered.
Sign In or Register to comment.