UE2:Object static native functions (UT2004)
![]() |
Object (static native functions) |
- Object static native functions in other games:
- Other member categories for this class:
Math functions
Int functions
Clamp
Limits V to the interval of [A, B]. Exactly speaking, A will be returned if V is smaller than A, B will be returned if V is larger than B, otherwise V is returned.
This also applies if A is larger than B. So if V is larger than B, but smaller than A, the value of A is returned even though V is actually between the two values.
Max
Returns the larger of the two values. Note that when passing float parameters to this function, they are automatically typecasted to type int. If you don't want this, use the FMax() function instead.
Min
Returns the smaller of the two values. Note that when passing float parameters to this function, they are automatically typecasted to type int. If you don't want this, use the FMin() function instead.
Float functions
Abs
Returns the absolute value of A. That means, if A is greater than or equal to zero, it is returned unchanged. Otherwise, if A is less than zero, -A is returned.
Acos
Calculates the arccos of A.
Asin
Calculates the arcsin of A.
Atan
Calculates atan2 for the arguments A and B.
Ceil
Returns the smallest integer number greater than or equal to A.
Cos
Calculates the cosine of A.
Exp
Calculates e to the power of A, the exponential function.
FClamp
Limits V to the interval of [A, B]. Exactly speaking, A will be returned if V is smaller than A, B will be returned if V is larger than B, otherwise V is returned.
FMax
Returns the larger of the two values.
FMin
Returns the smaller of the two values.
Loge
Calculates the logarithm of A to the base of e, the natural logarithm.
Round
Rounds A to the nearest integer number. If the decimal part of A is .5
or larger, the smallest integer number greater than A is returned, otherwise the largest integer number less than or equal too A is returned.
Sin
Calculates the sine of A.
Sqrt
Calculates the square root of A.
Square
Calculates A * A, i.e. A squared.
Tan
Calculates the tangent of A.
Vector and rotator functions
GetAxes
Determines the axis unit vectors of a coordinate system that is created by rotating the world coordinate system as specified by the rotator value. Note that the X value is identical to the rotator value typecasted to vector.
If you think of the rotator value as a camera view rotation, then X points in view direction, Y points to the right and Z points upwards.
GetUnAxes
Determines the axis unit vectors of a coordinate system that can be transformed into the world coordinate system as specified by rotating it according to the rotator value.
The outputs of GetAxes() and GetUnAxes() relate to each other as if one was the result of the other's output run through the Invert() function.
Invert
Inverts the coordinate system defined by the three vectors.
If the three vectors are the unit vectors of a Cartesian coordinate system, like those returned by GetAxes(), then the Inverse() function can also be described in the following way: The X, Y and Z vectors are viewed as a 3x3 matrix. The result of Invert() then is the transpose of that matrix.
MirrorVectorByNormal
"Reflects" the input vector Vect off a surface with the normal vector Normal and returns the result. The vector Normal doesn't actually have to be a unit vector.
Normal
Returns a vector with the same direction as the input value, but a length of 1. The zero vector is just passed through by this function.
Normalize
Normalizes the components of a rotator to the range [-32768, 32767] so the rotator still represents the same orientation.
OrthoRotation
Returns a rotator value that represents the coordinate system specified by the three vector values. This is basically the inverse function of GetAxes(). Note that you can also typecast a single vector value to a rotator value with the Roll component being zero.
VSize
Returns the length of the vector.
Quaternion functions
- Main article: Quaternions
QuatFindBetween
Finds the quaternion that describes the smallest rotation that transforms vector A into vector B. The parameters should be unit vectors for this function to return meaningful results.
QuatFromAxisAndAngle
Creates a quaternion that describes a rotation of the specified angle around the given axis vector. The axis vector doesn't need to be normalized.
QuatFromRotator
Converts a rotator to a quaternion so they describe the same rotation.
QuatInvert
Inverts the vector part of the quaternion, i.e. calculates the conjugate of the quaternion. This basically means the result represents a rotation of the same angle, but in the opposite direction.
QuatProduct
Calculates the Hamilton product of the two quaternions.
Note: QuatProduct(Q1, Q2) == -QuatProduct(Q2, Q1)
QuatRotateVector
Applies the rotation described by quaternion A to vector B.
QuatToRotator
Converts the quaternion into a rotator so they describe the same rotation.
Interpolation functions
InterpCurveEval
Determines the interpolation result for the specified InterpCurve data.
InterpCurveGetInputDomain
Determines and returns the input domain of the specified InterpCurve data.
InterpCurveGetOutputRange
Determines and returns the output range of the specified InterpCurve data.
Lerp
Performs linear interpolation between A and B. If bClampRange is specified as True, the result will be limited to values greater than A and less than B, otherwise Alpha values less than 0 or greater than 1 can result in values outside that range.
Note: bClampRange works by applying FClamp to the result and thus only works for A < B
.
QuatSlerp
Performs spherical linear interpolation between the quaternions A and B.
Smerp
Performs smooth interpolation between A and B.
Random numbers
FRand
Returns a random float value between 0 and 1.
Rand
Returns a random int value in the range 0 to Max-1. Note that the maximum effective value for Max is 0x7FFF or 32767.
RotRand
Returns a rotator value with random Pitch and Yaw components in the range 0 to 65535. If the parameter bRoll is True, the result's Roll component is also set to a random value in that range. Otherwise, the Roll component is set to zero.
VRand
Returns a unit vector with a random direction.
String functions
Asc
Returns the ASCII value of the first character in the specified string, or 0 if the empty string was specified.
Caps
Converts all letters in S to uppercase and returns the result.
Chr
Returns a string consisting only of the character with the specified ASCII value. Specifying 0 will result in an empty string.
Divide
Looks up the first occurrence of Divider in Src and outputs whatever comes before the divider as LeftPart and anything after the divider as RightPart. Returns True on success and False if the divider string could not be found.
Eval
Returns the second parameter if the condition evaluated to True or the third parameter if the condition evaluated to False. Note that regardless of the evaluation result of the condition expression, both string parameters are evaluated!
InStr
Returns the position of the first occurrence of S in T or -1 if T does not contain S. This function is case-sensitive. The position of the first character is 0.
Left
Returns the i left-most characters of S. If S has less than or equal to i characters, the entire value is returned.
Len
Returns the number of characters in S, i.e. the length of the string.
Localize
Reads a localized string from the specified section of a localization file. The name of the localization file is given as PackageName, its extension is determined through the Language setting in the [Core.System] section of UT2004.ini.
Locs
Converts all letters in S to lowercase and returns the result.
Mid
Returns up to j characters from string S, starting with the ith character. If j is omitted or greater than the number of characters after position i, all remaining characters are returned.
Repl
Replaces all occurrences of Match in Src with With and returns the result. Any occurrences created as a result of a replacement are ignored. By default Match is matched case-insensitively, unless bCaseSensitive is specified as True.
Right
Returns the i right-most characters of S. If S has less than or equal to i characters, the entire value is returned.
Split
Splits up Src at every occurrence of Divider and puts the result into the Parts array. Note that the array is not cleared before splitting the string, parts are appended to the end of the array. Returns the final number of elements in the array.
StrCmp
Compares the strings S and T,m optionally restricted to the first Count characters. Returns a negative value if S comes alphabetically before T, a positive value if S comes alphabetically after T or 0 if both strings are equal with respect to the character limit and case-sensitivity. If bCaseSensitive is omitted or False, the strings are compared case-insensitively.
Other static native functions
ClassIsChildOf
Returns whether TestClass is equal to or a subclass of ParentClass. Returns False if either parameter is None.
DynamicLoadObject
Attempts to load an object of the specified class and with the specified name and returns it on success or retruns None on failure. If MayFail is omitted or False, a warning is logged on failure.
FindObject
Attempts to find an existing object of the specified name and class and returns it on success. Returns None if no object with that name was found or the found object has an incompatible class.
GetEnum
Returns the name of the ith constant in the enum E. Enums should be specified as an object literal for the first parameter. The second parameter can be any numeric or enum value. The result of this function is a name value.
This function is useful to create better log output for enum variables, because a direct typecast of the enum value to string would only result in the string representation of the enum value's index.
GetPerObjectNames
Returns the names of PerObjectConfig sections for the given class in the specified INI file. You can use "System"
for the INIFile to use the main INI file specified on the startup commandline. If MaxResults is omitted, it defaults to 1024.
Log
Writes a line to the main log file. The Tag defaults to 'ScriptLog'
if omitted.
ResetConfig
If this class was declared to store its configuration in the System or User config file and the Default.ini or DefUser.ini respectively contain a section for this class, that section is used as new default. Otherwise this function behaves like StaticClearConfig(). If a property name is specified, only that property is reset to its default config value.
StaticClearConfig
Deletes the config file section of this class and reloads the default values of all configurable properties. If a property name was specified, only that property's value is deleted from the config file section.
StaticSaveConfig
Writes the default values of all configurable properties of this class into the corresponding config file section. Values of properties defined as globalconfig are written to the config section of the class that originally declared that property.
StopWatch
Starts or stops an internal script debug timer. There is only one such timer globally for everything that happens in UnrealScript. If you need multiple concurrently running stopwatch timers, you will have to get hold of an Actor reference and use its Clock() and Clock() methods.
StopWatch() calls should always be used in pairs in your code:
StopWatch(false);
// code you want to time
StopWatch(true);
Any Log() calls between the two StopWatch() calls will log a time index. The StopWatch(True) call additionally logs the entire time that passed since the StopWatch(false) call.
Warn
Writes a warning to the main log file. The warning text will have the tag "ScriptWarning" and include the object instance and function and/or state name of the Warn() call.