There is no problem with nesting loops. You can nest as many of them as you want to. There is a limit to the number of instructions that a script can have. However moving an inner loop off to its own function will increase the number of instructions in the script, not decrease them.
As far as looping for encounter creatures that could work if you are spawning you statues from an encounter. For some reason I do not think you are.
Here is what I would do. I would give all of your statues the same Tag. then place this script in the OnOpen event for the door.
Just change "TagOfStatue" in the two places in the script to the tag you are useing.
void main()
{
object oStat = GetNearestObjectByTag ("TagOfStatue");
object oDoor = OBJECT_SELF;
int nCount= 1;
effect eLook;
// if the object is valid the statues are still there.
if (GetIsObjectValid(oStat))
{
// Stop the door from opening by reclosing it.
// let the area do it to make sure it gets done. doors are fickle
ActionCloseDoor(oDoor);
// remove the paralisis from the statues.
do
{
eLook = GetFirstEffect(oStat);
while(GetIsEffectValid(eLook))
{
if(GetEffectType(eLook) == EFFECT_TYPE_PETRIFY)
{
SetCommandable(TRUE, oStat);
RemoveEffect(oStat, eLook);
ApplyEffectToObject
(
DURATION_TYPE_PERMANENT,
EffectVisualEffect(VFX_DUR_PROT_STONESKIN),
oStat
);
}
eLook = GetNextEffect(oStat);
}
// change the target for next loop.
nCount = nCount +1 ;
oStat = GetNearestObjectByTag ("TagOfStatue",OBJECT_SELF,nCount);
}while (GetIsObjectValid(oStat));
}
}