Difference between revisions of "ResistSpell"

From NWN Lexicon
Jump to: navigation, search
(cleaned up diction, added links ~~~~)
Line 34: Line 34:
 
====Remarks====
 
====Remarks====
  
This should only ever be used in a spell script! It may not work correctly elsewhere, as Mantals and Globes use the spells level, if it is a PC spell (defined in spells.2da), to stop this or decrease the amount of mantal power, and the caster level of oCaster of course! <br /><br /> It checks spell resistance, Globes, and Spell Immunity. <br /><br /> IE, the effects EffectSpellImmunity, EffectSpellResistanceIncrease, EffectSpellLevelAbsorption (Or approprate item properties). See seperate descriptions for exact effects. <br /><br /> Never use it for non-player spells (defined in the spells.2da), it mearly always returns -1 (as it would for a non-spell-script!)
+
This function checks spell resistance, globes, and spell immunity (i.e., the effects [[EffectSpellImmunity]], [[EffectSpellResistanceIncrease]], [[EffectSpellLevelAbsorption]] or approprate item properties) if the spell cast is a PC spell as defined in spells.2da. See seperate descriptions for exact effects.
  
<br />
+
Never use this function for non-player spells (as defined in spells.2da), it merely returns -1, as it would for a non-spell-script.
 +
 
 +
This function should never be used except in a spell script. It may not work correctly elsewhere, as mantles and globes use the spell's level to stop the spell or decrease the amount of a given spell mantle's power (as well as the caster level of oCaster, of course).
  
 
====Known Bugs====
 
====Known Bugs====

Revision as of 21:49, 15 April 2013



ResistSpell(object, object)

Performs a spell resistance check between the caster and the target.

int ResistSpell(
    object oCaster,
    object oTarget
);

Parameters

oCaster

Caster of the spell.

oTarget

Target of the spell.


Description

* Return value if oCaster or oTarget is an invalid object: FALSE
* Return value if spell cast is not a player spell: - 1
* Return value if spell resisted: 1
* Return value if spell resisted via magic immunity: 2
* Return value if spell resisted via spell absorption: 3

Bioware uses MyResistSpell() for spells that use this, to apply appropriate effects for the return value. It is a good idea to use this wrapper function instead of this directly. The Bioware function only returns 1 or 0.



Remarks

This function checks spell resistance, globes, and spell immunity (i.e., the effects EffectSpellImmunity, EffectSpellResistanceIncrease, EffectSpellLevelAbsorption or approprate item properties) if the spell cast is a PC spell as defined in spells.2da. See seperate descriptions for exact effects.

Never use this function for non-player spells (as defined in spells.2da), it merely returns -1, as it would for a non-spell-script.

This function should never be used except in a spell script. It may not work correctly elsewhere, as mantles and globes use the spell's level to stop the spell or decrease the amount of a given spell mantle's power (as well as the caster level of oCaster, of course).

Known Bugs

1.64: Fixed problem with ResistSpell() scripting command not working correctly when used with Cleric Domain spells and sub-radial spells in combination with spell absorption effects.


Version

1.64

See Also

functions: 

MyResistSpell



 author: Jody Fletcher, editor: Jasperre, additional contributor(s): Jasperre