
#include "nw_i0_generic"
//#include "nw_i0_2q4luskan"

void main()
{
    object oTarget;

    // Get the PC who is in this conversation.
    object oPC = GetPCSpeaker();

    // Spawn "shadow001".

    SetLocalInt(GetPCSpeaker(), "eressearitual", 1);

    oTarget =  GetWaypointByTag("WP_Portal_Spawnpoint");

    ActionCastFakeSpellAtObject(VFX_FNF_DISPEL, GetObjectByTag("MysteriousPortal"));

    DelayCommand(6.0, AssignCommand(CreateObject(OBJECT_TYPE_CREATURE, "nw_shadow", GetLocation(oTarget)),
                                    DetermineCombatRound(oPC)));


     DelayCommand(9.0, AssignCommand(CreateObject(OBJECT_TYPE_CREATURE, "nw_shadow", GetLocation(oTarget)),
                                   DetermineCombatRound(oPC)));


     DelayCommand(12.0, AssignCommand(CreateObject(OBJECT_TYPE_CREATURE, "nw_shadow", GetLocation(oTarget)),
                                    DetermineCombatRound(oPC)));

     DelayCommand(15.0, ActionCastFakeSpellAtObject(VFX_FNF_DISPEL, GetObjectByTag("MysteriousPortal")));



     DelayCommand(42.0, AssignCommand(CreateObject(OBJECT_TYPE_CREATURE, "nw_shmastif", GetLocation(oTarget)),
                                   DetermineCombatRound(oPC)));


     DelayCommand(45.0, AssignCommand(CreateObject(OBJECT_TYPE_CREATURE, "nw_shadow", GetLocation(oTarget)),
                                    DetermineCombatRound(oPC)));


     DelayCommand(50.0, ActionCastFakeSpellAtObject(VFX_FNF_DISPEL, GetObjectByTag("MysteriousPortal")));


     DelayCommand(75.0, AssignCommand(CreateObject(OBJECT_TYPE_CREATURE, "nw_shfiend", GetLocation(oTarget)),
                                   DetermineCombatRound(oPC)));


     DelayCommand(100.0, ActionCastFakeSpellAtObject(VFX_FNF_DISPEL, GetObjectByTag("MysteriousPortal")));



     DelayCommand(125.0, ActionCastFakeSpellAtObject(VFX_FNF_DISPEL, GetObjectByTag("MysteriousPortal")));


     DelayCommand (132.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_STRIKE_HOLY), GetObjectByTag("MysteriousPortal")));
     DelayCommand(135.0, AssignCommand(GetObjectByTag("MysteriousPortal"), DestroyObject(OBJECT_SELF)));
     DelayCommand(135.0, AssignCommand(GetObjectByTag("MagicPortalEvilElminster"), DestroyObject(OBJECT_SELF)));


     DelayCommand(135.0, AddJournalQuestEntry("MysteriousPortal", 2, oPC));
}

