Author Topic: More fun with Area of Effects...  (Read 312 times)

Legacy_Ivanovich

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
More fun with Area of Effects...
« on: June 30, 2011, 08:06:44 pm »


               So I am trying to design an AOE that goes into effect once an item is equipped.  I have "ExecuteScript("scriptname", GetPCItemLastEquippedBy(); in the "on player equip" section of the module, referencing the tag of the item (in the case, a shield).

When the shield is equipped it is supposed to create an AreaOfEffect around the player equipping it.  The AOE is to move around with the player.  However, as the player moves around, no NPCs seem affected by it.  I was wondering if someone can tell why.

The item's script is:

void main()
{
object oPC = OBJECT_SELF;
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectAreaOfEffect(AOE_PER_INVIS_SPHERE, "spellabsorbent", "test", "spellabsorbex"), oPC);
}

with OBJECT_SELF being passed as the player from the onequip script.

The AOE enter script is:

#include "nw_i0_plot"

void main()
{
object oPC = GetEnteringObject();
effect eEffect = GetFirstEffect(oPC);

    while(GetIsEffectValid(eEffect))
    {
    RemoveEffect(oPC, eEffect);
    eEffect = GetNextEffect(oPC);
    }

ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_DISPEL), oPC, 1.0);
AssignCommand(oPC, ActionSpeakString("I entered the effect!", TALKVOLUME_SHOUT));
}

the last line is entered for debugging purposes.  But no NPC shouts that they've entered into the effect, nor do they experience the remove effect part.

Anyone?  Bueller?

TIA.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
More fun with Area of Effects...
« Reply #1 on: June 30, 2011, 08:25:22 pm »


               

 void main()
{
object oPC = OBJECT_SELF;
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectAreaOfEffect(AOE_PER_INVIS_SPHERE, "spellabsorbent", "test", "spellabsorbex"), oPC);
}



IF this is running in an onEquip event then the script in running on the module.(OBJECT_SELF). 
So your script is applying the area of effect to the module.  Use GetItemLastEquiptedBy or whatever it is to get the PC equiping the item.
               
               

               


                     Modifié par Lightfoot8, 30 juin 2011 - 07:26 .
                     
                  


            

Legacy_Ivanovich

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
More fun with Area of Effects...
« Reply #2 on: July 01, 2011, 02:43:50 am »


               I thought that is what I did.  I am calling the script with ExecuteScript("scriptname", GetPCItemLastEquippedBy()); and hence, in "scriptname" isn't OBJECT_SELF the PC automatically??
               
               

               
            

Legacy_Ivanovich

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
More fun with Area of Effects...
« Reply #3 on: July 01, 2011, 12:21:04 pm »


               I changed the OBJECT_SELF in the script to GetPCLastEquippedBy and nothing changed.  As I thought, it's already bringing in the pc who last equipped an item.

Anyone else have a suggestion?
               
               

               
            

Legacy_Ivanovich

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
More fun with Area of Effects...
« Reply #4 on: July 01, 2011, 01:27:05 pm »


               What I've figured out through debugging is that - for some reason - the AOE goes up and instantly down.  It does not remain in effect, though I cannot figure out why.

Just goes into effect for a split second before removing itself permanently.
               
               

               


                     Modifié par Ivanovich, 01 juillet 2011 - 01:05 .
                     
                  


            

Legacy_Ivanovich

  • Full Member
  • ***
  • Posts: 142
  • Karma: +0/-0
More fun with Area of Effects...
« Reply #5 on: July 01, 2011, 03:28:16 pm »


               I solved it.  When I was removing effects, I was removing the effect I had created as well.  Disregard, thanks.