Thursday, 6 October 2011

Monster AI: Supernatural Abilities v Item Immunities

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.

4 comments:

Shaughn said...

Hi lance, I voted for allowing supernatural abilities to bypass the immunities.

My vote is with the assumption that these abilities will be primarily used with special encounters and "boss-like" creatures. So that having an ability bypass the immunity would only happen occasionally. As a player having your immunity bypassed on a regular basis would be frustrating.

Something else that could be used with a system like this, would be artifact items or even a consumable that would give resistance to a specific creature's ability.

Lance Botelle (Bard of Althéa) said...

Hi Shaughn,

I am tending that way myself at the moment, which means I will have to make the term "immunity" a little clearer on items that mention it. Either by removing the word immunity and rewording to specifiy spells and spell-like abilities ... or adding an addendum to each item warning that it does not make a PC immune to similar supernatural effects.

Lance.

Master Changer said...

As I mentioned on one of your threads on the BSN, the MySavingThrow function does check for immunity. MyS-T will return a value of 2 if the target was immune, so will not fall under any "if (!MySavingThrow(...SAVING_THROW_TYPE_*)" conditions.

So any special ability script that uses that function has immunity integrated into it without needing to make an explicit check.

How this impacts your calculation of what you do or don't want to be stopped by immunity, I don't know.

Lance Botelle (Bard of Althéa) said...

Hi Master Changer,

It was this function that led me to the difficulties I came across. When I investigated the function further, I noticed this written within its code (nw_i0_spells):

"/*
If the spell is save immune then the link must be applied in order to get the true immunity
to be resisted. That is the reason for returing false and not true. True blocks the
application of effects.
*/"

In other words, if the PC is immune to the effect, it returns FALSE - or the same value as failing the save as opposed to a value of 2, which it originally was meant to do.

Having looked into this further, I am beginning to think that immunities are handled by a reference in teh spells.2da under the IMMUNITYTYPE column, but I need to test this theory further.

Of course, there may also be other factors I am ignornat to. ;)

Lance.