ShaDoOoW wrote...
WhiZard wrote...
(SignalEvent() can fix a bug in AoE handler scripts (on-enter, on-heartbeat, and on-exit) that by default make ResistSpell() an automatic failure).
can anyone comfirm this? I tried it and it did work without SignalEvent correctly.
I am cutting the amount you quoted me down to the parenthetical that is being challenged. I apologize for the slow response (ShaDoOoW had PMed me on this before), but quirky behavior often causes a lot of test cases before I am willing to respond, especially when the quirkiness had previously been misidentified.
This discussion may probably warrant its own thread, so if there is discussion possibility start a new thread quoting this post.
For simplicity AoE will refer to the AoE effect object (the one with the on-enter, on-heartbeat, and on-exit handler scripts), not scripting on objects within an area.
First the misidentification: My original testing had begun with darkness, a fluked area of effect from the start, which has signaling for both hostile and non-hostile spells depending on the creature. I noticed the lack of spell immunity ever having an effect for the caster and set up a response system within the script to report various values being used, especially the value of ResistSpell(). I had also modified the scripts of wall of fire (hostile flag in spells.2da) and a changed version of invisibility sphere (non-hostile flag in spells.2da) as my comparison. Both wall of fire and invisibility sphere only used a hostile spell signal event followed by the ResistSpell(). I then had the values of darkness compared and flukes were there for the non-hostile spell signal and remained when I commented it out. What I did not realize is that darkness had a further bug, which in the hostile cases I had unintentionally fixed. Each ResistSpell() was determined by OBJECT_SELF (that is the area of effect not my character) however the frequency of the spell resistance success and failure rolls matched my character completely, no matter which character or what level, which prevented me from noticing the obvious difference in objects. The return value of 0 does happen for magic immunity and spell mantles, but when the normal SR roll was tested I was getting the local variable off the wrong object.
Second the quirkiness: Area of effects do function slightly differently with ResistSpell(). ResistSpell() has two arguments the "caster" and the "target", as well as three potential checks "spell level absorption" (i.e. mantle), "spell immunity", and "SR roll". In addition ResistSpell() looks at whether the last cast spell by the "caster" was used from a feat (hereafter described as "feat flag").
Use outside of AoEs (even for planar rift on BBoD which uses the summoner as the "caster" rather than the blade) for ResistSpell() only uses elements of the last cast spell of the "caster." They are, the caster level (GetCasterLevel()) with penetration feats added, the spell level and school from which the spell was cast, the spell ID, and the "feat flag". If the last cast spell was cast as a feat ResistSpell() defaults to 0 and sends no message to the PC. Otherwise, the entire ResistSpell() functions normally. Thus if I cast BBoD, then cast the assassin ghostly visage, the planar rifts of BBoD would refer to ghostly visage being a feat and thus bypass ResistSpell(). If I cast the spell shield instead of ghostly visage, the spell level would be 1, the school would be abjuration, and my caster level from the spellbook which I cast shield would be used in the "SR roll".
When used within an AoE script (any script or command initiated by an Area of Effect object including DelayCommand()) both "spell level absorption" and "spell immunity" carry their entire information over from the last cast spell of the "caster" respecting the "feat flag". The "SR roll" instead of potentially using another spell's caster level or being negated by a "feat flag", instead overrides the normal process using the same value for its "SR roll" as the dispels retrieve for the caster level of the effect. For normal spells, this means the "SR roll" is not bugged when going from one spellbook to another or using feats. On the other hand, feats like the assassin's darkness will use the full character level (instead of class level which is retrieved by GetCasterLevel()), as they are not cast from a spellbook. Given darkness is the only AoE feat, and that it ignores an "SR roll" success, there is no in-game issue arising from feats being treated this way.
Third the darkness bug: The darkness AoE uses OBJECT_SELF as the caster and thus since the AoE does not have a last cast spell, all checks for spell immunity or spell level absorption fail. Changing the "caster" to the AoE creator will allow it to check spell immunity according to the creator's last cast spell (the "SR roll" will be the same as the effect's "dispelability caster level" overrides the normal caster level).
EDIT: cleaning up format and clarifying examples
Modifié par WhiZard, 09 novembre 2011 - 05:15 .