//This is the default header for most items converted to the new
//tagbased system.
//Remember to create 2 scripts, one using the template, and name this
//script ac_"tagnameofitemgoeshere"  (without the "")

#include "x2_inc_switches"
void main()
{
    // Check if we have the correct event firing the script
    if (GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return;

object oPC;

if (!GetIsDM(GetItemActivator())
){

SendMessageToPC(GetItemActivator(), "You are not a DM!!!");
return;}

effect eEffect;
eEffect = EffectDamage(5000, DAMAGE_TYPE_POSITIVE, DAMAGE_POWER_ENERGY);

DelayCommand(5.0, 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_FNF_UNDEAD_DRAGON), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_UNDEAD_DRAGON), GetLocation(oTarget));

//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

nInt = GetObjectType(oTarget);

eEffect = EffectVisualEffect(VFX_IMP_DESTRUCTION);

if (nInt != OBJECT_TYPE_WAYPOINT)
   DelayCommand(4.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget));
else
   DelayCommand(4.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eEffect, GetLocation(oTarget)));

}