• 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/
  • Weve updated the Tripwire Privacy Notice under our Policies to be clearer about our use of customer information to come in line with the EU General Data Protection Regulation (GDPR) rules that come into force today (25th May 2018). The following are highlights of our changes:


    We've incorporated the relevant concepts from the GDPR including joining the EU and Swiss Privacy Shield framework. We've added explanations for why and how Tripwire processes customer data and the types of data that we process, as well as information about your data protection rights.



    For more information about our privacy practices, please review the new Privacy Policy found here: https://tripwireinteractive.com/#/privacy-notice

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

Falidell

FNG / Fresh Meat
May 22, 2009
646
78
0
30
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)
 

Marco

Active member
May 23, 2009
644
230
43
Finland
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:

Falidell

FNG / Fresh Meat
May 22, 2009
646
78
0
30
Mesa,Az,USA
hmm ic i'm going to have to rethink of a way my script is stuctured then...

Thanks Yet Again MARCO!! =D

oh yea btw sleep() doesn't effect entire game, only effects the script it's in right? not sure about it's effect in unrealscript.
 

Marco

Active member
May 23, 2009
644
230
43
Finland
oh yea btw sleep() doesn't effect entire game, only effects the script it's in right? not sure about it's effect in unrealscript.
Wouldn't that defeat the purpose of state sleep if it paused the game too?
But no it does not pause the game.
 

Falidell

FNG / Fresh Meat
May 22, 2009
646
78
0
30
Mesa,Az,USA
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: