// 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, "hordebanner008", loc, TRUE);
    CreateObject(OBJECT_TYPE_PLACEABLE, "unholylight", loc, TRUE);
    DestroyObject(GetNearestObjectByTag("MagicSparksWhite"));

    SoundObjectStop(GetObjectByTag("MagicCrystalGood8"));
    SoundObjectPlay(GetObjectByTag("MagicPortalEvil8"));

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

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

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

    oCreature = GetObjectByTag("ms_spawnghastscout8");
    if(!(GetCurrentHitPoints(oCreature) > 0))
    {
        CreateObject(OBJECT_TYPE_CREATURE, "ghastscout008", 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("spawndevourer8"));
        oCreature = GetObjectByTag("ms_spawndevourer8");
        if(!(GetCurrentHitPoints(oCreature) > 0))
            {
            CreateObject(OBJECT_TYPE_CREATURE, "skeldevour008", loc, TRUE);
            }
        }

        else if(nCreatureFactor > 20)
        {
            loc = GetLocation(GetObjectByTag("spawnwarmum8"));
        oCreature = GetObjectByTag("ms_spawnwarmum8");
        if(!(GetCurrentHitPoints(oCreature) > 0))
            {
            CreateObject(OBJECT_TYPE_CREATURE, "warmum008", loc, TRUE);
            }
        }
        else if(nCreatureFactor > 15)
        {
            loc = GetLocation(GetObjectByTag("spawnwarr8"));
        oCreature = GetObjectByTag("ms_spawnwarr8");
        if(!(GetCurrentHitPoints(oCreature) > 0))
            {
            CreateObject(OBJECT_TYPE_CREATURE, "skelwarr008", loc, TRUE);
            }
        }
        else if(nCreatureFactor > 10)
        {
            loc = GetLocation(GetObjectByTag("spawnspectre8"));
        oCreature = GetObjectByTag("ms_spawnspectre8");
        if(!(GetCurrentHitPoints(oCreature) > 0))
            {
            CreateObject(OBJECT_TYPE_CREATURE, "spectre008", loc, TRUE);
            }
        }
        else
        {
            loc = GetLocation(GetObjectByTag("spawnwraith8"));
        oCreature = GetObjectByTag("ms_spawnwraith8");
        if(!(GetCurrentHitPoints(oCreature) > 0))
            {
            CreateObject(OBJECT_TYPE_CREATURE, "wraith008", loc, TRUE);
            }
        }

    }
    }
}

