use a timer

Code:
//run starttimer once from another func //like postbeginplay() //or startProjectileSpawning() function starttimer(){ float randomFloat; //initialize timer for random duration //of 0.1 to 10 seconds randomFloat = randRange(0.1, 10); SetTimer(randomFloat, false, 'spawnProj'); } //use code from my post, but note you cannot pass parameters //put all code inside the function itself. function spawnProj(){ local Projectile SpawnedProjectile; local vector startLocation; local vector projDirection; startLocation = //game specific, you will have to decide possible range of start locations projDirection = vrand(); //random direction, or use more game-specific code SpawnedProjectile = Spawn(class'ProjectileClass',,, startLocation); if( SpawnedProjectile != None && !SpawnedProjectile.bDeleteMe ) { SpawnedProjectile.Init(projDirection); } //reset timer to a random duration starttimer(); }
Leave a comment: