#include "nw_i0_plot"
void main()
{

object oPC = GetPCSpeaker();

SetPLocalInt(oPC, "intCrystalDestroyed", 1);

object oTarget;
oTarget = GetObjectByTag("CrystalWalls");

//Visual effects can't be applied to waypoints, so if it is a WP
//apply to the WP's location instead

int nInt;
nInt = GetObjectType(oTarget);

if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_DISPEL_GREATER), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_DISPEL_GREATER), GetLocation(oTarget));

oTarget = GetObjectByTag("CrystalWalls");

DestroyObject(oTarget, 3.0);

}
