//::///////////////////////////////////////////////
//:: Actuvate Item Script
//:: x0_s3_portal
//:: Copyright (c) 2002 Bioware Corp.
//:://////////////////////////////////////////////
/*
    This directly teleports the user back to their last
    ANCHOR.

*/
//:://////////////////////////////////////////////

#include "jx_inc_magic"
#include "x2_inc_spellhook"

void mainSpell();
void main()
{
	AssignCommand(JXGetCaster(), mainSpell());
}

void mainSpell()
{
	if (!X2PreSpellCastCode()) { JXPostSpellCastCode(); return; }


    object oItem = GetSpellCastItem();
    object oTarget = JXGetSpellTargetObject();
    location lLocal = JXGetSpellTargetLocation();
    SetLocalInt(oTarget, "NW_L_PORTALINSTANT", 10);
    SignalEvent(GetModule(), EventActivateItem(oItem, lLocal, oTarget));

	JXPostSpellCastCode();
}
