Author Topic: Another aoe script question  (Read 340 times)

Legacy_Surek

  • Full Member
  • ***
  • Posts: 169
  • Karma: +0/-0
Another aoe script question
« on: November 05, 2014, 06:57:59 am »


               

Is there any way to turn this script into an area effect script?


I would like it to effect multiple creatures at one time.



/*   Script generated by
Lilac Soul's NWN Script Generator, v. 2.3

For download info, please visit:
http://nwvault.ign.com/View.php?view=Other.Detail&id=4683&id=625    */

void main()
{
object oPC;

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

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

oPC = GetItemActivator();

object oTarget;
oTarget = GetItemActivatedTarget();

effect eEffect;
eEffect = EffectSpellFailure(100, SPELL_SCHOOL_GENERAL);

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 60.0f);

eEffect = EffectSpellFailure(100, SPELL_SCHOOL_ABJURATION);

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 60.0f);

eEffect = EffectSpellFailure(100, SPELL_SCHOOL_CONJURATION);

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 60.0f);

eEffect = EffectSpellFailure(100, SPELL_SCHOOL_DIVINATION);

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 60.0f);

eEffect = EffectSpellFailure(100, SPELL_SCHOOL_ENCHANTMENT);

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 60.0f);

eEffect = EffectSpellFailure(100, SPELL_SCHOOL_EVOCATION);

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 60.0f);

eEffect = EffectSpellFailure(100, SPELL_SCHOOL_ILLUSION);

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 60.0f);

eEffect = EffectSpellFailure(100, SPELL_SCHOOL_NECROMANCY);

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 60.0f);

eEffect = EffectSpellFailure(100, SPELL_SCHOOL_TRANSMUTATION);

ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 60.0f);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_HOWL_WAR_CRY), oPC);

}


               
               

               
            

Legacy_Terrorble

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
Another aoe script question
« Reply #1 on: November 05, 2014, 04:23:51 pm »


               

Yes, it can be made as an AoE.


 


I added comments in the code.  It does compile, but I didn't test it... and I'm definitely out of practice atm.  So, if something doesn't work, let me know.


 


void main()
{
    object oPC;
 
if ((GetObjectType(GetItemActivatedTarget())!=OBJECT_TYPE_CREATURE))
{
    SendMessageToPC(GetItemActivator(), "Improper use of item!");
    return;
}
 
    oPC = GetItemActivator();
 
    object oTarget;
    oTarget = GetItemActivatedTarget();
 
effect eEffect;
//I'm not certain, but I think granting 100% spell failure to SPELL_SCHOOL_GENERAL
//covers all the schools at once.
eEffect = EffectSpellFailure(100, SPELL_SCHOOL_GENERAL);
 
 
//I'm making a glow visual effect that will be tied to the spell failure effect
//so that you can see visually that the effect is applied
effect eGlow = EffectVisualEffect(VFX_DUR_GLOW_PURPLE);
//Linking effects means that when one effect ends, so does the other.
//And, it allows you to link multiple effects together and apply them with a single statement
//instead of separately
effect eLink = EffectLinkEffects(eEffect,eGlow);
 
 
 
//I'll get the target's location to use as the center of the AoE
location lTarget = GetLocation(oTarget);
 
 
 
//re-using oTarget variable
oTarget = GetFirstObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_HUGE/*you can put a number here too, like 12.0 or whatever*/,
lTarget,FALSE,OBJECT_TYPE_CREATURE);
 
//Loop thru all CREATURE-type targets in a sphere with radius size HUGE
while(GetIsObjectValid(oTarget))
{
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, 60.0f);
 
  oTarget = GetNextObjectInShape(SHAPE_SPHERE,RADIUS_SIZE_HUGE,lTarget,FALSE,OBJECT_TYPE_CREATURE);
}
 
 
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_HOWL_WAR_CRY), oPC);
 
 
}