//Poison Mummy v1.0 by Renounce4: Edited by Clubber
for(var m = 0;m <spawnedEntities.length;m++) {
	var ent = spawnedEntities[m]
	var epos = ent.getPosition()
	var elokvec = ent.getLookVec()
	var poicx = epos.x+(elokvec.x*PoisonMummy_Range)
	var poicy = epos.y+(elokvec.y*PoisonMummy_Range)
	var poicz = epos.z+(elokvec.z*PoisonMummy_Range)
	rand = Math.random()*100
	if((rand <= PoisonMummy_Chance && plength <= 0) || plength > 0) {
		if(plength <= 0) {
			pchange()
		}
		plength--
		PoisonSpray(poicx,poicy,poicz,PoisonMummy_Range,ent,PoisonMummy_Poison)
	}
}

for (var i = 0; i < spawnedEntities.length; i++) {
    var ent = spawnedEntities[i];
    if (!ent.isAlive()) {
        if (k[i] < 10) {
            var drops = ent.getEntitiesWithinRange(1);
            for (var j = 0; j < drops.length; j++) {
                if (drops[j].getClassType() == "Item") {
                    drops[j].setDead();
            }   }
            k[i]++;
        }
        else {
            drop(ent);
            ent.spawnExplosionParticle();
            ent.setDead();
            k.splice(i, 1);
}   }   }