Author Topic: AOE script help  (Read 326 times)

Legacy_Surek

  • Full Member
  • ***
  • Posts: 169
  • Karma: +0/-0
AOE script help
« on: July 15, 2013, 05:23:55 am »


                I was hoping I could get some help with this, I was wondering
if I could turn this working script into an AOE damage script so it hits multiple
targets at the same time and if so how do I go about doing this. If it’s
possible

void main()

{

object oPC;

 

if
((GetObjectType(GetItemActivatedTarget())!=OBJECT_TYPE_CREATURE)

){

 

SendMessageToPC(GetItemActivator(), "Improper use of
item!");

return;}

 

effect eEffect;

eEffect = EffectDamage(100, DAMAGE_TYPE_DIVINE,
DAMAGE_POWER_NORMAL);

 

ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect,
GetItemActivatedTarget());

 

object oTarget;

oTarget = GetItemActivatedTarget();

 

//Visual effects can't be applied to waypoints, so if it is
a WP

//the VFX will be applied to the WP's location instead

 

int nInt;

nInt = GetObjectType(oTarget);

 

if (nInt != OBJECT_TYPE_WAYPOINT)
ApplyEffectToObject(DURATION_TYPE_INSTANT,
EffectVisualEffect(VFX_IMP_HEALING_L), oTarget);

else ApplyEffectAtLocation(DURATION_TYPE_INSTANT,
EffectVisualEffect(VFX_IMP_HEALING_L), GetLocation(oTarget));

 

}
               
               

               
            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
AOE script help
« Reply #1 on: July 15, 2013, 07:02:06 am »


               Try this:

const float EFFECT_RADIUS = 10.0;

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

    if (GetObjectType(oTarget) != OBJECT_TYPE_CREATURE)
    {
        SendMessageToPC(oPC, "Improper use of item!");
        return;
    }

    effect   eDamage = EffectDamage(100, DAMAGE_TYPE_DIVINE);
    effect   eVisual = EffectVisualEffect(VFX_IMP_HEALING_L);
    effect   eEffect = EffectLinkEffects(eVisual, eDamage);
    location lTarget = GetLocation(oTarget);

    oTarget = GetFirstObjectInShape(SHAPE_SPHERE, EFFECT_RADIUS, lTarget);

    while (GetIsObjectValid(oTarget))
    {
        if (GetIsEnemy(oTarget, oPC))
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);

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

Change EFFECT_RADIUS to however far from the target you want the AoE to reach.
               
               

               


                     Modifié par Squatting Monk, 15 juillet 2013 - 06:11 .
                     
                  


            

Legacy_Surek

  • Full Member
  • ***
  • Posts: 169
  • Karma: +0/-0
AOE script help
« Reply #2 on: July 15, 2013, 07:18:55 am »


               Thank You Squatting Monk it works great.