Over the past few days I have been coding some AI (artificial intelligence) for a creature that the heroes can encounter. As the creature I had in mind was not already included in the game, I decided to script the creature's special abilities myself. In the process of doing this, I realised that my own understanding of the "supernatural rule" with respect to "immunities" may be wrong.
What Is Immunity?
When referring to the 3E core rules, supernatural abilities of creatures are those magical abilities that go away in an anti-magic field, but are not subject to spell resistance. Yet, the rules are a little more vague when it comes to the meaning of "immunity" in general, with respect to either of these other two terms. For instance, according to 3E rules, an elf is immune to sleep. I understand this to mean that an elf will not be subject to any form of magic that will cause it to sleep: whether by spells or supernatural effects!
In NWN, a PC can acquire items that offer various forms of "immunity". However, I am beginning to think that using the term "immunity" in this sense is a bit of a misnomer. The reason I say this, is because when checking scripts of supernatural effects, they do NOT check for items that offer immunity against them. Therefore, this would suggest that the term "immunity" in this sense is better translated as "a 100% spell resistance to a certain spell or type of spell". e.g. Immunity to "death" means a 100% spell resistance to spells and spell-like abilities that result in instant death, as opposed to instant death caused by a supernatural gaze attack. Therefore, an item "immunity" does not mean the same thing as an elf's "immunity to sleep".
Immunities In Play
Having given this some thought, I believe I am going to change the description of an item offering "Immunity" to something like "100% Spell Resistance to xxxx" to help avoid any confusion. Or, maybe try to make it clear that supernatural effects are not counted as those effects covered by immunities.
UPDATE: I believe I have all the information regarding the way immunities handle supernatural effects and have decided to make being immune to something, immune to everything that fits the description, including supernatural sources.
My conclusions are simply that a spell (or effect or special ability) script called from an ExecuteScript function does not allow the immunity check functions to work properly if it uses them. Therefore, any scripts that require immunity checking called via ExecuteScript require their own custom immunity checks added to the code. If the same scripts are called as a "spell" using their (if added) spells.2da row number, then the OC immunity check functions appear to work fine.