void CreateObject2(int nObjectType, string sTemplate, location lLocation, int bUseAppearAnimation=TRUE);

void main()
{
    if (GetNearestObjectByTag("GLAC_DEMON", OBJECT_SELF) == OBJECT_INVALID){
        object oLoser = GetLastKiller();
        object oAreaP = GetArea (GetWaypointByTag("GLAC_PORT"));
        vector vPositionP = GetPosition (GetWaypointByTag("GLAC_PORT"));
        float fOrientationP = GetFacing (GetWaypointByTag("GLAC_PORT"));
        location lSpawnP = Location (oAreaP, vPositionP, fOrientationP);
        AssignCommand(oLoser, ClearAllActions(TRUE));
        string sText;
        sText = "Aaargh!  The spell was not completed properly!";
        ActionSpeakString (sText, TALKVOLUME_TALK);
        AssignCommand(oLoser, ClearAllActions(TRUE));
        AssignCommand(oLoser, DelayCommand(4.0, ApplyEffectAtLocation(DURATION_TYPE_PERMANENT, EffectVisualEffect(VFX_IMP_LIGHTNING_M), lSpawnP)));
        AssignCommand(oLoser, DelayCommand(5.0, CreateObject2(OBJECT_TYPE_CREATURE, "glacdemon", lSpawnP, FALSE)));}
     else {
        //Do Nothing
        }
}

void CreateObject2(int nObjectType, string sTemplate, location lLocation, int bUseAppearAnimation=TRUE)
{
    CreateObject(nObjectType, sTemplate, lLocation, bUseAppearAnimation);
    return;
}