So I made this custom function that allows me to turn off spider eggs and spiders by writing in int parameters.
string gNameOfSpiderEggs = "organic_spider_egg_small_";
string gNameOfBrokenSpiderEggs = "organic_spider_egg_small_broken_";
string gNameOfSpiderExplodeSound = "enemy_spider_egg_open";
string gNameOfSpider = "necr_spider_";
void SetSpiderEggOff(int iMinAmount, int iMaxAmount)
{
for(int i=iMinAmount; i<=iMaxAmount; ++i)
{
SetEntityActive(gNameOfSpiderEggs+""+i, false);
SetEntityActive(gNameOfSpider+""+i, true);
SetEntityActive(gNameOfBrokenSpiderEggs+""+i, true);
//CreateParticleSystemAtEntity(gNameOfSpiderEggs,
//"ps_spider_egg_splat",
//gNameOfSpiderEggs+""+i,
//false);
PlaySoundAtEntity(gNameOfSpiderEggs,
gNameOfSpiderExplodeSound,
gNameOfSpiderEggs+""+i,
0.0f,
false);
}
}
Now what I want to add in, is a slight delay for the for-loop. For example, first spider spawn immediately, then after 1 second next one spawn, then after 0.5 seconds next one spawn and etc. I tried using a while loop, but it just froze my game. Is there a way of doing this another way? Or is there an actual way to do it with the while loop?
Sidenote: The particle system crashes the game. Reason its //.
Derp.