// A series of scripts "pcbanner6-10" which is fired on the death of a Helm Banner
void main()
{
// Respawn Horde Banner
    location loc = GetLocation(OBJECT_SELF);
    CreateObject(OBJECT_TYPE_PLACEABLE, "hordebanner009", loc, TRUE);
    CreateObject(OBJECT_TYPE_PLACEABLE, "unholylight", loc, TRUE);
    DestroyObject(GetNearestObjectByTag("MagicSparksWhite"));

    SoundObjectStop(GetObjectByTag("MagicCrystalGood9"));
    SoundObjectPlay(GetObjectByTag("MagicPortalEvil9"));

// Respawn Outpost dependent creatures if not already alive
    object oPrimaryNPC = GetObjectByTag("Henrick");
    if(!(GetLocalInt(oPrimaryNPC, "nWarlordDead") == 1))
    {

    loc = GetLocation(GetObjectByTag("spawnwight9"));

    object oCreature = GetObjectByTag("ms_spawnwight9");
    if(!(GetCurrentHitPoints(oCreature) > 0))
    {
        CreateObject(OBJECT_TYPE_CREATURE, "wightscout009", loc, TRUE);
    }

    oCreature = GetObjectByTag("ms_spawnghastscout9");
    if(!(GetCurrentHitPoints(oCreature) > 0))
    {
        CreateObject(OBJECT_TYPE_CREATURE, "ghastscout009", loc, TRUE);
    }

// Calculate average PC level
    int nChallenge = GetFactionAverageLevel(GetFirstPC());

    int nCreatureFactor;
    int nIdx;


// Spawn in 3 creatures
    for (nIdx = 1; nIdx <= 2; nIdx++)
    {
        nCreatureFactor = (d20()+ nChallenge);

        if(nCreatureFactor > 25)
        {
            loc = GetLocation(GetObjectByTag("spawndevourer9"));
        oCreature = GetObjectByTag("ms_spawndevourer9");
        if(!(GetCurrentHitPoints(oCreature) > 0))
            {
            CreateObject(OBJECT_TYPE_CREATURE, "skeldevour009", loc, TRUE);
            }
        }

        else if(nCreatureFactor > 20)
        {
            loc = GetLocation(GetObjectByTag("spawnwarmum9"));
        oCreature = GetObjectByTag("ms_spawnwarmum9");
        if(!(GetCurrentHitPoints(oCreature) > 0))
            {
            CreateObject(OBJECT_TYPE_CREATURE, "warmum009", loc, TRUE);
            }
        }
        else if(nCreatureFactor > 15)
        {
            loc = GetLocation(GetObjectByTag("spawnwarr9"));
        oCreature = GetObjectByTag("ms_spawnwarr9");
        if(!(GetCurrentHitPoints(oCreature) > 0))
            {
            CreateObject(OBJECT_TYPE_CREATURE, "skelwarr009", loc, TRUE);
            }
        }
        else if(nCreatureFactor > 10)
        {
            loc = GetLocation(GetObjectByTag("spawnspectre9"));
        oCreature = GetObjectByTag("ms_spawnspectre9");
        if(!(GetCurrentHitPoints(oCreature) > 0))
            {
            CreateObject(OBJECT_TYPE_CREATURE, "spectre009", loc, TRUE);
            }
        }
        else
        {
            loc = GetLocation(GetObjectByTag("spawnwraith9"));
        oCreature = GetObjectByTag("ms_spawnwraith9");
        if(!(GetCurrentHitPoints(oCreature) > 0))
            {
            CreateObject(OBJECT_TYPE_CREATURE, "wraith009", loc, TRUE);
            }
        }

    }
    }
}

