Reorganized hak files & removed duplicates. Added @rafhot's PRC spell & ability level scaling expansion. Further script integration. Full compile.
524 lines
14 KiB
Plaintext
524 lines
14 KiB
Plaintext
///Created by Genisys / Guile 6/13/08
|
|
///(Friday the 13th *crosses fingers*)
|
|
/////////////////////////////////////
|
|
|
|
#include "nw_i0_spells"
|
|
#include "epicdc_inc"
|
|
|
|
//:: void main (){}
|
|
|
|
/*
|
|
This magnificent include saves you time and reduces the length of the "myhook"
|
|
script by using functions instead of retyping everything! Just follow the
|
|
examples of the functions (copy / paste) to utlize the various functions below
|
|
in the "myhook" script. I created several generic functions to create generic
|
|
effects for spells that you do not wish the original version to run, but wanted
|
|
to create your own effects for that spell.
|
|
|
|
The options I have set within this include script (See below const int)
|
|
allows you to adjust most spells to epic casting. (if applicable)
|
|
Due to the nature of some area of effect spells only the target of the spell
|
|
will recieve the epic damage bonus, like cone of cold / issacs missles, etc,
|
|
unlike fireball, icestorm, etc. they don't have a sphere, and it would be too
|
|
much work to script each specific type of sphere, so I just created a huge
|
|
sphere as the area of effect for most spells, and added the area damage to those
|
|
spells, all other damage dealing spells that aren't a large sphere will just
|
|
deal extra damage to the target only, please read below for more information.
|
|
|
|
NOTE: the functions directly below options are the function which you can use
|
|
to create generic effect for spells that you do not wish to use the original
|
|
spell.
|
|
|
|
*/
|
|
/////////////////BEGIN OPTIONS/////////////////////
|
|
|
|
/*
|
|
This int is a Magical Damage Bonus added to the normal damage dealt by spells.
|
|
This one took me a while to figure out, but it's been simplified for you..
|
|
the # below is the # of levels the caster needs beyond level 20 to gain
|
|
an additional d8 dmg / # of Epic Levels (defined by eBon int)
|
|
ie. if set to a 3 a level 29 caster would get + 3d8 additional damage
|
|
set this constant to 21 to disable. (ie no bonus!) */
|
|
const int eBon = 3;
|
|
|
|
/*
|
|
This determinues How much bonus damage is dealt by all dmg dealing spells.
|
|
Note: this dice is multiplied by the # of Epic Levels (set directly above)
|
|
Here are the only possible combinations of damage, change the eDam # to adjust
|
|
0 = disabled / 1 = 1d4 / 2 = 1d6 / 3 = 1d8 / 4 = 1d10 / 5 = 1d12
|
|
6 = 2d8 / 7 = 2d10 / 8 = 2d12 / 9 = 2d20 */
|
|
const int zDam = 2;
|
|
|
|
|
|
///////////////END OPTIONS////////////////////
|
|
|
|
////////Protypes (Defined)////////
|
|
//NOTE:The following functions go in the spell case { } for a single spell
|
|
//You will see the code goes here in green, this is where any spell code goes.
|
|
|
|
//This function is more or less for a generic spell effect, it's intended use
|
|
//is for spells that will not run normally because you are creating your own
|
|
//version of the actual spell, this function is used for spells that are
|
|
//targeting one target.(This is for single target spells only!)
|
|
//Example of use.. DoTVisual();
|
|
void DoTVisual()
|
|
{
|
|
object aTarget = PRCGetSpellTargetObject();
|
|
effect aVis;
|
|
int nInt;
|
|
nInt = GetObjectType(aTarget);
|
|
|
|
//This effect creates a red explosion of gas at the target object..
|
|
aVis = EffectVisualEffect(VFX_FNF_GAS_EXPLOSION_EVIL);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT, aVis, aTarget, 0.0f);
|
|
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//This function is more or less for a generic spell effect, it's intended use
|
|
//is for spells that will not run normally because you are creating your own
|
|
//version of the actual spell, this function is used for spells that are
|
|
//an area of effect. (Despite it targeting a person or location)
|
|
//Example of use in the "myhook" script.. DoAVisual(GetSpellTargetLocation());
|
|
void DoAVisual(location aLocation)
|
|
{
|
|
aLocation = GetSpellTargetLocation();
|
|
effect aVis;
|
|
|
|
//Visual Effect - Power Word Kill (cool visual :)
|
|
aVis = EffectVisualEffect(VFX_FNF_PWKILL);
|
|
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, aVis, aLocation, 0.0f);
|
|
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
//This simple function applies damage to the target based upon the level
|
|
//of the caster, note it's positive damage, so it's less likely to be resisted
|
|
//though they still are allowed to resist the spell and make a save for half!
|
|
//this function was designed for a generic application of damage for a
|
|
//generic spell effect you create in replacement of a normal spell.
|
|
//NOTE: This spell is for single target only spells!
|
|
//Example of Use in the "myhook" script, DoTDmg();
|
|
|
|
void DoTDmg()
|
|
{
|
|
object aTarget = PRCGetSpellTargetObject();
|
|
int nTType = GetObjectType(aTarget);
|
|
int aLvl = GetCasterLevel(OBJECT_SELF);
|
|
int nLvl;
|
|
int fDC;
|
|
|
|
if(aLvl<1)
|
|
{aLvl = 1;}
|
|
else
|
|
{aLvl = GetCasterLevel(OBJECT_SELF);}
|
|
|
|
//Cap the damage at 20 X Damage Dice Maximum (see below)
|
|
if(aLvl >20)
|
|
{ nLvl = 20; }
|
|
else {nLvl = GetCasterLevel(OBJECT_SELF);}
|
|
|
|
//The /2 # below represents a division of levels, if you change this # you will
|
|
//change how many times damage is multiplied right now it's 1/2 of levels..
|
|
int oLvl = nLvl;
|
|
//Damage Dice: You can change the dice to d4(2) = 2d4 / d8(1) = 1d8/ etc.
|
|
int cInt = d6(1)* oLvl;
|
|
int dInt = cInt;
|
|
int nDmg = dInt;
|
|
|
|
int aDC = aLvl - 20;
|
|
int bDC = aDC / eDC;
|
|
int cDC = GetSpellSaveDC();
|
|
int dDC = cDC + bDC;
|
|
|
|
if(bDC >0)
|
|
{
|
|
fDC = dDC;
|
|
}
|
|
|
|
else
|
|
{fDC = cDC;}
|
|
|
|
|
|
if(PRCGetMetaMagicFeat()==METAMAGIC_MAXIMIZE)
|
|
{
|
|
nDmg = 6 * oLvl; //Please change the # here if you modified the dice above.
|
|
}
|
|
if(PRCGetMetaMagicFeat()==METAMAGIC_EMPOWER)
|
|
{
|
|
nDmg = d8(oLvl);//Please change this d# if you modified the dice above.
|
|
}
|
|
|
|
effect eDmg;
|
|
eDmg = EffectDamage(nDmg, DAMAGE_TYPE_POSITIVE, DAMAGE_POWER_ENERGY);
|
|
|
|
//Check For Spell Resistance...
|
|
if(!PRCDoResistSpell(OBJECT_SELF, aTarget))
|
|
{
|
|
//If they don't make a Fortitude saving throw, apply normal dmg..
|
|
if (!FortitudeSave(aTarget, fDC, SAVING_THROW_TYPE_ALL))
|
|
{
|
|
if(!GetIsPC(aTarget) && nTType == OBJECT_TYPE_CREATURE )
|
|
DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDmg, aTarget));
|
|
}
|
|
|
|
//Otherwise they obviously made the save..
|
|
else
|
|
{
|
|
//Apply 1/2 damage only!
|
|
int oDmg = nDmg /2;
|
|
eDmg = EffectDamage(oDmg, DAMAGE_TYPE_POSITIVE, DAMAGE_POWER_ENERGY);
|
|
if(!GetIsPC(aTarget) && nTType == OBJECT_TYPE_CREATURE )
|
|
DelayCommand(1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDmg, aTarget));
|
|
}
|
|
}
|
|
|
|
//End void DoTDmg function..
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
//This function allows you do damage to all in the area of effect (huge)
|
|
//It's intended uses is within the "myhook" script to replace the effects
|
|
//of a spell that you do not wish to run normally, don't forget to use a
|
|
//visual effect as well! (See above functions)
|
|
//Example use: DoAreaDmg();
|
|
void DoAreaDmg()
|
|
{
|
|
object aTarget = PRCGetSpellTargetObject();
|
|
object bTarget;
|
|
int nTType;
|
|
location aLocation = GetSpellTargetLocation();
|
|
int aLvl = GetCasterLevel(OBJECT_SELF);
|
|
int bLvl;
|
|
int nLvl;
|
|
int fDC;
|
|
|
|
//Minimum 1 damage dice (to prevent madness!)
|
|
if(aLvl<1)
|
|
{bLvl = 1;}
|
|
else
|
|
{bLvl = GetCasterLevel(OBJECT_SELF);}
|
|
|
|
int aDC = bLvl - 20;
|
|
int bDC = aDC / eDC;
|
|
int cDC = GetSpellSaveDC();
|
|
int dDC = cDC + bDC;
|
|
|
|
if(bDC >0)
|
|
{
|
|
fDC = dDC;
|
|
}
|
|
|
|
else
|
|
{fDC = cDC;}
|
|
|
|
float fDelay = 0.8;
|
|
|
|
|
|
//Cap the damage to Level 20 X Damage Dice (See Below)
|
|
if(GetCasterLevel(OBJECT_SELF) >30)
|
|
{ nLvl = 20; }
|
|
else {nLvl = GetCasterLevel(OBJECT_SELF);}
|
|
|
|
int oLvl = nLvl;
|
|
//Damage Dice: You can change the dice to d4(2) = 2d4 / d8(1) = 1d8/ etc.
|
|
int cInt = d6(1); //Set to d6 because it's an area of effect!
|
|
int dInt = (cInt * oLvl);
|
|
int nDmg = dInt;
|
|
int mDmg = oLvl * 6;//This is the maximized dmg (adjust if you change dice above!)
|
|
int fDmg = d8(oLvl);//This is empowered dmg(adjust if you change the dice above!)
|
|
|
|
if(PRCGetMetaMagicFeat()==METAMAGIC_MAXIMIZE)
|
|
{
|
|
nDmg = mDmg; //Note you will need to change this if you change the dice above.
|
|
//ie. if you make the dice above 2d4 then make this 8 (max dmg)
|
|
}
|
|
if(PRCGetMetaMagicFeat()==METAMAGIC_EMPOWER)
|
|
{
|
|
nDmg = fDmg; //This dice is empowered (The next highest dice)
|
|
}
|
|
|
|
effect eDmg;
|
|
eDmg = EffectDamage(nDmg, DAMAGE_TYPE_POSITIVE, DAMAGE_POWER_ENERGY);
|
|
|
|
bTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, aLocation,
|
|
FALSE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
|
|
|
|
while(GetIsObjectValid(bTarget))
|
|
{
|
|
nTType = GetObjectType(bTarget);
|
|
//This effect will not be applied to the caster...
|
|
if(bTarget != OBJECT_SELF)
|
|
{
|
|
if(GetIsReactionTypeHostile(bTarget, OBJECT_SELF))
|
|
{
|
|
//If the Target doesn't resist the spell...
|
|
if(!ResistSpell(OBJECT_SELF, bTarget))
|
|
{
|
|
//Allow them a will save (casters have a better chance to save..)
|
|
if (!ReflexSave(bTarget, fDC, SAVING_THROW_TYPE_ALL))
|
|
{
|
|
if(!GetIsPC(bTarget)&& nTType == OBJECT_TYPE_CREATURE)
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDmg, bTarget));
|
|
}
|
|
|
|
//Otherwise they made the save, so do 1/2 dmg..
|
|
else
|
|
{
|
|
//Apply 1/2 damage only!
|
|
int oDmg = nDmg / 2;
|
|
eDmg = EffectDamage(oDmg, DAMAGE_TYPE_POSITIVE, DAMAGE_POWER_ENERGY);
|
|
if(!GetIsPC(bTarget) && nTType == OBJECT_TYPE_CREATURE)
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDmg, bTarget));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//Continue Loop..
|
|
bTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, aLocation,
|
|
FALSE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
|
|
}
|
|
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// DO NOT TOUCH ANYTHING BELOW THIS LINE!!! (Adjustable At Top)
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
//This function is part of the main spell hoooking script "myhook"
|
|
//You should not change anything within this script other than damage amount
|
|
void DoBonusDmg(object aTarget)
|
|
{
|
|
object aTarget = PRCGetSpellTargetObject();
|
|
int cLvl = GetCasterLevel(OBJECT_SELF);
|
|
int dLvl = cLvl -20;
|
|
int aInt = eDC -1;
|
|
int bInt = dLvl -aInt;
|
|
int aDC = GetSpellSaveDC();
|
|
int dBonus = dLvl / eDC;
|
|
int eDBon;
|
|
int eBonus;
|
|
float fDelay;
|
|
|
|
int eDam;
|
|
|
|
if(zDam ==0)
|
|
{eDam = 0; }
|
|
else if(zDam ==1)
|
|
{eDam = d4(1);}
|
|
else if(zDam ==2)
|
|
{eDam = d6(1);}
|
|
else if(zDam ==3)
|
|
{eDam = d8(1);}
|
|
else if(zDam ==4)
|
|
{eDam = d10(1);}
|
|
else if(zDam ==5)
|
|
{eDam = d12(1);}
|
|
else if(zDam ==6)
|
|
{eDam = d8(2);}
|
|
else if(zDam ==7)
|
|
{eDam = d10(2);}
|
|
else if(zDam ==8)
|
|
{eDam = d12(2);}
|
|
else if(zDam ==9)
|
|
{eDam = d20(1);}
|
|
else
|
|
{eDam = d4(1);}
|
|
|
|
if (bInt>0)
|
|
{eBonus = dBonus;
|
|
eDBon = dLvl / eBon;
|
|
}
|
|
else
|
|
{eBonus = 0;
|
|
eDBon = 0;
|
|
}
|
|
|
|
int nDmg;
|
|
|
|
int fDam = (eDam * eDBon);
|
|
int mDmg = (eDBon * 8);
|
|
int eDamg = fDam +2;
|
|
|
|
//Apply the epic DC bonus to the saving throw DC.
|
|
int nSpellDC = aDC + eBonus;
|
|
|
|
|
|
if(eDBon >0)
|
|
{
|
|
nDmg = fDam;
|
|
}
|
|
else
|
|
{
|
|
nDmg = 0;
|
|
}
|
|
|
|
|
|
if(PRCGetMetaMagicFeat()==METAMAGIC_MAXIMIZE)
|
|
{
|
|
nDmg = mDmg;
|
|
}
|
|
if(PRCGetMetaMagicFeat()==METAMAGIC_EMPOWER)
|
|
{
|
|
nDmg = eDamg;
|
|
}
|
|
|
|
effect eDmg;
|
|
eDmg = EffectDamage(nDmg, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_ENERGY);
|
|
|
|
//Check For Spell Resistance...
|
|
if(!ResistSpell(OBJECT_SELF, aTarget))
|
|
{
|
|
//Allow them a will save (casters have a better chance to save..)
|
|
if (!WillSave(aTarget, nSpellDC, SAVING_THROW_TYPE_ALL))
|
|
{
|
|
if(!GetIsPC(aTarget))
|
|
{
|
|
DelayCommand(0.9, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDmg, aTarget));
|
|
}
|
|
}
|
|
|
|
//Otherwise they made the save, so do 1/2 dmg..
|
|
else
|
|
{
|
|
//Apply 1/2 damage only!
|
|
int oDmg = nDmg / 2;
|
|
eDmg = EffectDamage(oDmg, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_ENERGY);
|
|
if(!GetIsPC(aTarget))
|
|
{
|
|
DelayCommand(0.9, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDmg, aTarget));
|
|
}
|
|
}
|
|
}
|
|
|
|
//End Prototype
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
void DoAreaBonusDmg(location aLocation)
|
|
{
|
|
object aTarget = PRCGetSpellTargetObject();
|
|
object bTarget;
|
|
aLocation = GetSpellTargetLocation();
|
|
int nTType;
|
|
int cLvl = GetCasterLevel(OBJECT_SELF);
|
|
int dLvl = cLvl - 20;
|
|
int aInt = eDC - 1;
|
|
int bInt = dLvl - aInt;
|
|
int aDC = GetSpellSaveDC();
|
|
int dBonus = dLvl / eDC;
|
|
int eDBon;
|
|
int eBonus;
|
|
float fDelay = 1.2;
|
|
|
|
|
|
if (bInt>0)
|
|
{eBonus = dBonus;
|
|
eDBon = dLvl / eBon;
|
|
}
|
|
else
|
|
{eBonus = 0;
|
|
eDBon = 0;
|
|
}
|
|
|
|
//Apply the epic DC bonus to the saving throw DC.
|
|
int nSpellDC = aDC + eBonus;
|
|
|
|
int eDam;
|
|
|
|
if(zDam ==0)
|
|
{eDam = 0; }
|
|
else if(zDam ==1)
|
|
{eDam = d4(1);}
|
|
else if(zDam ==2)
|
|
{eDam = d6(1);}
|
|
else if(zDam ==3)
|
|
{eDam = d8(1);}
|
|
else if(zDam ==4)
|
|
{eDam = d10(1);}
|
|
else if(zDam ==5)
|
|
{eDam = d12(1);}
|
|
else if(zDam ==6)
|
|
{eDam = d8(2);}
|
|
else if(zDam ==7)
|
|
{eDam = d10(2);}
|
|
else if(zDam ==8)
|
|
{eDam = d12(2);}
|
|
else if(zDam ==9)
|
|
{eDam = d20(1);}
|
|
else
|
|
{eDam = d4(1);}
|
|
|
|
int nDmg;
|
|
|
|
int fDam = (eDam * eDBon);
|
|
int mDmg = (eDBon * 8);
|
|
int eDamg = fDam +2;
|
|
|
|
|
|
if(eDBon >0)
|
|
{
|
|
nDmg = fDam;
|
|
}
|
|
else
|
|
{
|
|
nDmg = 0;
|
|
}
|
|
|
|
|
|
if(PRCGetMetaMagicFeat()==METAMAGIC_MAXIMIZE)
|
|
{
|
|
nDmg = mDmg;
|
|
}
|
|
if(PRCGetMetaMagicFeat()==METAMAGIC_EMPOWER)
|
|
{
|
|
nDmg = eDamg;
|
|
}
|
|
|
|
effect eDmg;
|
|
eDmg = EffectDamage(nDmg, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_ENERGY);
|
|
|
|
bTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, aLocation,
|
|
TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
|
|
|
|
while(GetIsObjectValid(bTarget))
|
|
{
|
|
nTType = GetObjectType(bTarget);
|
|
//Let's make sure they are a standard hostile target..
|
|
if(GetIsReactionTypeHostile(bTarget, OBJECT_SELF))
|
|
{
|
|
//If the Target doesn't resist the spell...
|
|
if(!ResistSpell(OBJECT_SELF, bTarget))
|
|
{
|
|
//Allow them a will save (casters have a better chance to save..)
|
|
if (!WillSave(bTarget, nSpellDC, SAVING_THROW_TYPE_ALL))
|
|
{
|
|
if(!GetIsPC(bTarget) && nTType == OBJECT_TYPE_CREATURE)
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDmg, bTarget, 0.0f));
|
|
}
|
|
|
|
//Otherwise they made the save, so do 1/2 dmg..
|
|
else
|
|
{
|
|
//Apply 1/2 damage only!
|
|
int oDmg = nDmg / 2;
|
|
eDmg = EffectDamage(oDmg, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_ENERGY);
|
|
if(!GetIsPC(bTarget) && nTType == OBJECT_TYPE_CREATURE)
|
|
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDmg, bTarget, 0.0f));
|
|
}
|
|
}
|
|
}
|
|
|
|
//Continue Loop..
|
|
bTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, aLocation,
|
|
FALSE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
|
|
}
|
|
|
|
//End Prototype
|
|
}
|
|
|