FANDOM


This script fixes the use magic device (UMD) and spell failure chance for scrolls. If a caster uses a scroll that is higher level then they can cast normally, it has a misfire chance appropriate to the 3rd edition rules. And if a rogue/bard uses UMD the DC is set appropriately to the PHB and failure by 10 or more results in a misfire. The magical damage for the misfire is settable in a switch and can be set to the 3rd edition standard of 1d6 per spell level, although by default it is only 2d6.

The script itself Edit

This include file returns a TRUE of the spell works and a FALSE if the spell fails. By putting the include file into the spell script and then putting a conditional ( if...{ at the beginning of the spell script and } at the end of the entire main function of the spell script you will give a spell failure chance and misfire chance as per the PHB to scrolls. The package that can be downloaded here ( Click Here ) contains ALL spells modified to include this script.

NOTE: It is advised that you just download the package from the NWVault link above. But the include file script is included here for examination, as well as a single sample script to show how it should be used.

//::///////////////////////////////////////////////
//:: Spell Failure for Scrolls
//:: SpellFail_inc.nss
//:: Copyright (c) 2002 Bioware Corp.
//:://////////////////////////////////////////////
/*
    This script is an include file that, when incorporated into
    a spell script allows the proper (3rd edition) scroll failure and
    Use Magic Device Checks to be made.  Failure can result in a mishap,
    doing damage to the caster.
*/
/////////////////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Syrsuro
//:: Created On: 12/23/02
//:://////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
/*  Installation instructions.  This include file can be attached to any spell script.
    The SpellFailure routing will return True of the spell works and False if the spell fails.
    Simply including the entirity of the spell script in an if/then statement with SpellFailure
    as a conditional will result in spell failure and misfire damage as appropriate
*/
///////////////////////////////////////////////////////////////////////////////////////////////
//void main()   {    }
int UMDNeeded(int nSpellID);
int LevelClass(int nSpell);

///How Much Damge will a MisFired Scroll Cause?
int DAMAGE = d6(2); //d6(2);   //If set to -1 a misfire will cause a spell to do 1d6 per spell level.
///What is the Base DC of a scroll using UMD (DC = BaseDC + Spell Level
///Making this number lower will make it easier for rogues to read scrolls successfuly.
int BASE_DC = 25; //3rd Edition Default BaseDC = 25;
int DEBUG = 0;  ///Turn On (1) or Off (0) Debug SpeakStrings.

int SpellFailure()
{
    int nSpellID = GetSpellId();
    int nSpellWorks = TRUE;
    /////Determine whether UMD is needed.
    int nType = GetBaseItemType(GetSpellCastItem());
    int nSpellLevel = LevelClass(nSpellID);
    nSpellLevel = nSpellLevel - ((nSpellLevel/10)*10);
    int nDamage = 0;
    if (DAMAGE < 0) nDamage = d6(nSpellLevel); else nDamage = DAMAGE;
    int nSkill = GetSkillRank(SKILL_USE_MAGIC_DEVICE);
    int nDieRoll = d20();
    if (GetSkillRank(SKILL_SPELLCRAFT) > 5) nSkill = nSkill+2;
    if ((nType == 56) || (nType == 75))/////It is a scroll
    {
        if (DEBUG == 1) SpeakString ("Reading a Scroll");
        int nUMD = UMDNeeded(nSpellID);
        if (nUMD == 1)    ///Caster is not high enough level or lacks ability score
        {
            nSpellWorks = FALSE;
            if (DEBUG ==1 )SpeakString("WIS: d20 = " + IntToString(nDieRoll) + " Modified Roll = " +IntToString(nDieRoll + GetAbilityModifier(ABILITY_WISDOM))  + " vs 5" );
            if (nDieRoll == 1)
                {
                ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(nDamage),OBJECT_SELF);
                SpeakString("Spell Failure: Level -Mishap",TALKVOLUME_WHISPER);
                }
            else if (nDieRoll == 20) SpeakString("Spell Failure: Level",TALKVOLUME_WHISPER);
            else if (nDieRoll + GetAbilityModifier(ABILITY_WISDOM) < 5)
                {
                ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(nDamage),OBJECT_SELF);
                SpeakString("Spell Failure: Level -Mishap",TALKVOLUME_WHISPER);
                }
            else SpeakString("Spell Failure: Level",TALKVOLUME_WHISPER);

        }
        else if (nUMD == -1)
        {
            int nUMD_DC = BASE_DC + nSpellLevel;
            int nUMDCheck = nDieRoll + nSkill;
            if (DEBUG == 1) SpeakString("d20 = " + IntToString(nDieRoll) + " Modified Roll = " +IntToString(nUMDCheck)  + " vs DC " + IntToString(nUMD_DC) );
            if (nDieRoll == 1)
            {
                nSpellWorks = FALSE;
                ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(nDamage),OBJECT_SELF);
                SpeakString("Spell Failure: UMD- Mishap",TALKVOLUME_WHISPER);
            }
            else if (nDieRoll == 20)
            {
                nSpellWorks = TRUE;
                SpeakString("UMD Successful",TALKVOLUME_WHISPER);
            }
            else if (nUMDCheck < nUMD_DC - 9)
            {
                nSpellWorks = FALSE;
                ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(nDamage),OBJECT_SELF);
                SpeakString("Spell Failure: UMD- Mishap",TALKVOLUME_WHISPER);
            }
            else if (nUMDCheck < nUMD_DC)
            {
                nSpellWorks = FALSE;
                SpeakString("Spell Failure: UMD",TALKVOLUME_WHISPER);
            }
            else   ///nUMD Successful
            {
                nSpellWorks = TRUE;
                SpeakString("UMD Successful",TALKVOLUME_WHISPER);
            }
        }
        else ///Caster Check Successful
        {
            nSpellWorks = TRUE;
            SpeakString ("Caster Check Successful",TALKVOLUME_WHISPER);
        }
    }
    else if (DEBUG ==1) SpeakString ("Not a Scroll");
    return nSpellWorks;
}
////Determines whether the spell can be cast by using natural spell casting ability.
int UMDNeeded(int nSpellID)
{
    int nUMD = 0;
    int nSpLevel = LevelClass(nSpellID);
    int nChar = GetAbilityScore(OBJECT_SELF,ABILITY_CHARISMA);
    int nInt = GetAbilityScore(OBJECT_SELF,ABILITY_STRENGTH);
    int nWis = GetAbilityScore(OBJECT_SELF,ABILITY_WISDOM);
    object Caster = OBJECT_SELF;
/////Determining the Highest Level Spells Castable by the Caster
    int nCleric = GetLevelByClass(CLASS_TYPE_CLERIC,Caster);
        int nDivine = nCleric;
        int nCMax = (nCleric +1)/2;
        if ((nWis - 10) < nCMax) nCMax = nWis-10;
    int nDruid = GetLevelByClass(CLASS_TYPE_DRUID,Caster);
        nDivine = nDivine + nDruid;
        int nDMax = (nDruid +1)/2;
        if ((nWis - 10) < nCMax) nCMax = nWis-10;
    int nPaladin = GetLevelByClass(CLASS_TYPE_PALADIN,Caster);
        nDivine = nDivine + nPaladin/2;
        int nPMax = ((nPaladin+1)/3)-1; if (nPMax > 4) nPMax = 4;
        if ((nWis - 10) < nCMax) nCMax = nWis-10;
    int nRanger = GetLevelByClass(CLASS_TYPE_RANGER,Caster);
        nDivine = nDivine + nRanger/2;
        int nRMax = ((nRanger+1)/3)-1; if (nRMax > 4) nRMax = 4;
        if ((nWis - 10) < nCMax) nCMax = nWis-10;
    int nSorcerer = GetLevelByClass(CLASS_TYPE_SORCERER,Caster);
        int nArcane = nSorcerer;
        int nSMax = nSorcerer/2;
        if ((nChar - 10) < nCMax) nCMax = nChar-10;
    int nWizard = GetLevelByClass(CLASS_TYPE_WIZARD,Caster);
        nArcane = nArcane + nWizard;
        int nWMax = (nWizard+1)/2;
        if ((nInt - 10) < nCMax) nCMax = nInt-10;
    int nBard = GetLevelByClass(CLASS_TYPE_BARD,Caster);
        nArcane = nArcane + nBard/2;
        int nBMax = (nBard+2)/3; if (nBMax > 6) nBMax = 6;
        if ((nChar - 10) < nCMax) nCMax = nChar-10;
/////Determine what the highest level spell they can use overall is.
    int nCLevel = nArcane; if (nDivine > nCLevel) nCLevel = nDivine;
    int nDivMax = nCMax;
        if (nDMax > nDivMax) nDivMax = nDMax;
        if (nPMax > nDivMax) nDivMax = nPMax;
        if (nRMax > nDivMax) nDivMax = nRMax;
    int nArcMax = nWMax;
        if (nSMax > nArcMax) nArcMax = nSMax;
        if (nBMax > nArcMax) nArcMax = nBMax;
    int nSpellMax = nDivMax;
        if (nArcMax > nSpellMax) nSpellMax = nArcMax;
    int nDieRoll = d20();
    if (nSpLevel > 29) return -1;
    else if (nSpLevel > 19)
        {
            if (DEBUG == 1) SpeakString ("Arcane");
            nSpLevel = nSpLevel - 20;
            if (nArcMax == 0) nUMD = -1;///UMD needed
            else if (nSpLevel > nArcMax)
               if(nArcane > (GetSkillRank(SKILL_USE_MAGIC_DEVICE)-25)*2)  ///Caster Level or UMD?
                {
                    if (DEBUG == 1) SpeakString("CasterCheck Die = " + IntToString(nDieRoll) + " + " + IntToString(nArcane) + " vs DC " + IntToString(nSpLevel*2));
                    if (nDieRoll == 1) nUMD = 1; ////Caster too low (fail on one)
                    else if (nDieRoll + nArcane < nSpLevel*2) nUMD = 1; ////Caster too low - failed caster check.
                    else nUMD = 0; /////Caster succeeds in casting.
                }
                else nUMD = -1;  ///Use UMD
            else nUMD = 0; ///Able to cast safely
        }
    else if (nSpLevel > 9)
        {
            if (DEBUG == 1) SpeakString("Divine");
            nSpLevel = nSpLevel - 10;
            if (nDivMax == 0) nUMD = -1;  ///UMD needed
            else if (nSpLevel > nDivMax)
                if(nDivine > (GetSkillRank(SKILL_USE_MAGIC_DEVICE)-25)*2)  ///Caster Level or UMD?
                {
                    if (DEBUG ==1) SpeakString("CasterCheck Die = " + IntToString(nDieRoll) + " + " +  IntToString(nDivine) + " vs DC " + IntToString(nSpLevel*2));
                    if (nDieRoll == 1) nUMD = 1;  ///Caster too low - (fail on one)
                    else if (nDieRoll + nDivine < nSpLevel*2) nUMD = 1; ////Caster too low - failed caster check.
                    else nUMD = 0; /////Caster succeeds in casting
                }
                else nUMD = -1;  //Use UMD
            else nUMD = 0; ////Able to cast safely
        }
    else
        {
            if (DEBUG ==1) SpeakString ("Both");
            if (nSpellMax == 0) nUMD = -1;///UMD needed
            else if (nSpLevel > nSpellMax)
                if(nCLevel > (GetSkillRank(SKILL_USE_MAGIC_DEVICE)-25)*2)  ///Caster Level or UMD?
                {
                    if (DEBUG == 1) SpeakString("CasterCheck Die = " + IntToString(nDieRoll) + " + " +  IntToString(nCLevel) + " vs DC " + IntToString(nSpLevel*2));
                    if (nDieRoll == 1) nUMD = 1;  ///Caster too low - fail on one.
                    else if (nDieRoll + nCLevel < nSpLevel*2) nUMD = 1; ////Spell too high level for caster
                    else nUMD = 0; /////Caster succeeds in casting
                }
                else nUMD = -1;  ///Use UMD
            else nUMD = 0;  ///Able to cast safely
        }
   return nUMD;
}

int LevelClass(int nSpell)
{
int nArcane = FALSE; int nDivine = FALSE;
int nLevel = 10;
if (DEBUG == 1) SpeakString ("SpellID = " + IntToString(nSpell));
switch (nSpell)
{
case   0: nArcane= TRUE; nLevel = 6;   //int SPELL_ACID_FOG
    break;
case   1: nDivine = TRUE; nLevel = 2;    //int SPELL_AID   = 1;
    break;
case   2: nArcane = TRUE; nDivine = TRUE; nLevel = 3;    //intSPELL_ANIMATE_DEAD                      = 2;
    break;
case   3: nDivine = TRUE; nLevel = 2;     //intSPELL_BARKSKIN                          = 3;
    break;
case   4: nArcane = TRUE; nDivine = TRUE; nLevel = 3;     //intSPELL_BESTOW_CURSE                      = 4;
    break;
case   5: nDivine = TRUE; nLevel = 6;    //intSPELL_BLADE_BARRIER                     = 5;
    break;
case   6: nDivine = TRUE; nLevel = 1;    //intSPELL_BLESS                             = 6;
    break;
case   7:     //intSPELL_BLESS_WEAPON                      = 7;
    break;
case   8: nArcane = TRUE; nDivine = TRUE; nLevel = 2;    //intSPELL_BLINDNESS_AND_DEAFNESS            = 8;
    break;
case   9: nArcane = TRUE; nDivine = TRUE; nLevel = 2;    //intSPELL_BULLS_STRENGTH                    = 9;
    break;
case  10: nArcane = TRUE; nLevel = 1;    //intSPELL_BURNING_HANDS                     = 10;
    break;
case  11: nDivine = TRUE; nLevel = 3;    //intSPELL_CALL_LIGHTNING                    = 11;
    break;
//case 12:      //intSPELL_CALM_EMOTIONS = 12;          break;
case  13: nArcane = TRUE; nDivine = TRUE; nLevel = 2;    //intSPELL_CATS_GRACE                        = 13;
    break;
case  14: nArcane = TRUE; nLevel = 6;    //intSPELL_CHAIN_LIGHTNING                   = 14;
    break;
case  15: nArcane = TRUE; nLevel = 3;    //intSPELL_CHARM_MONSTER                     = 15;
    break;
case  16: nArcane = TRUE; nLevel = 1;    //intSPELL_CHARM_PERSON                      = 16;
    break;
case  17: nDivine = TRUE; nLevel = 2;    //intSPELL_CHARM_PERSON_OR_ANIMAL            = 17;
    break;
case  18: nArcane = TRUE; nLevel = 6;    //intSPELL_CIRCLE_OF_DEATH                   = 18;
    break;
case  19:     //intSPELL_CIRCLE_OF_DOOM                    = 19;
    break;
case  20: nArcane = TRUE; nLevel = 3;    //intSPELL_CLAIRAUDIENCE_AND_CLAIRVOYANCE    = 20;
    break;
case  21: nArcane = TRUE; nDivine = TRUE; nLevel = 2;    //intSPELL_CLARITY                           = 21;
    break;
case  22:     //intSPELL_CLOAK_OF_CHAOS                    = 22;
    break;
case  23: nArcane = TRUE; nLevel = 5;    //intSPELL_CLOUDKILL                         = 23;
    break;
case  24: nArcane = TRUE; nLevel = 1;    //intSPELL_COLOR_SPRAY                       = 24;
    break;
case  25: nArcane = TRUE; nLevel = 5;    //intSPELL_CONE_OF_COLD                      = 25;
    break;
case  26: nArcane = TRUE; nLevel = 3;    //intSPELL_CONFUSION                         = 26;
    break;
case  27: nArcane = TRUE; nDivine = TRUE; nLevel = 3;    //intSPELL_CONTAGION                         = 27;
    break;
case  28: nArcane = TRUE; nLevel = 7;    //intSPELL_CONTROL_UNDEAD                    = 28;
    break;
case  29: nDivine = TRUE; nLevel = 8;    //intSPELL_CREATE_GREATER_UNDEAD             = 29;
    break;
case  30: nArcane = TRUE; nDivine = TRUE; nLevel = 6;    //intSPELL_CREATE_UNDEAD                     = 30;
    break;
case  31: nArcane = TRUE; nDivine = TRUE; nLevel = 4;    //intSPELL_CURE_CRITICAL_WOUNDS              = 31;
    break;
case  32: nArcane = TRUE; nDivine = TRUE; nLevel = 1;    //intSPELL_CURE_LIGHT_WOUNDS                 = 32;
    break;
case  33: nArcane = TRUE; nDivine = TRUE; nLevel = 0;    //intSPELL_CURE_MINOR_WOUNDS                 = 33;
    break;
case  34: nArcane = TRUE; nDivine = TRUE; nLevel = 2;    //intSPELL_CURE_MODERATE_WOUNDS              = 34;
    break;
case  35: nArcane = TRUE; nDivine = TRUE; nLevel = 3;    //intSPELL_CURE_SERIOUS_WOUNDS               = 35;
    break;
case  36: nArcane = TRUE; nDivine = TRUE; nLevel = 2;    //intSPELL_DARKNESS                          = 36;
    break;
case  37: nArcane = TRUE; nLevel = 0; break; //intSPELL_DAZE                              = 37;
    break;
case  38: nDivine = TRUE; nLevel = 4;    //intSPELL_DEATH_WARD                        = 38;
    break;
case  39: nArcane = TRUE; nLevel = 7;    //intSPELL_DELAYED_BLAST_FIREBALL            = 39;
    break;
case  40: nArcane = TRUE; nDivine = TRUE; nLevel = 4;    //intSPELL_DISMISSAL                         = 40;
    break;
case  41: nArcane = TRUE; nDivine = TRUE; nLevel = 3;    //intSPELL_DISPEL_MAGIC                      = 41;
    break;
case  42: nDivine = TRUE; nLevel = 4;    //intSPELL_DIVINE_POWER                      = 42;
    break;
case  43: nDivine = TRUE; nLevel = 3;    //intSPELL_DOMINATE_ANIMAL                   = 43;
    break;
case  44: nArcane = TRUE; nLevel = 9;    //intSPELL_DOMINATE_MONSTER                  = 44;
    break;
case  45: nArcane = TRUE; nLevel = 4;    //intSPELL_DOMINATE_PERSON                   = 45;
    break;
case  46: nDivine = TRUE; nLevel = 1;    //intSPELL_DOOM                              = 46;
    break;
case  47: nArcane = TRUE; nLevel = 4;    //intSPELL_ELEMENTAL_SHIELD                  = 47;
    break;
case  48: nDivine = TRUE; nLevel = 9;    //intSPELL_ELEMENTAL_SWARM                   = 48;
    break;
case  49: nArcane = TRUE; nDivine = TRUE; nLevel = 2;    //intSPELL_ENDURANCE                         = 49;
    break;
case  50: nArcane = TRUE; nLevel = 1;    //intSPELL_ENDURE_ELEMENTS                   = 50;
    break;
case  51: nArcane = TRUE; nDivine = TRUE; nLevel = 9;    //intSPELL_ENERGY_DRAIN                      = 51;
    break;
case  52: nArcane = TRUE; nLevel = 4;    //intSPELL_ENERVATION                        = 52;
    break;
case  53: nDivine = TRUE; nLevel = 1;    //intSPELL_ENTANGLE                          = 53;
    break;
case  54: nArcane = TRUE; nLevel = 3;    //intSPELL_FEAR                              = 54;
    break;
case  55: nArcane = TRUE; nLevel = 5;    //intSPELL_FEEBLEMIND                        = 55;
    break;
case  56: nArcane = TRUE; nDivine = TRUE; nLevel = 7;    //intSPELL_FINGER_OF_DEATH                   = 56;
    break;
case  57: nDivine = TRUE; nLevel = 7;    //intSPELL_FIRE_STORM                        = 57;
    break;
case  58: nArcane = TRUE; nLevel = 3;    //intSPELL_FIREBALL                          = 58;
    break;
case  59: nArcane = TRUE; nLevel = 3;    //intSPELL_FLAME_ARROW                       = 59;
    break;
case  60: nDivine = TRUE; nLevel = 2;    //intSPELL_FLAME_LASH                        = 60;
    break;
case  61: nDivine = TRUE; nLevel = 4;    //intSPELL_FLAME_STRIKE                      = 61;
    break;
case  62: nDivine = TRUE; nLevel = 4;    //intSPELL_FREEDOM_OF_MOVEMENT               = 62;
    break;
case  63: nArcane = TRUE; nDivine = TRUE; nLevel = 9;    //intSPELL_GATE                              = 63;
    break;
case  64: nArcane = TRUE; nLevel = 2;    //intSPELL_GHOUL_TOUCH                       = 64;
    break;
case  65: nArcane = TRUE; nLevel = 6;    //intSPELL_GLOBE_OF_INVULNERABILITY          = 65;
    break;
case  66: nArcane = TRUE; nDivine = TRUE; nLevel = 1;    //intSPELL_GREASE                            = 66;
    break;
case  67: nArcane = TRUE; nDivine = TRUE; nLevel = 6;    //intSPELL_GREATER_DISPELLING                = 67;
    break;
case  68:     //intSPELL_GREATER_MAGIC_WEAPON              = 68;
    break;
case  69: nArcane = TRUE; nLevel = 8;    //intSPELL_GREATER_PLANAR_BINDING            = 69;
    break;
case  70: nDivine = TRUE; nLevel = 7;    //intSPELL_GREATER_RESTORATION               = 70;
    break;
case  71: nArcane = TRUE; nLevel = 5;    //intSPELL_GREATER_SHADOW_CONJURATION = 71;
    break;
case  72: nArcane = TRUE; nLevel = 6;    //intSPELL_GREATER_SPELL_BREACH              = 72;
    break;
case  73: nArcane = TRUE; nLevel = 9;    //intSPELL_GREATER_SPELL_MANTLE              = 73;
    break;
case  74: nArcane = TRUE; nDivine = TRUE; nLevel = 6;    //intSPELL_GREATER_STONESKIN                 = 74;
    break;
// case 75:     //intSPELL_GUST_OF_WIND = 75;   break;
case  76: nDivine = TRUE; nLevel = 4;    //intSPELL_HAMMER_OF_THE_GODS                = 76;
    break;
case  77: nDivine = TRUE; nLevel = 6;    //intSPELL_HARM                              = 77;
    break;
case  78: nArcane = TRUE; nLevel = 3;    //intSPELL_HASTE                             = 78;
    break;
case  79: nDivine = TRUE; nLevel = 6;    //intSPELL_HEAL                              = 79;
    break;
case  80: nArcane = TRUE; nDivine = TRUE; nLevel = 5;    //intSPELL_HEALING_CIRCLE                    = 80;
    break;
case  81: nDivine = TRUE; nLevel = 2;    //intSPELL_HOLD_ANIMAL                       = 81;
    break;
case  82: nArcane = TRUE; nDivine = TRUE; nLevel = 4;    //intSPELL_HOLD_MONSTER                      = 82;
    break;
case  83: nArcane = TRUE; nDivine = TRUE; nLevel = 2;    //intSPELL_HOLD_PERSON                       = 83;
    break;
case  84: nDivine = TRUE; nLevel = 8; //intSPELL_HOLY_AURA;                        = 84;
    break;
case  85:     //intSPELL_HOLY_SWORD                        = 85;
    break;
case  86: nArcane = TRUE; nLevel = 1;    //intSPELL_IDENTIFY                          = 86;
    break;
case  87: nDivine = TRUE; nLevel = 9;    //intSPELL_IMPLOSION                         = 87;
    break;
case  88: nArcane = TRUE; nLevel = 4;    //intSPELL_IMPROVED_INVISIBILITY             = 88;
    break;
case  89: nArcane = TRUE; nLevel = 8;    //intSPELL_INCENDIARY_CLOUD                  = 89;
    break;
case  90: nArcane = TRUE; nLevel = 2;    //intSPELL_INVISIBILITY                      = 90;
    break;
case  91: nDivine = TRUE; nLevel = 3;    //intSPELL_INVISIBILITY_PURGE                = 91;
    break;
case  92: nArcane = TRUE; nLevel = 3;    //intSPELL_INVISIBILITY_SPHERE               = 92;
    break;
case  93: nArcane = TRUE; nLevel = 2;    //intSPELL_KNOCK                             = 93;
    break;
case  94: nArcane = TRUE; nDivine = TRUE; nLevel = 1;    //intSPELL_LESSER_DISPEL                     = 94;
    break;
case  95: nArcane = TRUE; nLevel = 5;    //intSPELL_LESSER_MIND_BLANK                 = 95;
    break;
case  96: nArcane = TRUE; nLevel = 5;    //intSPELL_LESSER_PLANAR_BINDING             = 96;
    break;
case  97: nDivine = TRUE; nLevel = 2;    //intSPELL_LESSER_RESTORATION                = 97;
    break;
case  98: nArcane = TRUE; nLevel = 4;    //intSPELL_LESSER_SPELL_BREACH               = 98;
    break;
case  99: nArcane = TRUE; nLevel = 5;    //intSPELL_LESSER_SPELL_MANTLE               = 99;
    break;
case 100: nArcane = TRUE; nDivine = TRUE; nLevel = 0;    //intSPELL_LIGHT                             = 100;
    break;
case 101: nArcane = TRUE; nLevel = 3;    //intSPELL_LIGHTNING_BOLT                    = 101;
    break;
case 102: nArcane = TRUE; nLevel = 1;    //intSPELL_MAGE_ARMOR                        = 102;
    break;
case 103: nArcane = TRUE; nDivine = TRUE; nLevel = 3;    //intSPELL_MAGIC_CIRCLE_AGAINST_CHAOS        = 103;
    break;
case 104: nArcane = TRUE; nDivine = TRUE; nLevel = 3;    //intSPELL_MAGIC_CIRCLE_AGAINST_EVIL         = 104;
    break;
case 105: nArcane = TRUE; nDivine = TRUE; nLevel = 3;    //intSPELL_MAGIC_CIRCLE_AGAINST_GOOD         = 105;
    break;
case 106: nArcane = TRUE; nDivine = TRUE; nLevel = 3;    //intSPELL_MAGIC_CIRCLE_AGAINST_LAW          = 106;
    break;
case 107: nArcane = TRUE; nLevel = 1;    //intSPELL_MAGIC_MISSILE                     = 107;
    break;
case 108:     //intSPELL_MAGIC_VESTMENT                    = 108;
    break;
case 109:     //intSPELL_MAGIC_WEAPON                      = 109;
    break;
case 110: nArcane = TRUE; nLevel = 8;    //intSPELL_MASS_BLINDNESS_AND_DEAFNESS       = 110;
    break;
case 111: nArcane = TRUE; nLevel = 8;    //intSPELL_MASS_CHARM                        = 111;
    break;
// case 112:     //intSPELL_MASS_DOMINATION = 112;
    break;
case 113: nArcane = TRUE; nLevel = 6;    //intSPELL_MASS_HASTE                        = 113;
    break;
case 114: nDivine = TRUE; nLevel = 8;    //intSPELL_MASS_HEAL                         = 114;
    break;
case 115: nArcane = TRUE; nLevel = 2;    //intSPELL_MELFS_ACID_ARROW                  = 115;
    break;
case 116: nArcane = TRUE; nLevel = 9;    //intSPELL_METEOR_SWARM                      = 116;
    break;
case 117: nArcane = TRUE; nLevel = 8;    //intSPELL_MIND_BLANK                        = 117;
    break;
case 118: nArcane = TRUE; nLevel = 5;    //intSPELL_MIND_FOG                          = 118;
    break;
case 119: nArcane = TRUE; nLevel = 4;    //intSPELL_MINOR_GLOBE_OF_INVULNERABILITY    = 119;
    break;
case 120: nArcane = TRUE; nLevel = 2;    //intSPELL_GHOSTLY_VISAGE                    = 120;
    break;
case 121: nArcane = TRUE; nLevel = 5;    //intSPELL_ETHEREAL_VISAGE                   = 121;
    break;
case 122: nArcane = TRUE; nLevel = 9;    //intSPELL_MORDENKAINENS_DISJUNCTION         = 122;
    break;
case 123: nArcane = TRUE; nLevel = 7;    //intSPELL_MORDENKAINENS_SWORD               = 123;
    break;
case 124: nDivine = TRUE; nLevel = 8;    //intSPELL_NATURES_BALANCE                   = 124;
    break;
case 125: nDivine = TRUE; nLevel = 3;    //intSPELL_NEGATIVE_ENERGY_PROTECTION        = 125;
    break;
case 126: nArcane = TRUE; nDivine = TRUE; nLevel = 3;    //intSPELL_NEUTRALIZE_POISON                 = 126;
    break;
case 127: nArcane = TRUE; nLevel = 4;    //intSPELL_PHANTASMAL_KILLER                 = 127;
    break;
case 128: nArcane = TRUE; nLevel = 6;    //intSPELL_PLANAR_BINDING                    = 128;
    break;
case 129: nDivine = TRUE; nLevel = 3;    //intSPELL_POISON                            = 129;
    break;
case 130: nArcane = TRUE; nDivine = TRUE; nLevel = 4;    //intSPELL_POLYMORPH_SELF                    = 130;
    break;
case 131: nArcane = TRUE; nLevel = 9;    //intSPELL_POWER_WORD_KILL                   = 131;
    break;
case 132: nArcane = TRUE; nLevel = 7;    //intSPELL_POWER_WORD_STUN                   = 132;
    break;
case 133: nDivine = TRUE; nLevel = 3;    //intSPELL_PRAYER                            = 133;
    break;
case 134: nArcane = TRUE; nDivine = TRUE; nLevel = 8;    //intSPELL_PREMONITION                       = 134;
    break;
case 135: nArcane = TRUE; nLevel = 7;    //intSPELL_PRISMATIC_SPRAY                   = 135;
    break;
case 136: nArcane = TRUE; nDivine = TRUE; nLevel = 1;    //intSPELL_PROTECTION__FROM_CHAOS            = 136;
    break;
case 137: nArcane = TRUE; nDivine = TRUE; nLevel = 2;    //intSPELL_PROTECTION_FROM_ELEMENTS          = 137;
    break;
case 138: nArcane = TRUE; nDivine = TRUE; nLevel = 1;    //intSPELL_PROTECTION_FROM_EVIL              = 138;
    break;
case 139: nArcane = TRUE; nDivine = TRUE; nLevel = 1;    //intSPELL_PROTECTION_FROM_GOOD              = 139;
    break;
case 140: nArcane = TRUE; nDivine = TRUE; nLevel = 1;    //intSPELL_PROTECTION_FROM_LAW               = 140;
    break;
case 141: nArcane = TRUE; nLevel = 7;    //intSPELL_PROTECTION_FROM_SPELLS            = 141;
    break;
case 142: nDivine = TRUE; nLevel = 5;    //intSPELL_RAISE_DEAD                        = 142;
    break;
case 143: nArcane = TRUE; nLevel = 1;    //intSPELL_RAY_OF_ENFEEBLEMENT               = 143;
    break;
case 144: nArcane = TRUE; nLevel = 0;    //intSPELL_RAY_OF_FROST                      = 144;
    break;
case 145: nArcane = TRUE; nDivine = TRUE; nLevel = 3;    //intSPELL_REMOVE_BLINDNESS_AND_DEAFNESS     = 145;
    break;
case 146: nArcane = TRUE; nDivine = TRUE; nLevel = 3;    //intSPELL_REMOVE_CURSE                      = 146;
    break;
case 147: nArcane = TRUE; nDivine = TRUE; nLevel = 3;    //intSPELL_REMOVE_DISEASE                    = 147;
    break;
case 148: nDivine = TRUE; nLevel = 1;    //intSPELL_REMOVE_FEAR                       = 148;
    break;
case 149: nDivine = TRUE; nLevel = 2;    //intSPELL_REMOVE_PARALYSIS                  = 149;
    break;
case 150: nArcane = TRUE; nDivine = TRUE; nLevel = 2;    //intSPELL_RESIST_ELEMENTS                   = 150;
    break;
case 151: nArcane = TRUE; nDivine = TRUE; nLevel = 0;    //intSPELL_RESISTANCE                        = 151;
    break;
case 152: nDivine = TRUE; nLevel = 4;    //intSPELL_RESTORATION                       = 152;
    break;
case 153: nDivine = TRUE; nLevel = 7;    //intSPELL_RESURRECTION                      = 153;
    break;
case 154: nDivine = TRUE; nLevel = 1;    //intSPELL_SANCTUARY                         = 154;
    break;
case 155: nArcane = TRUE; nDivine = TRUE; nLevel = 1;    //intSPELL_SCARE                             = 155
    break;
case 156: nDivine = TRUE; nLevel = 3;    //intSPELL_SEARING_LIGHT                     = 156;
    break;
case 157: nArcane = TRUE; nLevel = 2;    //intSPELL_SEE_INVISIBILITY                  = 157;
    break;
case 158: nArcane = TRUE; nLevel = 6;    //intSPELL_SHADES = 158;
    break;
case 159: nArcane = TRUE; nLevel = 4;    //intSPELL_SHADOW_CONJURATION = 159;
    break;
case 160: nArcane = TRUE; nLevel = 7;    //intSPELL_SHADOW_SHIELD                     = 160;
    break;
case 161: nArcane = TRUE; nDivine = TRUE; nLevel = 9;    //intSPELL_SHAPECHANGE                       = 161;
    break;
case 162:     //intSPELL_SHIELD_OF_LAW                     = 162;
    break;
case 163: nArcane = TRUE; nDivine = TRUE; nLevel = 2;    //intSPELL_SILENCE                           = 163;
    break;
case 164: nDivine = TRUE; nLevel = 5;    //intSPELL_SLAY_LIVING                       = 164;
    break;
case 165: nArcane = TRUE; nDivine = TRUE; nLevel = 1;    //intSPELL_SLEEP                             = 165;
    break;
case 166: nArcane = TRUE; nLevel = 3;    //intSPELL_SLOW                              = 166;
    break;
case 167: nArcane = TRUE; nDivine = TRUE; nLevel = 2;    //intSPELL_SOUND_BURST                       = 167;
    break;
case 168: nDivine = TRUE; nLevel = 5;   //intSPELL_SPELL_RESISTANCE                  = 168;
    break;
case 169: nArcane = TRUE; nLevel = 7;    //intSPELL_SPELL_MANTLE                      = 169;
    break;
case 170:     //intSPELL_SPHERE_OF_CHAOS                   = 170;
    break;
case 171: nArcane = TRUE; nLevel = 3;    //intSPELL_STINKING_CLOUD                    = 171;
    break;
case 172: nArcane = TRUE; nDivine = TRUE; nLevel = 4;    //intSPELL_STONESKIN                         = 172;
    break;
case 173: nDivine = TRUE; nLevel = 9;    //intSPELL_STORM_OF_VENGEANCE                = 173;
    break;
case 174: nArcane = TRUE; nDivine = TRUE; nLevel = 1;    //intSPELL_SUMMON_CREATURE_I                 = 174;
    break;
case 175: nArcane = TRUE; nDivine = TRUE; nLevel = 2;    //intSPELL_SUMMON_CREATURE_II                = 175;
    break;
case 176: nArcane = TRUE; nDivine = TRUE; nLevel = 3;    //intSPELL_SUMMON_CREATURE_III               = 176;
    break;
case 177: nArcane = TRUE; nDivine = TRUE; nLevel = 4;    //intSPELL_SUMMON_CREATURE_IV                = 177;
    break;
case 178: nArcane = TRUE; nDivine = TRUE; nLevel = 9;    //intSPELL_SUMMON_CREATURE_IX                = 178;
    break;
case 179: nArcane = TRUE; nDivine = TRUE; nLevel = 5;    //intSPELL_SUMMON_CREATURE_V                 = 179;
    break;
case 180: nArcane = TRUE; nDivine = TRUE; nLevel = 6;    //intSPELL_SUMMON_CREATURE_VI                = 180;
    break;
case 181: nArcane = TRUE; nDivine = TRUE; nLevel = 7;    //intSPELL_SUMMON_CREATURE_VII               = 181;
    break;
case 182: nArcane = TRUE; nDivine = TRUE; nLevel = 8;    //intSPELL_SUMMON_CREATURE_VIII              = 182;
    break;
case 183: nDivine = TRUE; nLevel = 8;    //intSPELL_SUNBEAM                           = 183;
    break;
case 184: nArcane = TRUE; nLevel = 6;    //intSPELL_TENSERS_TRANSFORMATION            = 184;
    break;
case 185: nArcane = TRUE; nLevel = 9;    //intSPELL_TIME_STOP                         = 185;
    break;
case 186: nArcane = TRUE; nDivine = TRUE; nLevel = 5;    //intSPELL_TRUE_SEEING                       = 186;
    break;
case 187: nDivine = TRUE; nLevel = 8;     //intSPELL_UNHOLY_AURnArcane = TRUE;                      = 187;
    break;
case 188: nArcane = TRUE; nLevel = 3;    //intSPELL_VAMPIRIC_TOUCH                    = 188;
    break;
case 189: nDivine = TRUE; nLevel = 0;    //intSPELL_VIRTUE                            = 189;
    break;
case 190: nArcane = TRUE; nLevel = 9;    //intSPELL_WAIL_OF_THE_BANSHEE               = 190;
    break;
case 191: nArcane = TRUE; nDivine = TRUE; nLevel = 4;    //intSPELL_WALL_OF_FIRE                      = 191;
    break;
case 192: nArcane = TRUE; nLevel = 2;    //intSPELL_WEB                               = 192;
    break;
case 193: nArcane = TRUE; nLevel = 9;    //intSPELL_WEIRD                             = 193;
    break;
case 194: nDivine = TRUE; nLevel = 7;    //intSPELL_WORD_OF_FAITH                     = 194;
    break;
case 324: nArcane = TRUE; nLevel = 6;   //int SPELL_SHADES_SUMMON_SHADOW              = 324;
    break;
case 340 : nArcane = TRUE; nLevel = 6;   //int SPELL_SHADES_CONE_OF_COLD               = 340;
    break;
case 341:nArcane = TRUE; nLevel = 6;   //int SPELL_SHADES_FIREBALL                   = 341;
    break;
case 342:nArcane = TRUE; nLevel = 6;   //int SPELL_SHADES_STONESKIN                  = 342;
    break;
case 343: nArcane = TRUE; nLevel = 6;   //int SPELL_SHADES_WALL_OF_FIRE               = 343;
    break;
case 344: nArcane = TRUE; nLevel = 4;   //int SPELL_SHADOW_CONJURATION_SUMMON_SHADOW  = 344;
    break;
case 345: nArcane = TRUE; nLevel = 4;   //int SPELL_SHADOW_CONJURATION_DARKNESS       = 345;
    break;
case 346: nArcane = TRUE; nLevel = 4;   //int SPELL_SHADOW_CONJURATION_INIVSIBILITY   = 346;
    break;
case 347: nArcane = TRUE; nLevel = 4;   //int SPELL_SHADOW_CONJURATION_MAGE_ARMOR     = 347;
    break;
case 348: nArcane = TRUE; nLevel = 4;   //int SPELL_SHADOW_CONJURATION_MAGIC_MISSILE  = 348;
    break;
case 349: nArcane = TRUE; nLevel = 5;   //int SPELL_GREATER_SHADOW_CONJURATION_SUMMON_SHADOW = 349;
    break;
case 350: nArcane = TRUE; nLevel = 5;  //int SPELL_GREATER_SHADOW_CONJURATION_ACID_ARROW = 350;
    break;
case 351: nArcane = TRUE; nLevel = 5;  //int SPELL_GREATER_SHADOW_CONJURATION_MIRROR_IMAGE = 351;
    break;
case 352: nArcane = TRUE; nLevel = 5;  //int SPELL_GREATER_SHADOW_CONJURATION_WEB    = 352;
    break;
case 353: nArcane = TRUE; nLevel = 5;  //int SPELL_GREATER_SHADOW_CONJURATION_MINOR_GLOBE = 353;
    break;
case 354: nArcane = TRUE; nDivine = TRUE; nLevel = 2;  //int SPELL_EAGLE_SPLEDOR                     = 354;
    break;
case 355:nArcane = TRUE; nDivine = TRUE; nLevel = 2;   //int SPELL_OWLS_WISDOM                       = 355;
    break;
case 356: nArcane = TRUE; nDivine = TRUE; nLevel = 2;   //int SPELL_FOXS_CUNNING                      = 356;
    break;
case 357: nArcane = TRUE; nDivine = TRUE; nLevel = 5;   //int SPELL_GREATER_EAGLE_SPLENDOR            = 357;
    break;
case 358: nArcane = TRUE; nDivine = TRUE; nLevel = 5;   //int SPELL_GREATER_OWLS_WISDOM               = 358;
    break;
case 359: nArcane = TRUE; nDivine = TRUE; nLevel = 5;   //int SPELL_GREATER_FOXS_CUNNING              = 359;
    break;
case 360: nArcane = TRUE; nDivine = TRUE; nLevel = 5;   //int SPELL_GREATER_BULLS_STRENGTH            = 360;
    break;
case 361: nArcane = TRUE; nDivine = TRUE; nLevel = 5;   //int SPELL_GREATER_CATS_GRACE                = 361;
    break;
case 362: nArcane = TRUE; nDivine = TRUE; nLevel = 5;   //int SPELL_GREATER_ENDURANCE                 = 362;
    break;
case 363: nDivine = TRUE; nLevel = 5;     //int SPELL_AWAKEN                            = 363;
    break;
case 364: nDivine = TRUE; nLevel = 7;     //int SPELL_CREEPING_DOOM                     = 364;
    break;
case 365: nArcane = TRUE; nLevel = 1;//int SPELL_DARKVISION (Ultravision)                         = 365;
    break;
case 366: nDivine = TRUE; nLevel = 7;   //int SPELL_DESTRUCTION                       = 366;
    break;
case 367: nArcane = TRUE; nLevel = 8;   //int SPELL_HORRID_WILTING                    = 367;
    break;
case 368: nArcane = TRUE; nDivine = TRUE; nLevel = 4;   //int SPELL_ICE_STORM                         = 368;
    break;
case 369: nArcane = TRUE; nDivine = TRUE; nLevel = 5;   //int SPELL_ENERGY_BUFFER                     = 369;
    break;
case 370: nArcane = TRUE; nLevel = 3;   //int SPELL_NEGATIVE_ENERGY_BURST             = 370;
    break;
case 371: nArcane = TRUE; nDivine = TRUE; nLevel = 1;   //int SPELL_NEGATIVE_ENERGY_RAY               = 371;
    break;
case 372: nDivine = TRUE; nLevel = 7;   //int SPELL_AURA_OF_VITALITY                  = 372;
    break;
case 373: nArcane = TRUE; nLevel = 4;   //int SPELL_WAR_CRY                           = 373;
    break;
case 374: nDivine = TRUE; nLevel = 7;   //int SPELL_REGENERATE                        = 374;
    break;
case 375: nArcane = TRUE; nLevel = 4;   //int SPELL_EVARDS_BLACK_TENTACLES            = 375;
    break;
case 376: nArcane = TRUE; nLevel = 6;   //int SPELL_LEGEND_LORE                       = 376;
    break;
case 377: nArcane = TRUE; nDivine = TRUE; nLevel = 2;   //int SPELL_FIND_TRAPS                        = 377;
    break;
case 387:  nArcane = TRUE; nDivine = TRUE; nLevel = 4; ///SPELL_POLYMORPH Giant Spider
    break;
case 388:  nArcane = TRUE; nDivine = TRUE; nLevel = 4; ///SPELL_POLYMORPH Troll
    break;
case 389:  nArcane = TRUE; nDivine = TRUE; nLevel = 4; ///SPELL_POLYMORPH UMberHulk
    break;
case 390:   nArcane = TRUE; nDivine = TRUE; nLevel = 4; ///SPELL_POLYMORPH Pixie
    break;
case 391:  nArcane = TRUE; nDivine = TRUE; nLevel = 4; ///SPELL_POLYMORPH Zombie
    break;
case 392:  nArcane = TRUE; nDivine = TRUE; nLevel = 9; //SPELL_SHAPECHANGE Red Dragon
    break;
case 393:  nArcane = TRUE; nDivine = TRUE; nLevel = 9; //SPELL_SHAPECHANGE Fire Giant
    break;
case 394:  nArcane = TRUE; nDivine = TRUE; nLevel = 9; //SPELL_SHAPECHANGE Balor
    break;
case 395:   nArcane = TRUE; nDivine = TRUE; nLevel = 9; //SPELL_SHAPECHANGE Death Slaad
    break;
case 396:  nArcane = TRUE; nDivine = TRUE; nLevel = 9; //SPELL_SHAPECHANGE Iron Golem
    break;
}
if (DEBUG ==1) SpeakString ("Arc = " + IntToString(nArcane) + "; Div = " + IntToString(nDivine) + "; Level = " + IntToString(nLevel));
if (nArcane == TRUE && nDivine == TRUE)  nLevel = nLevel;
else if (nDivine == TRUE) nLevel = nLevel + 10;
else nLevel = nLevel + 20;
return nLevel;
}
#include "spellfail_inc"
//::///////////////////////////////////////////////
//:: Bless
//:: NW_S0_Bless.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    All allies within 30ft of the caster gain a
    +1 attack bonus and a +1 save bonus vs fear
    effects
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: July 24, 2001
//:://////////////////////////////////////////////
//:: VFX Pass By: Preston W, On: June 20, 2001
#include "NW_I0_SPELLS"
void main()
{
    if (SpellFailure() != FALSE)  {
    //Declare major variables
    object oTarget;
    effect eVis = EffectVisualEffect(VFX_IMP_HEAD_HOLY);
    effect eImpact = EffectVisualEffect(VFX_FNF_LOS_HOLY_30);
    effect eAttack = EffectAttackIncrease(1);
    effect eSave = EffectSavingThrowIncrease(SAVING_THROW_ALL, 1, SAVING_THROW_TYPE_FEAR);
    effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
    effect eLink = EffectLinkEffects(eAttack, eSave);
    eLink = EffectLinkEffects(eLink, eDur);
    int nDuration = 1 + GetCasterLevel(OBJECT_SELF);
    int nMetaMagic = GetMetaMagicFeat();
    float fDelay;
    //Metamagic duration check
    if (nMetaMagic == METAMAGIC_EXTEND)
    {
        nDuration = nDuration *2;   //Duration is +100%
    }
    //Apply Impact
    ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eImpact, GetSpellTargetLocation());
    //Get the first target in the radius around the caster
    oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(OBJECT_SELF));
    while(GetIsObjectValid(oTarget))
    {
        if(GetIsReactionTypeFriendly(oTarget) || GetFactionEqual(oTarget))
        {
            fDelay = GetRandomDelay(0.4, 1.1);
            //Fire spell cast at event for target
            SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_BLESS, FALSE));
            //Apply VFX impact and bonus effects
            DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
            DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, TurnsToSeconds(nDuration)));
        }
        //Get the next target in the specified area around the caster
        oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(OBJECT_SELF));
    }
}}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.