For some reason, the reserve feats created by Kaedrin are not working entirely correctly for me. I have adjusted them to work with different spells, but otherwise, they are the same as what Kaedrin created. I’m not a scripting slouch, thanx to kevL_s, but I just don’t understand why I am getting the results I am getting.
The first script is the Area of Effect creating script
#include "X0_I0_SPELLS"
#include "x2_inc_spellhook"
#include "cmi_ginc_chars"
int nSorcerer = GetLevelByClass(CLASS_TYPE_SORCERER, OBJECT_SELF);
int nWizard = GetLevelByClass(CLASS_TYPE_WIZARD, OBJECT_SELF);
int GetRuneFlameReserveDamageDice()
{
if ( (GetHasSpell(116)) && ((nSorcerer > 0 || nWizard > 0)) )
return 9;
if ( GetHasSpell(89) || GetHasSpell(2025) )
return 8;
if ( GetHasSpell(39) || GetHasSpell(57) || GetHasSpell(135) || GetHasSpell(2078) )
// 2078 = Warlock Invocation Instill Vulnerability
return 7;
if ( GetHasSpell(440) || GetHasSpell(446) || GetHasSpell(837) || GetHasSpell(869)
|| GetHasSpell(871) || GetHasSpell(2347) || GetHasSpell(2457) )
// 837 = Warlock Invocation Wall of Perilous Flame
return 5;
return 0;
}
void main()
{
/*
Spellcast Hook Code
Added 2003-06-20 by Georg
If you want to make changes to all spells,
check x2_inc_spellhook.nss to find out more
*/
if (!X2PreSpellCastCode())
{
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
return;
}
// End of Spell Cast Hook
if (GetRuneFlameReserveDamageDice() == 0)
{
SendMessageToPC(OBJECT_SELF,"You do not have any valid spells left that can trigger this ability.");
return;
}
//First we need to generate the string that serves as the object ID for this AOE object
string sSelf = ObjectToString(OBJECT_SELF) + IntToString(SPELLABILITY_RUNE_FLAME);
//Now we need to see if anything with this tag already exists
object oSelf = GetNearestObjectByTag(sSelf);
//If it exists, kill it.
if (GetIsObjectValid(oSelf))
{
DestroyObject(oSelf);
}
int nRuneDice = GetRuneFlameReserveDamageDice();
SendMessageToPC(GetFirstPC(FALSE), "nRuneDice = " + IntToString(nRuneDice));
//Declare major variables including Area of Effect Object
effect eAOE = EffectAreaOfEffect(AOE_RUNE_FLAME, "", "", "", sSelf );
location lTarget = GetSpellTargetLocation();
int nDuration = 6;
//Create an instance of the AOE Object using the Apply Effect function
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eAOE, lTarget, RoundsToSeconds(nDuration));
}
This script works correctly. The problem is the OnEnter Script. The same int GetRuneFlameReserveDamageDice()
, which I renamed to int GetRFReserveDamageDice()
in the OnEnter Script is returning incorrect information, thereby doing incorrect damage. I have no idea why there are 2 results for the same calculation. Can anyone propose a resolution? Here is the OnEnter script.
#include "X0_I0_SPELLS"
#include "x2_inc_spellhook"
#include "cmi_includes"
#include "cmi_ginc_chars"
int nSorcerer = GetLevelByClass(CLASS_TYPE_SORCERER, OBJECT_SELF);
int nWizard = GetLevelByClass(CLASS_TYPE_WIZARD, OBJECT_SELF);
int GetRFReserveDamageDice()
{
if ( (GetHasSpell(116)) && ((nSorcerer > 0 || nWizard > 0)) )
return 9;
if ( GetHasSpell(89) || GetHasSpell(2025) )
return 8;
if ( GetHasSpell(39) || GetHasSpell(57) || GetHasSpell(135) || GetHasSpell(2078) )
// 2078 = Warlock Invocation Instill Vulnerability
return 7;
if ( GetHasSpell(440) || GetHasSpell(446) || GetHasSpell(837) || GetHasSpell(869)
|| GetHasSpell(871) || GetHasSpell(2347) || GetHasSpell(2457) )
return 5;
return 0;
}
void main()
{
//Declare major variables
object oTarget = GetEnteringObject();
object oCaster = GetAreaOfEffectCreator();
location lTarget = GetLocation(OBJECT_SELF);
// int nDamage;
int nFire = GetLocalInt(OBJECT_SELF, "NW_SPELL_DELAY_RUNE_FIRE");
// int nRuneDice = GetRFReserveDamageDice(oCaster);
// SendMessageToPC(GetFirstPC(FALSE), "nRuneDice Base = " + IntToString(nRuneDice));
// int nDC = GetReserveSpellSaveDC(nRuneDice,oCaster);
// SendMessageToPC(GetFirstPC(FALSE), "nDC = " + IntToString(nDC));
// nRuneDice = nRuneDice * 2;
effect eDam;
effect eExplode = EffectVisualEffect(VFX_RUNE_FLAME);
effect eVis = EffectVisualEffect(VFX_IMP_FLAME_M);
//Check the faction of the entering object to make sure the entering object is not in the casters faction
if(nFire == 0)
{
// SendMessageToPC(GetFirstPC(FALSE), "Inside nFire if statement.");
// if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, OBJECT_SELF))
if (spellsIsTarget(oTarget, SPELL_TARGET_SELECTIVEHOSTILE, oCaster))
{
// SendMessageToPC(GetFirstPC(FALSE), "Inside first spellsIsTarget statement.");
SetLocalInt(OBJECT_SELF, "NW_SPELL_DELAY_RUNE_FIRE",TRUE);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eExplode, lTarget);
// SendMessageToPC(oCaster, "Rune activated with " + IntToString(nRuneDice) + "d6 power.");
// Cycle through the targets in the explosion area
oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
while(GetIsObjectValid(oTarget))
{
if (spellsIsTarget(oTarget, SPELL_TARGET_SELECTIVEHOSTILE, oCaster))
{
// Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(oCaster, SPELL_DELAYED_BLAST_FIREBALL));
{
int nRuneDice = GetRFReserveDamageDice();
SendMessageToPC(GetFirstPC(FALSE), "nRuneDice = " + IntToString(nRuneDice));
int nDamage = d6(nRuneDice * 2);
int nDC = GetReserveSpellSaveDC(nRuneDice,oCaster);
// Change damage according to Reflex, Evasion and Improved Evasion
nDamage = GetReflexAdjustedDamage(nDamage, oTarget, nDC, SAVING_THROW_TYPE_FIRE, oCaster);
// Set up the damage effect
effect eDam = EffectDamage(nDamage, DAMAGE_TYPE_FIRE);
if(nDamage > 0)
{
//Apply VFX impact and damage effect
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
DelayCommand(0.01, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget));
}
}
}
//Get next target in the sequence
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_HUGE, lTarget, TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
}
DestroyObject(OBJECT_SELF, 1.0);
}
}
}
Hopefully someone out there can figure this out. My head hurts from pounding it against the wall.