The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Adding delay to for-loop
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#1
Adding delay to for-loop

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.
(This post was last modified: 11-05-2014, 08:58 AM by Neelke.)
11-05-2014, 08:57 AM
Find


Messages In This Thread
Adding delay to for-loop - by Neelke - 11-05-2014, 08:57 AM
RE: Adding delay to for-loop - by Mudbill - 11-05-2014, 12:23 PM
RE: Adding delay to for-loop - by burge4150 - 11-06-2014, 06:43 PM
RE: Adding delay to for-loop - by Neelke - 11-06-2014, 10:10 PM



Users browsing this thread: 1 Guest(s)