Author Topic: altering mass haste  (Read 710 times)

Legacy_Imperator

  • Full Member
  • ***
  • Posts: 128
  • Karma: +0/-0
altering mass haste
« on: April 18, 2016, 11:27:50 pm »


               

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);

    }

}

 



               
               

               
            

Legacy_LoA_Tristan

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
altering mass haste
« Reply #1 on: April 19, 2016, 05:30:39 am »


               It's probably that eSwing, eMoveSpeed, and eConceal need to be redefined with the new values after checking for the feats; they are using the original definitions,
int iConceal = 0;
int iBonusAPR = 0;
int iSpeed = 0;
               
               

               
            

Legacy_Imperator

  • Full Member
  • ***
  • Posts: 128
  • Karma: +0/-0
altering mass haste
« Reply #2 on: April 19, 2016, 06:24:46 pm »


               

Thanks for the reply, I'll try that out.



               
               

               
            

Legacy_Imperator

  • Full Member
  • ***
  • Posts: 128
  • Karma: +0/-0
altering mass haste
« Reply #3 on: April 19, 2016, 07:10:44 pm »


               

Thank you so much, I feel dumb. '<img'>