void main()
{

    int nArmed=GetLocalInt(OBJECT_SELF,"armed");
    if (nArmed==0)
    {
     return;
    }

    int iSpell = GetLastSpell();
    if (!GetLastSpellHarmful())
        return;
    // Check if a fire-spell was used
      if (iSpell ==  SPELL_BURNING_HANDS || iSpell ==   SPELL_FIRE_STORM || iSpell == SPELL_FIREBALL || iSpell == SPELL_DELAYED_BLAST_FIREBALL || iSpell == SPELL_SHADES_FIREBALL ||
        iSpell == SPELL_SHADES_WALL_OF_FIRE || iSpell == SPELL_WALL_OF_FIRE || iSpell == SPELL_FLAME_ARROW || iSpell == SPELL_FLAME_LASH ||
        iSpell == SPELL_FLAME_STRIKE || iSpell == SPELL_FLARE || iSpell == SPELL_INCENDIARY_CLOUD || iSpell == SPELL_INFERNO | iSpell == SPELL_METEOR_SWARM)
    {
        if (GetCurrentHitPoints(OBJECT_SELF) >4) // 5+ HP? Ignite
            ExecuteScript("gzcs_pkeg_ignite",OBJECT_SELF);
        else
            ExecuteScript("gz_pkeg_detonate",OBJECT_SELF);// <5 HP? Detonate!
    }
}