Delays

The best and quickest support by a group of top-notch editing specialists, guaranteed!

Moderator: Forum Guards

Delays

Postby Andrievskaya Veronika » Fri Nov 06, 09 5:49 am

How i can insert delays in UnrealScript? In Delphi this is Sleep() but this is not Delphi. There is same function in UScript too, but i cannot use it in events and functions.

For example i have this code:

Code: Select all
simulated event RenderTexture(ScriptedTexture Tex)
{
if (bAllowRendering)
  {
    Tex.DrawText(16, 32,"Режим работы: нормальный" , Font'DeusExUI.FontMenuHeaders');
    Tex.DrawText(16, 48,"Двойной режим включен." , Font'DeusExUI.FontMenuHeaders');
    Tex.DrawText(16, 64,"Интервал обновления текущего" , Font'DeusExUI.FontMenuHeaders');


and i want to insert a delay after each string, for example couple of seconds.
Last edited by Andrievskaya Veronika on Fri Nov 06, 09 5:50 am, edited 1 time in total.
User avatar
Andrievskaya Veronika
Poster
 
Posts: 164
Joined: Sat Sep 02, 06 7:35 am
Location: Database read error

Postby ~DJ~ » Fri Nov 06, 09 2:43 pm

I am not that expert in.. this.. But I think a call to state sleep will work. And then it awakes or goes back. For example:- DTR-Respawn-TNT-Crate

TNTCrateRespawn wrote:class TNTCrateRespawn extends CrateExplosiveSmall;

var() float ReSpawnTime;
var vector RespawnLocation;

state Exploding {
// ----------------------------------------------------------------------
// Exploding state
// ----------------------------------------------------------------------

ignores Explode;

function Timer() {
local Pawn apawn;
local float damageRadius;
local Vector dist;

if ( Level.NetMode != NM_Standalone ) {
damageRadius = (explosionRadius / gradualHurtSteps) * gradualHurtCounter;

for ( apawn = Level.PawnList; apawn != None; apawn = apawn.nextPawn ) {
if ( apawn.IsA('DeusExPlayer') ) {
dist = apawn.Location - Location;
if ( VSize(dist) <damageRadius>= gradualHurtSteps)
GotoState('Sleeping');
}

Begin:
// stagger the HurtRadius outward using Timer()
// do five separate blast rings increasing in size
gradualHurtCounter = 1;
gradualHurtSteps = 5;
bHidden = True;
SetCollision(False, False, False);
SetTimer(0.5/float(gradualHurtSteps), True);
}

//=============================================================================
// Sleeping state: Sitting hidden waiting to respawn.

State Sleeping
{
ignores Touch;

function BeginState() {
bHidden = true;
}

Begin:
Sleep( ReSpawnTime );
//PlaySound(RespawnSound);

// Used to be the commented out line but all PlaySpawnEffect does is return
// 0.3. Dunno!
//Sleep( Level.Game.PlaySpawnEffect(self) );

Sleep( 0.3 );

bHidden = false;
HitPoints=20;
bStasis=True;
SetCollision(True, True, True);
SetLocation(RespawnLocation);
GoToState('Active');
}

function PostBeginPlay()
{
Super.PostBeginPlay();

RespawnLocation = Location;
}


As you can see, it goes to state sleeping at function explode, rather than destroying. And it set's a sleep timer which works with RespawnTime.

I am not that sure how will you manage to do it.. but adding "goto state" sleeping after each expression might do the trick. Good luck.
Last edited by ~DJ~ on Fri Nov 06, 09 2:44 pm, edited 1 time in total.
User avatar
~DJ~
Forum Super Hero
 
Posts: 3766
Joined: Tue May 22, 07 12:23 pm

Postby MainMan » Sat Nov 07, 09 12:13 am

Just use the timer function
<center>ty m7
</center>
User avatar
MainMan
<i>Tru' Playa' Fer Defs</i>
 
Posts: 4655
Joined: Sun Jun 05, 05 7:38 am
Location: London, UK


Return to Editing issues

Who is online

Users browsing this forum: No registered users and 3 guests
cron