My post on the second page of this thread might have some useful script bits for what you are wanting to do:
http://www.eqemulator.org/forums/sho...t=32605&page=2
An MPG would basically be the same code as in my CastOnGroup() plugin code in that thread, accept you should just have to remove all of the group check stuff.
One thing is that I believe CastSpell() can only do 1 target at a time. If the NPC is casting the spell on all of the AE targets, it is probably only going to land on 1 of them. In cases where you want multiple spells cast from the same mob at once, you should use SpellFinished():
Code:
SpellFinished(spell_id, spell_target = this, mana_cost = 0)
An example for your loop would be:
Code:
$npc->SpellFinished(1111, $ent);