Worst-case scenario: the UEd Goblin wipes the map and burns down your house.

UE2:Object static native functions (UT2004)

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UT2004 Object (static native functions)
Object static native functions in other games:
RTNP, U1, UT, U2, U2XMP, UE2Runtime, UT2003, UT3, UDK
Other member categories for this class:
operators, structs

Math functions[edit]

Int functions[edit]

Clamp[edit]

native(251) static final function int Clamp (int V, int A,int B)

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[edit]

native(250) static final function int Max (int A, int B)

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[edit]

native(249) static final function int Min (int A, int B)

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[edit]

Abs[edit]

native(186) static final function float Abs (float A)

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[edit]

native static final function float Acos (float A)

Calculates the arccos of A.


Asin[edit]

native static final function float Asin (float A)

Calculates the arcsin of A.


Atan[edit]

native(190) static final function float Atan (float A, float B)

Calculates atan2 for the arguments A and B.


Ceil[edit]

native(253) static final function float Ceil (float A)

Returns the smallest integer number greater than or equal to A.

Cos[edit]

native(188) static final function float Cos (float A)

Calculates the cosine of A.


Exp[edit]

native(191) static final function float Exp (float A)

Calculates e to the power of A, the exponential function.

FClamp[edit]

native(246) static final function float FClamp (float V, float A, float B)

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[edit]

native(245) static final function float FMax (float A, float B)

Returns the larger of the two values.

FMin[edit]

native(244) static final function float FMin (float A, float B)

Returns the smaller of the two values.

Loge[edit]

native(192) static final function float Loge (float A)

Calculates the logarithm of A to the base of e, the natural logarithm.

Round[edit]

native(257) static final function float Round (float A)

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[edit]

native(187) static final function float Sin (float A)

Calculates the sine of A.

Sqrt[edit]

native(193) static final function float Sqrt (float A)

Calculates the square root of A.

Square[edit]

native(194) static final function float Square (float A)

Calculates A * A, i.e. A squared.

Tan[edit]

native(189) static final function float Tan (float A)

Calculates the tangent of A.

Vector and rotator functions[edit]

GetAxes[edit]

native(229) static final function GetAxes (Rotator A, out Vector X, out Vector Y, out Vector Z)

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[edit]

native(230) static final function GetUnAxes (Rotator A, out Vector X, out Vector Y, out Vector Z)

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[edit]

native(227) static final function Invert (out Vector X, out Vector Y, out Vector Z)

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[edit]

native(300) static final function Vector MirrorVectorByNormal (Vector Vect, Vector Normal)

"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[edit]

native(226) static final function Vector Normal (Vector A)

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[edit]

native static final function Rotator Normalize (Rotator Rot)

Normalizes the components of a rotator to the range [-32768, 32767] so the rotator still represents the same orientation.

OrthoRotation[edit]

native static final function Rotator OrthoRotation (Vector X, Vector Y, Vector Z)

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[edit]

native(225) static final function float VSize (Vector A)

Returns the length of the vector.

Quaternion functions[edit]

Main article: Quaternions

QuatFindBetween[edit]

native static final function Quat QuatFindBetween (Vector A, Vector B)

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[edit]

native static final function Quat QuatFromAxisAndAngle (Vector Axis, float Angle)

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[edit]

native static final function Quat QuatFromRotator (Rotator A)

Converts a rotator to a quaternion so they describe the same rotation.

QuatInvert[edit]

native static final function Quat QuatInvert (Quat A)

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[edit]

native static final function Quat QuatProduct (Quat A, Quat B)

Calculates the Hamilton product of the two quaternions.

Note: QuatProduct(Q1, Q2) == -QuatProduct(Q2, Q1)

QuatRotateVector[edit]

native static final function Vector QuatRotateVector (Quat A, Vector B)

Applies the rotation described by quaternion A to vector B.

QuatToRotator[edit]

native static final function Rotator QuatToRotator (Quat A)

Converts the quaternion into a rotator so they describe the same rotation.

Interpolation functions[edit]

InterpCurveEval[edit]

native static final function float InterpCurveEval (InterpCurve curve, float input)

Determines the interpolation result for the specified InterpCurve data.

InterpCurveGetInputDomain[edit]

native static final function InterpCurveGetInputDomain (InterpCurve curve, out float min, out float max)

Determines and returns the input domain of the specified InterpCurve data.

InterpCurveGetOutputRange[edit]

native static final function InterpCurveGetOutputRange (InterpCurve curve, out float min, out float max)

Determines and returns the output range of the specified InterpCurve data.

Lerp[edit]

native(247) static final function float Lerp (float Alpha, float A, float B, optional bool bClampRange)

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[edit]

native static final function Quat QuatSlerp (Quat A, Quat B, float Slerp)

Performs spherical linear interpolation between the quaternions A and B.

Smerp[edit]

native(248) static final function float Smerp (float Alpha, float A, float B)

Performs smooth interpolation between A and B.

Random numbers[edit]

FRand[edit]

native(195) static final function float FRand ()

Returns a random float value between 0 and 1.

Rand[edit]

native(167) static final function int Rand (int Max)

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[edit]

native(320) static final function Rotator RotRand (optional bool bRoll)

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[edit]

native(252) static final function Vector VRand ()

Returns a unit vector with a random direction.

String functions[edit]

Asc[edit]

native(237) static final function int Asc (string S)

Returns the ASCII value of the first character in the specified string, or 0 if the empty string was specified.

Caps[edit]

native(235) static final function string Caps (coerce string S)

Converts all letters in S to uppercase and returns the result.

Chr[edit]

native(236) static final function string Chr (int i)

Returns a string consisting only of the character with the specified ASCII value. Specifying 0 will result in an empty string.

Divide[edit]

native(239) static final function bool Divide (coerce string Src, string Divider, out string LeftPart, out string RightPart)

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[edit]

native(202) static final function string Eval (bool Condition, coerce string ResultIfTrue, coerce string ResultIfFalse)

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[edit]

native(126) static final function int InStr (coerce string S, coerce string t)

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[edit]

native(128) static final function string Left (coerce string S, int i)

Returns the i left-most characters of S. If S has less than or equal to i characters, the entire value is returned.

Len[edit]

native(125) static final function int Len (coerce string S)

Returns the number of characters in S, i.e. the length of the string.

Localize[edit]

native static function string Localize (string SectionName, string KeyName, string PackageName)

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[edit]

native(238) static final function string Locs (coerce string S)

Converts all letters in S to lowercase and returns the result.

Mid[edit]

native(127) static final function string Mid (coerce string S, int i, optional int j)

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[edit]

native(201) static final function string Repl (coerce string Src, coerce string Match, coerce string With, optional bool bCaseSensitive)

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[edit]

native(234) static final function string Right (coerce string S, int i)

Returns the i right-most characters of S. If S has less than or equal to i characters, the entire value is returned.

Split[edit]

native(240) static final function int Split (coerce string Src, string Divider, out array<stringParts)

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[edit]

native(200) static final function int StrCmp (coerce string S, coerce string T, optional int Count, optional bool bCaseSensitive)

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[edit]

ClassIsChildOf[edit]

native(258) static final function bool ClassIsChildOf (Class TestClass, Class ParentClass)

Returns whether TestClass is equal to or a subclass of ParentClass. Returns False if either parameter is None.

DynamicLoadObject[edit]

native static final function Object DynamicLoadObject (string ObjectName, Class ObjectClass, optional bool MayFail)

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[edit]

native static final function Object FindObject (string ObjectName, Class ObjectClass)

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[edit]

native static final function name GetEnum (Object E, coerce int i)

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[edit]

native static final function array<stringGetPerObjectNames (string ININame, optional string ObjectClass, optional int MaxResults)

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[edit]

native(231) final static function Log (coerce string S, optional name Tag)

Writes a line to the main log file. The Tag defaults to 'ScriptLog' if omitted.

ResetConfig[edit]

native static final function ResetConfig (optional string PropName)

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[edit]

native static final function StaticClearConfig (optional string PropName)

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[edit]

native static final function 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[edit]

native(535) static final function StopWatch (optional bool bStop)

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[edit]

native(232) final static function Warn (coerce string S)

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.