I'm trying to alter mass haste, I think this should work.. as I've done very similar things and they've worked fine(other spells items)
For some reason this code isn't catching that my character has sf, gsf and esf spell focus enchantment, so the extra bonuses I added don't go through.
//::///////////////////////////////////////////////
//:: Mass Haste
//:: NW_S0_MasHaste.nss
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
All allies in a 30 ft radius from the point of
impact become Hasted for 1 round per caster
level. The maximum number of allies hasted is
1 per caster level.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: May 29, 2001
//:://////////////////////////////////////////////
#include "NW_I0_SPELLS"
#include "x2_inc_spellhook"
void main()
{
/*
Spellcast Hook Code
Added 2003-06-23 by GeorgZ
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;
effect eHaste = EffectHaste();
effect eVis = EffectVisualEffect(VFX_IMP_HASTE);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
effect eLink = EffectLinkEffects(eHaste, eDur);
effect eImpact = EffectVisualEffect(VFX_FNF_LOS_NORMAL_30);
//**************************NEW CHANGES HERE 4/17/2016******************************
object oSelf = OBJECT_SELF;
//set variables to 0
int iConceal = 0;
int iBonusAPR = 0;
int iSpeed = 0;
// declare effects for bonus APR, speed and concealment, incremented by sf's
effect eSwing = EffectModifyAttacks(iBonusAPR);
effect eMoveSpeed = EffectMovementSpeedIncrease(iSpeed);
effect eConceal = EffectConcealment(iConceal, MISS_CHANCE_TYPE_NORMAL);
//if has sf, grant bonus
if(GetHasFeat(FEAT_EPIC_SPELL_FOCUS_ENCHANTMENT, oSelf))
{
iConceal = iConceal + 10;
iSpeed = iSpeed + 5;
iBonusAPR = iBonusAPR + 1;
}
if(GetHasFeat(FEAT_GREATER_SPELL_FOCUS_ENCHANTMENT, oSelf))
{
iConceal = iConceal + 10;
iSpeed = iSpeed + 5;
}
if(GetHasFeat(FEAT_SPELL_FOCUS_ENCHANTMENT, oSelf))
{
iConceal = iConceal + 10;
iSpeed = iSpeed + 5;
}
// link all the effects together
effect eLink2 = EffectLinkEffects(eConceal, eSwing);
eLink2 = EffectLinkEffects(eLink2, eConceal);
eLink2 = EffectLinkEffects(eLink2, eMoveSpeed);
//**************************NEW CHANGES HERE 4/17/2016******************************
int nMetaMagic = GetMetaMagicFeat();
float fDelay;
//Determine spell duration as an integer for later conversion to Rounds, Turns or Hours.
int nDuration = GetCasterLevel(OBJECT_SELF);
int nCount;
location lSpell = GetSpellTargetLocation();
//Meta Magic check for extend
if (nMetaMagic == METAMAGIC_EXTEND)
{
nDuration = nDuration *2; //Duration is +100%
}
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eImpact, GetSpellTargetLocation());
//Declare the spell shape, size and the location. Capture the first target object in the shape.
oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, lSpell);
//Cycle through the targets within the spell shape until an invalid object is captured or the number of
//targets affected is equal to the caster level.
while(GetIsObjectValid(oTarget) && nCount != nDuration)
{
//Make faction check on the target
if(GetIsFriend(oTarget))
{
fDelay = GetRandomDelay(0.0, 1.0);
//Fire cast spell at event for the specified target
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_MASS_HASTE, FALSE));
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(nDuration)));
// new link effect added here, "eLink2"
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink2, oTarget, RoundsToSeconds(nDuration)));
// new link effect added here, "eLink2"
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
nCount++;
}
//Select the next target within the spell shape.
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, lSpell);
}
}