Author: Rysong
Author Website: n/a
Script Name: Teleport Away
Description: Causes an object to teleport away, destroying itself and creating visual effects in the location the object was at.
Instructions on Use: Include this function in your script and call it to cause the object passed in appear to cast a gate spell and then the object is destroyed. You could modify it to teleport the object elsewhere and/or use different spell effects.

Script 1:

void gateAwayWithStyle(object oLeaving = OBJECT_SELF)

{

    location lTarget = GetLocation(oLeaving);

    ActionCastFakeSpellAtObject(SPELL_MINOR_GLOBE_OF_INVULNERABILITY, oLeaving);

    effect eGate = EffectVisualEffect(VFX_FNF_SUMMON_GATE);

    ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eGate, lTarget, 5.0);

    DestroyObject(oLeaving, 1.0);

    effect eSummon = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);

    DelayCommand(1.0, ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eSummon, lTarget, 5.0));

    effect eFireball = EffectVisualEffect(VFX_FNF_FIREBALL);

    DelayCommand(2.0, ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eFireball, lTarget, 5.0));

    effect eLight = EffectVisualEffect(VFX_DUR_LIGHT_RED_20);

    DelayCommand(5.0, ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eLight, lTarget, 60.0));

}