////////////////////////////////////////////////////////////////////////////
// Real Time Strategy - NWN - Module OnActivateItem Script
//==========================================================================
// By Deva Bryson Winblood.  02/23/2003
////////////////////////////////////////////////////////////////////////////
/* This has been specially coded not to interfere with your existing OnActivate
   Item scripts.  Simply change where it says YOUR_SCRIPT_HERE in the last line
   to the name of the script that this one is replacing and it will continue
   to work as normal.  This script ONLY intercepts items that begin with rts in
   their ResRef.  All others it ignores */
// Modified 05/29/2004: blocked rts_ artifacts from working in areas with an RTS_WP_NO_ARTIFACT waypoint.  JG

void main()
{
   object oItem=GetItemActivated();
   string sRes=GetResRef(oItem);
   string sActivate=GetLocalString(oItem,"sActivate");
   object oPC=GetItemActivator();
   if (GetLocalInt(oPC,"bShiftNoActivate"))
   { // cannot activate while shifted
       if (!GetLocalInt(oItem,"bShiftAOK"))
       { // not a valid item
           SendMessageToPC(oPC,"That item cannot be activated while you are shifted.");
           return;
       } // not a valid item
   } // cannot activate while shifted
   if(GetNearestObjectByTag("RTS_WP_NO_ARTIFACT")!=OBJECT_INVALID) SendMessageToPC(GetItemActivator(), "The magic of the artifact doesn't appear to work in this place.");
    else if (GetLocalInt(GetItemActivator(),"nVampMist")!=TRUE&&GetLocalInt(GetItemActivator(),"bWZGaseous")!=TRUE)
   { // not in gaseous form
     if (GetStringLength(sActivate)>0)
     { // variable
         ExecuteScript(sActivate,OBJECT_SELF);
     } // variable
     else if (GetStringLeft(sRes,3)=="rts")
     {
       ExecuteScript(sRes,OBJECT_SELF);
     }
     else
     {
       ExecuteScript("uni_onactivateit",OBJECT_SELF);
     }
   } // not in gaseous form
}