I am working on a custom spell script that delivers "damage type" based upon the caster's alignment in the form of a ranged touch attack. I used acid splash as a frame for my spell but it still will not produce the ranged touch attack. Can someone take a look and tell me what part am I doing wrong?
#include "X0_I0_SPELLS"
#include "x2_inc_spellhook"
#include "nwn2_inc_spells"
object oPC = OBJECT_SELF;
int IsEvil(object oPC)
{
object oPC = GetPCSpeaker();
if (GetAlignmentGoodEvil(oPC) != ALIGNMENT_EVIL) return FALSE;
return TRUE;
}
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
//Declare major variables
object oTarget = GetSpellTargetObject();
int nCasterLevel = GetCasterLevel(OBJECT_SELF);
int nTouch = TouchAttackRanged(oTarget);
effect eVis;
effect eVis1;
effect eVis2;
effect eBolt;
effect eSide;
int nWIS = GetAbilityModifier(ABILITY_WISDOM, OBJECT_SELF);
int nDamage;
if (IsEvil(oPC)<1)
{
eBolt = EffectDamage(nDamage, DAMAGE_TYPE_NEGATIVE);
effect eVis = EffectVisualEffect(VFX_IMP_NEGATIVE_ENERGY);
effect eVis1 = EffectVisualEffect(VFX_DUR_SPELL_ENERGY_DRAIN);
effect eVis2 = EffectLinkEffects(eVis, eVis1);
eSide = ExtraordinaryEffect(EffectAbilityDecrease(ABILITY_STRENGTH, nWIS));
return;
}
else
{
eBolt = EffectDamage(nDamage, DAMAGE_TYPE_POSITIVE);
effect eVis = EffectVisualEffect(VFX_IMP_MAGBLUE);
effect eVis1 = EffectVisualEffect(VFX_DUR_SPELL_DAZE);
effect eVis2 = EffectLinkEffects(eVis, eVis1);
eSide = ExtraordinaryEffect(EffectDazed());
return;
}
if (spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, OBJECT_SELF))
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, 424));
if (nTouch != TOUCH_ATTACK_RESULT_MISS)
{
//Make SR Check
if(!MyResistSpell(OBJECT_SELF, oTarget))
{
//Set damage effect
int nDamage = (d10(1) + (nWIS + nCasterLevel/2));
nDamage = ApplyMetamagicVariableMods(nDamage, 3);
if (nTouch == TOUCH_ATTACK_RESULT_CRITICAL && !GetIsImmune(oTarget, IMMUNITY_TYPE_CRITICAL_HIT))
{
nDamage = nDamage*2;
nDamage = ApplyMetamagicVariableMods(nDamage, 6);
}
ApplyEffectToObject(DURATION_TYPE_INSTANT, eBolt, oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis2, oTarget);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSide, oTarget, RoundsToSeconds(nWIS));
}
}
}
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
}