Author Sticky: Post Working Scripts Here
Judas Ace Posted: Monday, 01 July 03:09AM
This goes in the OnUsed section, it checks on the ground nearby for a certain item, then plays an effect and rewards experience, then destrys the item, once per player.

I'd rather it did pretty much the same thing, but instead of checking on the ground, it checked in its inventory after a player used it, if anyone can show me how to make it do that (with still being do only once, destrying the object and all that).

NWScript:
void main()

{

   if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0)

    {

       return;

    }

   object oObject;

   string oObjectTag;

   oObject=GetNearestObjectByTag("TEST", OBJECT_SELF, 1);

   if (GetIsObjectValid(oObject) == TRUE && GetDistanceToObject(oObject) < 5.0)

   {

   effect eMind = EffectVisualEffect(VFX_FNF_WAIL_O_BANSHEES);

   ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eMind, GetLocation(OBJECT_SELF), 0.0);

   DestroyObject(oObject, 0.0);

   {

   object oCreature = GetLastUsedBy();

   GiveXPToCreature (oCreature, 10000);

   SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1);

   }

   }

   }