Why use a for-loop? How about a timer loop?
int count = 0;
void TimerLoop(string &in asTimer)
{
SetEntityActive(gNameOfSpiderEggs+""+count, false);
SetEntityActive(gNameOfSpider+""+count, true);
SetEntityActive(gNameOfBrokenSpiderEggs+""+count, true);
count++;
AddTimer(asTimer, RandFloat(0.3f, 1.7f), "TimerLoop");
}
A for-loop will repeat the same action for a certain amount of times. It would work if Amnesia had any form of Thread.sleep(); function, but it does not as far as I'm aware of. A while-loop crashes you because it loops infinitely as long as the boolean question is accepted.
This Timer-loop is basically just an infintely looping timer. It repeats with a random delay to each iteration. Some of the variables I used can be replaced by the function versions (by that I mean the SetLocalVarInt instead of primitive int) if you prefer those.
To start the loop, just call
To stop the loop, just call
You can add further checks to it so that it will only repeat for your specified Min and Max amounts, but those are simple if-statements. You can probably figure out what needs tweaking.