while (GetIsObjectValid(oHostile))
{
if (GetIsReactionTypeHostile(oHostile, oPlayer)) //Checks for hostiles, if none, player heals
{
DelayCommand(6.0, ExecuteScript("ens_dyingcheck", oPlayer));
}
oHostile = GetNextObjectInShape(SHAPE_SPHERE, 17.0, lPlayerDying, TRUE, OBJECT_TYPE_CREATURE);
}
It should also be noted that - while yes - this loop does delay execute of the script to be 6 seconds after the fact.
It doesnt however consider that all of those delayed scripts will be going off at the same time.
I believe in a post on the old forums Funkyswerve said something like there was a 128k limit on data that can pass through a script at a single time.
An example where I saw this - was when some of my AI Scripts in my module, would throw TMI's if there were large scale battles.
But they wouldnt throw TMI's if the creature count in the battle was less than 5.
EG- Each creature is firing the same small script, but the multiplication per creature, made it so if they were all firing at same time- it throws TMI.
If you really want to get around TMI in that loop, you should try to implement a multiplier in your loop.
int i = 1;
while (GetIsObjectValid(oHostile))
{
if (GetIsReactionTypeHostile(oHostile, oPlayer)) //Checks for hostiles, if none, player heals
{
DelayCommand(6.0+IntToFloat(i), ExecuteScript("ens_dyingcheck", oPlayer));
}
oHostile = GetNextObjectInShape(SHAPE_SPHERE, 17.0, lPlayerDying, TRUE, OBJECT_TYPE_CREATURE);
i++;
}
This way - your individual scripts are given a 1 second of dedicated time to execute, before the next one kicks off.