; PlayAnim (name Sequence, optional float Rate, optional float TweenTime) : Plays an Animation (must have a mesh set for this to work!) Sequence=Anim sequence Name ; Rate = Animation Rate multiplier ; TweenTime = Amount of Time to "tween" into the first frame of this animation sequence if in a different sequence.

+

; PlayAnim (name Sequence, optional float Rate, optional float TweenTime): Plays an Animation (must have a mesh set for this to work!)

Spawn an actor. Returns an actor of the specified class, not of class Actor (this is hardcoded in the compiler). Returns None if the actor could not be spawned (either the actor wouldn't fit in the specified location, or the actor list is full). Defaults to spawning at the spawner's location and with the spawner's rotation.

bool Destroy()

Destroy this actor. Returns true if destroyed, false if indestructable. Destruction is latent. It occurs at the end of the tick.

SetTimer (float NewTimerRate, bool bLoop)

If bLoop is true, causes Timer() events every NewTimerRate seconds. Otherwise, causes Timer() to be called once in NewTimerRate seconds. SetTimer(0.0, False); stops the timer.

Latent Functions

Latent Function are special native functions that can only be used in state code. (i.e. in labels outside of functions within states. See ScriptedPawn's script for excellent examples). They will cause script execution within the state to pause until some condition is met. All other functions and states in other classes will continue to execute normally.

While you cannot define new latent functions, it possible to pull a similar effect:

While(!SomeConditionIsMet())//Pause until this function returns trueSleep(0.0);

Sleep (float Seconds)

Waits for the specified amount of time. Note using continual low values of sleep() (<0.1) is not recommended, as this creates signnificant dependance on frame rate. For instance, the minigun has this problem, where different frame rates make it fire different amounts of bullets in a second. See this graph.

FinishAnim ( )

Waits till the current animation is finished. WARNING: If you have an AnimEnd() that plays a new animation, this will never pass!

FinishInterpolation ( )

Only used mostly in movers. Pauses until the mover has finished interpolated to the next key.

Trace a line and see what it collides with first. Takes this actor's collision properties into account. Returns first hit actor, the LevelInfo if hit level geometry, or None if hit nothing. bTraceActors specifies whether Trace should check for actors at all.

Highlander: UT2003 info, Trace returns as expected the static mesh actor if it hits a static mesh, and returns the TerrainInfo if it hits terrain.

bool FastTrace (vector TraceEnd, optional vector TraceStart)

Returns True when there is no world geometry between the two points. The actor's location is used as start if no TraceStart is specified.

Sounds

Plays a sound. Slot = Sound slot (allows actors to play multiple sounds at once) ; bNoOverride: If true and a sound is currently playing in the specified slot, the new sound will not play (override the current sound).

AI Functions

Inform other creatures that you've made a noise they might hear (they are sent a HearNoise message). Senders of MakeNoise should have an Instigator if they are not Pawn (UT)s.

bool PlayerCanSeeMe ( )

PlayerCanSeeMe returns true if some player has a line of sight to actor's location.

Other Functions

string GetMapName (string NameEnding, string MapName, int Dir)

The horribly slow function that uses an O(X^2) algorithm to find maps. When searching for maps it's useful to set the NameEnding parameter to the prefix for the type of maps you are looking for. The MapName parameter can be set to any map name (possibly even maps that don't exist) and its value is used to derive the name of the next map returned by this function. The Dir parameter should be set to 1 to move forwards in the list of map names, -1 to move backwards, and 0 to return the same map. A Dir of 0 is onle every used with a MapName value of "" to obtain the first map in the list of maps for a given map prefix. Be aware that this function will loop from the last map in a "list" to the "first" map in the list without warning.

This is called when an actor enters zone 0. Zone 0 is the region of non-subtracted space in your level. Actors can enter this zone through BSP errors or if they are of a type that does not collide with the world.

Set the display properties of an actor. By setting them through this function, it allows the actor to modify other components (such as a Pawn (UT)'s Weapon (UT)) or to adjust the result based on other factors (such as a Pawn (UT)'s other Inventory (UT) wanting to affect the result)

SetDefaultDisplayProperties ( )

Sets the default display properties similar to SetDisplayProperties.

Messages

Broadcast a string message to all players. This calls ClientMessage on all Pawn (UT)s (see Pawn (UT)/Events). See SpecialEvent for an example. Type can be one of 'Event' (default), 'CriticalEvent', 'Say', 'TeamSay', 'DeathMessage', 'Pickup' and maybe other types for custom HUD classes.

Other Functions

Hurt other actors within a radius of this actor. ExplosionChain uses this, for example.

string GetItemName (string FullName)

Returns the string representation of the name of an object without the package prefixes.

string GetHumanName ( )

Returns the human readable string representation of an object.

Mychaeel: I've seen that elsewhere too – I really think that everything up to and including the "function" keyword should be stripped from function prototype here on the Wiki in order to keep the clutter at a minimum. It's much more important to see that a function returns a string value than knowing that it's native(123).

Hugh: I've just made a change to the SetTimer() description - I think I'm right, but can someone confirm?

Zedsquared: Looks good but has anyone experimented to see what happens if timer() takes longer than TimerRate to execute? do you get another event fired or will it wait?

Mychaeel: Since UnrealScript code doesn't execute in parallel and lengthy execution of code in Timer blocks everything else, the engine will simply fire the next timer event in the next tick.

BesigedB: Tick, tock, tick, tock.

Highlander: I guess this is a Trace related question, ive noticed that when a trace() hits terrain the HitLocation points towards the TerrainInfo actor ?? Am i correct or am i loosing my mind?

Claw: Hmm, are you certain it's the HitLocation? I experienced something similar in UT; when a Trace hit the Level, the HitActor would be the LevelInfo (maybe ZoneInfo if one existed, I never checked). Maybe your code uses HitActor.Location?

Highlander: Positive, it doesnt matter as i found a way around the particular problem that uses less traces. It does return the TerrainInfo as the actor however, the vsize of the hitlocation was 3000units + in my tests. (The trace was 128 units long) and i was approximately 3000 units from the center of the map where the terrain info was.

Foxpaw: Hitlocation is relative to the center of the world, as far as I know... I think that the terraininfo and center of the map just coincided. Can someone confirm this? I've noticed that in UT2003 instantfire weapons scratch the hitlocation and replace it with the end of the trace instead of the point where the trace actually impacted the map, that seems silly but I expect it's done that way for a reason.

Claw: Strange, when I just tested it again with the newest patch, the HitLocation definitely wasn't the HitActor's Location. It wasn't the correct spot either. But I verified the error is linked to the position where the trace starts. From the center of the map Trace works allright.

Foxpaw: HitLocation isn't usually the location of the actor you hit, but instead the point upon that objects collision sphere/cylinder/whatever. I'm not sure why your traces would not be returning the correct location for hitlocation when you hit the world - it works fine for me.