GetEffectCasterLevel as it is currently is almost useless
Shadooow
Member Posts: 402
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
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
1
Comments
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.
I cannot overstate how much I would like to have a function along these lines.
Thanks Shadooow for bringing this up.
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
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.
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.