• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code Forcing a forloop to wait for amount of time....

Falidell

Grizzled Veteran
May 22, 2009
645
78
34
Mesa,Az,USA
How do i go about making a for-loop Pause it's proccess while a timer such as settimer() or something like that?

atm it just skips right past it but i want it to wait a certain amount of time.
and this can't be in a "State" so i can't use sleep() which from what i understand of Sleep() i prob wouldn't want to use it anyways..

and yes this has to be in a forloop( or a do until loop)
 
For loop with pause is only possible in a state:
Code:
var int i;

State MyStat
{
begin:
    for( i=0; i<5; ++i )
    {
        >Do stuff here<
        Sleep(1);
    }
}
As for Timer:
Code:
var int i;

function BeginLoopHere()
{
    i = 0;
    Timer();
}
function Timer()
{
    if( i<5 )
    {
        >Do stuff here<
        ++i;
        SetTimer(1,false);
    }
}
 
Last edited:
Upvote 0
sweet, also i've just learned that SetTimer() calls Event Timer() after it's finished which is very nice. so now i no longer need to use the forloop for this. lol UnrealScript is very strange but as i get used it i'm finding it a hell of a lot easier then straight c++

btw what i'm making is a Storylines trigger. basically what it does is it takes an array of strings, floats, sounds, and another set of floats and well plays them. so that way to make a Story segment all i have to do it trigger one actor instead of 10-30 different actors. thus it's easier and a hell of a lot less error prone.

so now that i know about the Event timer useage i can have that trigger done in a matter of minutes which will allow me to focus on the Spawner i'm making. which will function as a kind of actor factor seen in UT2k4 and UT2:A
but it'll work more like valves NPC_Maker which i love a great deal
 
Last edited:
Upvote 0