Author Topic: area effect spell script help  (Read 307 times)

Legacy_Surek

  • Full Member
  • ***
  • Posts: 169
  • Karma: +0/-0
area effect spell script help
« on: April 10, 2014, 07:29:57 am »


               

I was hopeing to get some help with this script it works fine but the only thing I need it to do now is stop healing the monsters and just heal the PCs in the area effect.  any help would be great.


 


Here is the script i'm using.


 


 


 


const float EFFECT_RADIUS = 10.0;

void main()

{

object oPC     = GetItemActivator();

 

 

    effect   eDamage = EffectHeal(30);

    effect   eVisual = EffectVisualEffect(VFX_FNF_LOS_HOLY_10);

    effect   eEffect = EffectLinkEffects(eVisual, eDamage);

    location lTarget = GetLocation(oPC);

    oPC = GetFirstObjectInShape(SHAPE_SPHERE, EFFECT_RADIUS, lTarget);

    while (GetIsObjectValid(oPC))    {ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC);

        oPC = GetNextObjectInShape(SHAPE_SPHERE, EFFECT_RADIUS, lTarget);    }}

 


               
               

               
            

Legacy_Vincent07

  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
area effect spell script help
« Reply #1 on: April 10, 2014, 07:35:24 am »


               

Easy, just adjust the While to this:


 


while(GetIsObjectValid(oPC) && GetIsPC(oPC))



               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
area effect spell script help
« Reply #2 on: April 10, 2014, 09:04:23 am »


               

No, that's a bad idea -- because then the loop would cancel as soon as it found a non-PC.


 


Try something like this:



const float EFFECT_RADIUS = 10.0;

void main()
{
    object oPC     = GetItemActivator();

    effect   eDamage = EffectHeal(30);
    effect   eVisual = EffectVisualEffect(VFX_FNF_LOS_HOLY_10);
    effect   eEffect = EffectLinkEffects(eVisual, eDamage);
    location lTarget = GetLocation(oPC);
    oPC = GetFirstObjectInShape(SHAPE_SPHERE, EFFECT_RADIUS, lTarget);

    while (GetIsObjectValid(oPC))
    {
        if (GetIsPC(oPC))
        {
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC);
        }

        oPC = GetNextObjectInShape(SHAPE_SPHERE, EFFECT_RADIUS, lTarget);
    }
}