Not to commit thread necromancy, or anything. But I'm also using this script, and when using it, I have it as..
#include "NW_I0_SPELLS"
#include "x2_inc_spellhook"
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
object oTarget = GetSpellTargetObject();
int nTouch = TouchAttackRanged(oTarget);
int nAC =GetAC(oTarget);
if(GetTag(GetSpellCastItem()) == "warlock_staff")
{
if (nTouch > nAC )
{
int nDam = d8(GetLevelByclass(class_TYPE_SORCERER)/2);
effect eDam = EffectDamage(nDam, DAMAGE_TYPE_NEGATIVE);
effect eRay = EffectBeam(VFX_BEAM_EVIL, OBJECT_SELF, BODY_NODE_HAND);
//Apply the VFX impact and damage effect
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_MAGBLUE), oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eRay, oTarget, 1.7);
return;
}
}
//Declare major variables
int nMetaMagic = GetMetaMagicFeat();
int nCasterLevel = GetCasterLevel(OBJECT_SELF);
int nDam = d4(1) + 1;
effect eDam;
effect eVis = EffectVisualEffect(VFX_IMP_FROST_S);
effect eRay = EffectBeam(VFX_BEAM_COLD, OBJECT_SELF, BODY_NODE_HAND);
if(!GetIsReactionTypeFriendly(oTarget))
{
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_RAY_OF_FROST));
eRay = EffectBeam(VFX_BEAM_COLD, OBJECT_SELF, BODY_NODE_HAND);
//Make SR Check
if(!MyResistSpell(OBJECT_SELF, oTarget))
{
//Enter Metamagic conditions
if (nMetaMagic == METAMAGIC_MAXIMIZE)
{
nDam = 5 ;//Damage is at max
}
else if (nMetaMagic == METAMAGIC_EMPOWER)
{
nDam = nDam + nDam/2; //Damage/Healing is +50%
}
//Set damage effect
eDam = EffectDamage(nDam, DAMAGE_TYPE_COLD);
//Apply the VFX impact and damage effect
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
}
}
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eRay, oTarget, 1.7);
}
Problem is, it's hitting all the time no matter what. I'm trying to get the beam only hit on ranged touch attacks. Help please?
Modifié par WhenTheNightComes, 14 mars 2013 - 09:12 .