// Clears all actions and jumps the caller to the provided object.
// (Useful when this needs to be delayed.)
void ClearAndJumpToObject(object oDestination);

void ClearAndJumpToObject(object oDestination)
{
    ClearAllActions();
    JumpToObject(oDestination);
}


void main()
{
    effect eVFX;
    object oTarget;

    // Get the creature who triggered this event.
    object oPC = GetLastUsedBy();

    // Find the location to which to teleport.
    oTarget = GetWaypointByTag("WP_PIRATE01");

    // Teleport the PC.
    eVFX = EffectVisualEffect(VFX_IMP_UNSUMMON);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oPC);
    DelayCommand(1.0, AssignCommand(oPC, ClearAndJumpToObject(oTarget)));
}