This reference guide describes some of the most useful functions and keywords you can use in your TriggeredScript classes.
NOTE: This is *NOT* a complete list of the TriggeredScript functions. To see a complete list, open the gbxScripted\Classes\TriggeredScript.uc file in a text editor and browse through the code contained therein.
Reading the Reference
Each function is specified according to the following format.
function [<return type>] <function name>( [ <parameter> [, <parameter> ... ] ] )
You can find the function name easily because it is always followed //immediately// by an open parenthesis (. If the function returns a value, the type of this value is specified immediately after the function keyword.
Parameters are of the following form:
[coerce] [out] [optional] <type> <parameter name>
The most important parts here are the type (usually string, name, float, int or similar) and the parameter name which tells you something about what the parameter means.
If a parameter is marked optional you can leave it off entirely. A default value will be used.
If a parameter is marked out it might be changed by the function. This is an advanced concept and is explained elsewhere. You can generally ignore this keyword.
If a parameter is marked coerce you can pass anything into this parameter and it will be treated like the specified type. You can safely ignore this keyword.
function ACTION_ConsoleCommand( coerce string command )
Executes the string command as a console command.
function ACTION_DestroyActor( name actorTag )
Destroys the actor with the given actorTag. If more than one actor has this tag, only the first actor found will be destroyed.
function ACTION_TeleportToActor( name ActorToMoveTag, name DestinationTag )
Teleports the first actor with the tag ActorToMoveTag to have the same location and rotation as the first actor with the tag DestinationTag.
function Actor ACTION_SpawnActor( coerce string ClassName, optional name TagName )
Creates and returns an actor with the given ClassName and assigns this new actor with the tag TagName.
function ACTION_PlayAmbientSound( name actorTag, name soundName, byte volume, byte pitch, float radius )
Causes the first actor with the tag actorTag to play the ambient sound soundName with the given volume, pitch, and radius parameters.
function ACTION_PlaySound( name actorTag, name soundName, byte volume, byte pitch, float radius )
Causes the first actor with the tag actorTag to play the sound soundName with the given volume, pitch, and radius parameters.
function ACTION_ChangeLevel( coerce string URL )
Changes to the map specified by URL.
function ACTION_SetPhysics( name actorTag, Actor.EPhysics newPhysicsMode )
Sets the physics of the first actor with the tag actorTag to the indicated physics modes. This is an advanced function: you should know what the physics modes are and how to control them before using this function.
function ACTION_SetHidden( name actorTag, bool bHide )
Hides or unhides the specified actor.
function ACTION_AssignToUnit( name pawnTag, name unitTag )
Assigns the indicated pawn to the indicated unit. Automatically removes him from his prior unit if any. Specify unitTag as 'None' to make the pawn assigned to no unit.
function ACTION_DisplaySubTitleMessage( coerce string Message, float LifeTime, color TextColor,
optional bool bCentered, optional bool bClearSubTitles )
function ACTION_SetSubTitlePosition( int titleX, int titleY, optional bool bShowBackground )
function ACTION_SetObjectiveStatus( int ndxObjective, EObjectiveComplete complete, name objectiveListTag )
latent function ACTION_WaitForEvent( name event )
This is a latent function, meaning that when executed from state code this function will not return immediately but will "sleep" until its condition is fulfilled. In the case of ACTION_WaitForEvent(), the function will return when the specified event is triggered.
function ACTION_PlayAnim( name pawnTag, name BaseAnim, float BlendInTime, float AnimRate, optional bool bLoopAnim, optional float StartFrame )
Causes the indicated pawn to play the indicated animation. The pawn must be possessed by a ScriptedController (not a Mind).
function ACTION_ChangeController( name pawnTag, class< Controller > aControllerClass )
Changes the controller of the pawn specified by pawnTag to a new instance of the controller class aControllerClass. This will occur even if the pawn's previous controller is already an instance of aControllerClass. For example:
ACTION_ChangeController( 'jimmydean', class'Mind' );
Will give the pawn with tag 'jimmydean' a new Mind.
Unit Order Actions
function ACTION_OrderMove( name unitTag, name destinationTag )
Tells the unit with the specified unitTag to travel to the location of the actor with the given destinationTag.
function ACTION_OrderTarget( name unitTag, name targetUnitTag )
Tells the unit with the specified unitTag to prioritize its fire toward the enemy target with the given targetUnitTag.
function ACTION_OrderFallIn( name unitTag )
Tells the specified unit to fall in. Only works for units with a SuperUnit (defined by Unit.SuperUnitName).
function ACTION_OrderFallOut( name unitTag )
Tells the specified unit to fall out. This does not change the unit's formation center, but subsequent move orders given to this unit will cause them to move in a detached manner from their super unit.
Pawn Control Actions
TODO These are not reliable currently because AI always overrides scripted control of Pawns. This will change soon.
function ACTION_Walk( name pawnTag )
Forces the pawn to walk, as opposed to crouch or run.
function ACTION_Crouch( name pawnTag )
Forces the pawn to crouch, as opposed to walk or run.
function ACTION_Run( name pawnTag )
Forces the pawn to run, as opposed to walk or crouch.
function ACTION_Freeze( name PawnTag )
Totally freezes the pawn. It will not animated or move at all.
function Goto( name Label )
Jumps to the Label in the same state.
function GotoState( optional name NewState, optional name Label )
Shifts execution to the specified NewState. By default, the new state begins executing at its 'Begin' label, but you can override this by specifying the optional 'Label' name parameter.
The functions are useful for intermediate and advanced scripters.
function int Min( int A, int B )
Returns the smaller of A or B.
function int Max( int A, int B )
Returns the larger of A or B.
function int Clamp( int V, int A, int B )
Returns V, unless V is less than A, in which case this returns A, or is larger than B, in which case this returns B.
function float FMin( float A, float B )
Like Min() but for floating-point numbers.
function float FMax( float A, float B )
Like Max() but for floating-point numbers.
function float FClamp( float V, float A, float B )
Like Clamp() but for floating-point numbers.
function float FRand()
Returns a pseudorandom floating point number in the range (0,1]. (This function will never actually return 1.0.)
function int Rand( int Max )
Returns a pseudorandom integer in the range (0, Max]. The largest number that this function will return is Max - 1.
function bool IsRandomlyTrue( float percentageChanceTrue )
Returns true with a likelihood of percentageChanceTrue. For instance, calling 'IsRandomlyTrue( 50.0 )' would return true 50% of the time and false 50% of the time. Calling 'IsRandomlyTrue( 25.0 )' would return true 25% of the time and false 75% of the time.
function float RandRange( float Min, float Max )
Returns a pseudorandom number in the range (Min, Max]. Will never actually return Max.
function ModLog( coerce string str )
Writes the given string to the Unreal log window.