UDN
Search public documentation:

ExecFunctions
日本語訳
中国翻译
한국어

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

UE3 Home > Unreal Engine 3 Basics > Exec functions
UE3 Home > UnrealScript > Exec functions
UE3 Home > Input / Output > Exec functions

Exec functions


Overview


Exec functions are special types of functions that are defined within classes using UnrealScript. These functions can be executed by the user at runtime by bringing up the in-game console while the engine is running (usually by pressing the ~ key) and typing in the name of the function followed by any parameters it may require. These functions are similar to console commands in that they can be executed from the console, but differ due to the fact that they are defined in script and can be easily added, modified or removed.

Classes that are scanned for exec functions are (including all subclasses):

  • Input
  • Controller
  • Pawn
  • InventoryManager
  • Weapon
  • HUD
  • GameInfo
  • CheatManager
  • GameViewportClient
  • Interaction - Interactions placed into a PlayerController's Interactions array will be executed, but will not show up in the console command completion

Creating new exec functions


To add new exec functions so that it can be mapped to a key, is as simple as adding "exec" in front of the function.

The example below shows how to add a parameterized exec function.

ExamplePawn.uc
exec function MyExecFunction(int ParameterA)
{
  `Log("The user executed my custom function with "$ParameterA);
}

Altering *Input.ini


Adding a new exec function to your own classes will allow the console to execute those functions, but often you will want to bind them directly to a key. The way that this is done is by adding the key binding into your *Input.ini. The * is the prefix, and it may be Default (if you wish to add a default key bind) or UDK (if you wish to add a non default, UDK specific key bind). These configuration files are often found in %UDK_ROOT%\UDKGame\Config\ (Where UDKGame will be your game project folder).

To add a new key bind, ensure to insert it under the [Engine.PlayerInput] configuration group. The example below shows how to add a key bind to H, running the custom exec function with a parameter defined in the example above.

.Bindings=(Name="H",Command="MyExecFunction 99")

Existing engine exec functions


The exec functions listed below are all found in the base engine classes.

Game administration

These functions allow you to administer the current game. Many of these functions require you to be logged in as the administrator on the server, while some only require that you have certain privileges.

  • Admin [command] – This executes an admin command on a server where you are logged in as the administrator.
  • Kick [command] [users] – Remove a user from the game. A user can either be their ID (as shown by the Kick list command) or a name (* can be used as a wild card). The command is optional and can be one of the following:
    • List – display all players and their IDs
    • Ban – do not allow the player to return
    • Session – ban the user for this game only
  • KickBan [users] – Remove a user from the game and do not allow them to return. A user can either be their ID (as shown by the Kick list command) or a name (* can be used as a wild card).
  • KillBots – Remove all bots from the game.
  • PlayerList – Display all player names along with their ping times.
  • RestartMap – Restart the current map.
  • Switch [map] – Tell the server to change levels based on the value of map. Map is parsed as a map URL (see CommandLineArguments for more detailed information about map URLs).

Cheats

These functions are considered to be cheats in most games, but are often useful for development reasons.

  • AffectedByHitEffects – Makes the player immune to all hit effects (i.e., momentum, hit effects, etc.).
  • AllAmmo – Sets ammo counts to maximum on all weapons
  • AllWeapons – Gives the player all the weapons available in the game.
  • Amphibious - Causes the player to be able to stay underwater virtually indefinitely (sets Paw.UnderwaterTime = 999999.0).
  • EnableCheats - Enables cheats within the game
  • Fly - Causes the player to be able to fly in place of walking.
  • FreezeFrame [delay] - Force the game to pause for the specified delay time.
  • Ghost - Puts the player into a ‘ghostly’ state where they can fly, pass through geometry, and are not affected by damage.
  • GiveWeapon [weaponclass] - Give an instance of the specified weaponclass to the player.
  • God - Puts the player into a state where they are no longer affected by damage.
  • KillAll [class] - Kills or destroys all instances of the specified class in the level.
  • KillPawns - Kills all pawns within the level.
  • KillViewActor - Kills or destroys the actor that is currently set as the ViewTarget.
  • Loaded - Gives the player all the weapons available and full ammo on those weapons. This is identical to calling AllWeapons and then AllAmmo.
  • PlayersOnly - Set the world to only update players, ignoring all other actors.
  • SetGravity [amount] - Set the gravity in the Z axis to the specified amount.
  • SetJumpZ [height] - Set the vertical distance a the player can jump to the given height.
  • SetSpeed [multiplier] - Multiply the player’s default ground and water speed by the given multiplier.
  • Slomo [speed] - Set the game speed to the given speed.
  • Summon [classname] - Summon or spawn an instance of the specified classname (this is a package.class string).
  • Teleport - Teleports the player to the surface they are look at.
  • Walk - Sets the player back to the default walking state.

Debug commands

These functions are often useful for debugging at run time.

  • Avatar [classname] - Possess a pawn of the specified classname (this is a name type).
  • BugItGo [X] [Y] [Z] [Pitch] [Yaw] [Roll] - Move the player to the location (X, Y, Z) and rotation (Pitch, Yaw, Roll) specified for the purposes of viewing submitted BugIt bugs.
  • CauseEvent [EventName] - Trigger a Kismet event with the given EventName.
  • CE [EventName] - Trigger a console event with the given EventName.
  • ChangeSize multiplier - Set the player’s size to be multiplier times the default player size.
  • ClearProgressMessages - Clear all progress messages; setting them to an empty string.
  • ConsoleKey [key] - Send a key press of the given key to the input system from the console. This is useful for remote debugging when you do not have access to the local keyboard for input.
  • CrowdDebug [bEnable] - Toggle display of post render info for crowd agents.
  • CrowdFocus - Show post render info for nearby, visible crowd agents.
  • CrowdToggle - Toggle all crowd managers on or off.
  • DebugCreatPlayer [controllerid] - Create a player accepting input from the controller with the given controllerid.
  • DebugPause - Logs the current pause state of the game in progress.
  • DebugRemovePlayer [controllerid] - Remove the player accepting input from the controller with the given controllerid.
  • DestroyFractures [radius] - Cause all fractured static meshes within the specified radius to break apart. Radius is optional and defaults to 256.0 units.
  • DumpOnlineSessionState - Logs the current session state for the gametype and online layer.
  • DumpVoiceMutingState - Logs the current muting state of the server.
  • EndPath - Stop interpolation.
  • FractureAllMeshes - Causes at least one fragment of all fractured static meshes within the level to be broken off.
  • FractureAllMeshesToMaximizeMemoryusage - Causes all fractured static meshes within the level to break in such a way that it maximizes memory usage.
  • FXPlay [class] [anim] - Find the nearest pawn of the given class and play the specified FaceFX anim.
  • FXStop [class] - Find the nearest pawn of the given class and stop all currently playing FaceFX anims.
  • ListConsoleEvents - Display a list of all console events on the HUD.
  • ListCE - Display a list of all console events on the HUD.
  • ListDynamicActors - Outputs a list of all dynamic actors (actors which were created after the start of the level) to the log.
  • LogLoc - Logs the current location of the player in BugIt format, but without taking a screenshot or further actions.
  • MoreSpeed - Forces the player into a running state.
  • NormalSpeed - Forces the player into a walking state.
  • NavMeshVerification - Enables a timer to do periodic navigation mesh verification.
  • PathChild [count] - Move one step along the current path for debugging purposes.
  • PathClear - Clear all debugging path info.
  • PathStep [count] - Move one step along the current path for debugging purposes.
  • RefreshFormatting - Force a formatting update and scene refresh for the active UIScene.
  • RememberSpot - Designate the current location as a spot to be remembered for path testing.
  • RemoteEvent [EventName] - Trigger a remote event in Kismet with the given EventName from the console.
  • RE [EventName] - Trigger a remote event in Kismet with the given EventName from the console.
  • SaveActorConfig [actorname] - Save the config for the actor with its name matching the specified actorname.
  • SaveClassConfig [classname] - Save the config for the given classname.
  • SendToConsole [command] - Execute the given console command.
  • SetConsoleTarget [playerindex] - Set the player (selected from the GamePlayers array by playerindex) which console commands will be executed in the context of.
  • SetFreezeRendering - Toggles the FREEZERENDERING console command to freeze the rendering state.
  • SetOnlineDebugLevel [level] - Set the OS-specific logging level to the given level (this is an integer).
  • SetSplit [mode] - Set the splitscreen configuration to the specified ESplitScreenType mode.
  • ShowDatatStoreField [markup] - Output the value for the datastore with the given markup to the log.
  • ShowDataStores [bVerbose] - Output all registered datastores to the log. If bVerbose is specified and set to True, detailed information about each datastore is displayed.
  • ShowDebug [debugtype] - Toggle the display of properties of the player’s current ViewTarget. If debugtype is specified, it toggles that specific type but leaves the overall display of properties enabled. If not specified, the overall display is toggled.
  • ShowDebugSelectedInfo - Toggles the display of information about the actor the debug camera is viewing.
  • ShowDockingStacks - Display the docking stacks of all active UIScenes.
  • ShowGameDebug - Toggles the display of GameInfo debug information.
  • ShowGameState - Dumps the current state stack for the GameInfo to the log.
  • ShowPlayerState - Dumps the state stack for the player to the log.
  • ShowTileSafeArea - Draw the tile safe zone on the viewport.
  • SSSwapControllers - Rotates controller IDs among players. This can be used to test splitscreen multiplayer with only one controller.
  • StreamLevelIn [level] - Stream in the given level;
  • StreamLevelOut [level] - Stream out the given level.
  • TestLevel - Check all actors within the current level for errors.
  • TestNavMeshPath [bDrawPath] - Attempts to calculate a path from the player’s current position to the location the player is looking at. If bDrawPath is true, the path will be displayed on screen (this is optional and the default is True).
  • ToggleDebugCamera - Switch between the player camera and the debug camera without locking gameplay, but with locking of the local player’s input.
  • ToggleDebutInput - Toggles debug input processing.
  • UTrace - Toggles tracing/logging of script function calls.
  • VerbosePathDebug - Display the results of a TraceActors interation from the player’s current viewpoint to a distance of 10000 units.
  • ViewActor [actorname] - Set the actor with the given actorname as the current ViewTarget and change to 3rd person view.
  • ViewBot - Sets the ViewTarget of the player to be the first bot not currently set as the Viewtarget.
  • ViewClass [class] - Sets the ViewTarget of the player to be the first instance of the given class not currently set as the ViewTarget.
  • ViewFlag - Sets the ViewTarget of the player to be the flag carrier, if one exists.
  • ViewPlayer [playername] - Sets the player with the given playername to be the ViewTarget.
  • ViewSelf [bQuiet] - Sets the ViewTarget of the player back to its pawn. If bQuiet is false, a message is displayed to the player (this is optional and defaults to false).
  • WriteToLog [message] - Outputs the message to the log appending it with “NOW! “.

Player commands

  • Jump - Causes the player to jump.
  • LocalTravel [mapURL] - Causes the client to travel to the given mapURL.
  • Mutate [command] - Passes the given command through the mutator list.
  • QuickLoad - Load the save game created by the QuickSave exec function.
  • QuickSave - Create a save game for the game in progress.
  • RestartLevel - Restarts the current level.
  • ShowMenu - Not implemented.
  • SmartJump - Causes the player to jump.
  • Suicide - Causes the player to commit suicide.

Gameplay commands

  • Pause - Toggle the paused state of the game.

Settings

  • Camera [mode] - Change the player’s camera to the given mode (i.e. “1st” or “3rd”).
  • ChangeTeam [teamname] - Change the player’s current team to the specified teamname (this is a string holding the team’s color, i.e. “red or “blue”).
  • ClearSmoothing - Clears mouse smoothing.
  • FOV [fovangle] - Set the field of view of the player’s camera to the given fovangle.
  • InvertMouse - Toggles inverting the mouse input.
  • InvertTurn - Toggles inverted turning.
  • SetBind [bindname] [command] - Creates a new key bind for the given command with the specified bindname.
  • SetName [name] - Sets the player’s name to the given name.
  • SetSensitivity [sensitivity] - Set the mouse sensitivity to the specified sensitivity.
  • SetShowSubtitles [bShowSubtitles] - Shows or hides subtitles based on the value of bShowSubtitles.
  • SwitchTeam - Switches the player from its current team to the other team.

Inventory

  • NextWeapon - Switch the player’s weapon to the next weapon in the inventory.
  • PrevWeapon - Switch the player’s weapon to the previous weapon in the inventory.
  • StartFire [firemode] - Fire the player’s currently selected weapon with the optional firemode.
  • StartAltFire [firemode] - Fire the player’s currently selected weapon using the alternate fire mode.
  • StopFire [firemode] - Stop firing the player’s currently selected weapon with the optional firemode.
  • StopAltFire [firemode] - Stop firing the player’s currently selected weapon using the alternate fire mode.
  • SwitchToBestWeapon [bForceNewWeapon] - Attempts to change the player’s weapon to the best weapon in the player’s inventory. If bForceNewWeapon is true, the new weapon will be a different weapon than the one currently being used, assuming the player has more than one weapon at the time (this is optional and defaults to False).
  • ThrowWeapon - Throw the player’s current weapon and switch to a new weapon.
  • Use - Cause the player to interact, or attempt to interact, with any level objects the player is touching.

Communication

  • Say [message] - Send the specified message to all players
  • Speech [type] [index] [callsign] - Sends a voice message of the given type to the specified player.
  • Talk - Opens a tiny console populated with “Say “ to send a message.
  • TeamSay [message] - Send the specified message to all team members.
  • TeamTalk - Opens a tiny console populated with “TeamSay “ to send a team message

HUD

  • ToggleHUD - Toggles the visibility of all HUD items.
  • ShowHUD - Toggles the visibility of all HUD items.
  • ShowScores - Toggle the visibility of the scoreboard.
  • SetShowScores [bShowScores} - Set the visibility status of the scoreboard to bShowScores.

UTGame


The exec functions listed in this section are only found in the UTGame classes and are not available in the base engine.

Game Administration

  • AdminChangeMap [mapURL] - Change the map using the given mapURL.
  • AdminForceTextMute [user] - Prevent the user from sending text messages.
  • AdminForceTextUnMute [user] - Allow the user to send text messages
  • AdminForceVoiceMute [user] - Prevent the user from sending voice messages.
  • AdminForceVoiceUnMute [user] - Allow the user to send voice messages.
  • AdminKick [user] - Kick the given user from the game.
  • AdminKickBan [user] - Kick and ban the given user from the game.
  • AdminLogin [password] - Log in as server admin using the given password. This is required for some exec commands to work.
  • AdminLogout - Log out as server admin.
  • AdminPlayerList - Displays the list of all players as client messages.
  • AdminRestartMap - Restarts the current map.
  • Disconnect - Disconnect and return to the main menu.

Cheats

  • EditWeapon [weapon] - Opens a property window for editing the properties of the given weapon. If no weapon is specified, all available weapons are output to the log.
  • FreeCamera - Sets the player’s camera to the free orbital camera mode.
  • Glow [amount] - Set the AmbientGlow for all instances of the UTVehicle class in the level to the given amount (LinearColor of amount, amount, amount, 1.0).
  • Invisible [bInvisible] - Set visible or invisible depending on the value of bInvisible.
  • KillBadGuys - Kills all pawns not on the same team as the player.
  • KillOtherBots - Kills all the bots in the level that are not currently the view target of the player.
  • KillOthers - Kill all players in the level except for the local player.
  • KillThis - Kill the local player.
  • LM [messageclass] - Set the local message class to the given messageclass.
  • LMS [switch] - Cause the player to receive the local message specified by the current local message class and the given switch.
  • PhysicsGun - Gives the player the physics gun.
  • RBGrav [gravityscaling] - Sets the rigid body gravity scaling for the level to the given gravityscaling value.
  • SetStickBind [value] - Set the control stick bindings to the given value.
  • ShowStickBindings - Output all current control stick bindings to the log.
  • SpawnABloodDecal - Spawns a blood decal at the player’s current location.
  • SuicideBy [damagetype] [healthvalue] - Cause the player to commit suicide using the given damagetype and healthvalue to test death effects.
  • SummonV [classname] - Summon the vehicle specified by the given classname.
  • TiltIt [bActive] - Sets tilt active or inactive for the player based on the value of bActive.

Debugging

  • AddBots [number] - Adds the given number of bots to the level for testing purposes.
  • AddBlueBots [number] - Add the given number of bots to the blue team in a team game
  • AddNamedBot [name] [bUseTeamNum] [teamnum] - Add a bot with the given name. If bUseTeamNum is True and a teamnum is specified, add the bot to the given team.
  • AddRedBots [number] - Add the given number of bots to the red team in a team game.
  • AdjustCameraScale [bIn] - Moves the camera in or out depending on the value of bIn.
  • AngDriveDamp [amount] - Set the angular damping scale for the player’s physics asset to the given amount.
  • AngDriveSpring [amount] - Set the angular spring scale for the player’s physics asset to the given amount.
  • BackDamp [amount] - Set the damping scale for the back of the player’s physics asset to amount.
  • BackSpring [amount] - Set the spring scale for the back of the player’s physics asset to amount.
  • DebugViewAcceleration - Toggles display of view acceleration info.
  • DebugTargetAdhesion - Toggles display of target adhesions info.
  • DebugTargetFriction - Toggles display of target friction info.
  • FixedView [visiblemeshes] - Toggle the player’s view as being fixed. If visiblemeshes is “yes”, “true”, or “1”, then meshes will be visible.
  • FlushDebug - Flushes any persistent debug drawing.
  • GetPlayerLoc - Outputs the location and rotation of the player to the log.
  • HandDamp [amount] - Set the damping scale for the hands of the player’s physics asset to amount.
  • HandSpring [amount] - Set the spring scale for the hands of the player’s physics asset to amount.
  • LinDriveDAmp [springamount] [dampamount] - Set the linear damping scale for the player’s physics asset to the given dampamount.
  • LinDriveSpring [springamount] [dampamount] - Set the linear spring scale for the player’s physics asset to the given springamount.
  • StartMusic - Spawn new music manager if none exists and start playing music.
  • TestResetPhys - Resets the player’s physics state.
  • UnlockChapter [chapter] - Unlocks the given chapter for testing purposes.
  • ViewObjective - View the current objective.
  • ViewPlayerByName [playername] - Set the player with the given playername as the current ViewTarget.

Gameplay

  • BecomeActive - Go from spectating a match to being a player in the match.
  • DropFlag - Forces the player to drop the flag, if carrying it.
  • Duck - Make the player duck, or crouch.
  • PlayVehicleHorm - Plays the horn of the vehicle the player is driving.
  • RetrieveSettingsFromProfile - Loads the player’s settings from the current profile.
  • SetAutoTaunt [bAutoTaunt] - Sets the player’s auto taunt value to the given value of bAutoTaunt.
  • Taunt [tauntindex] - Plays the taunt specified by the tauntindex.
  • UnDuck - Make the player leave the crouched state.

Communication

  • ToggleSpeaking [bOn] - Turn voice recognition on or off based on the value of bOn.

HUD

  • GrowHUD - Add missing elements to the HUD.
  • ShrinkHUD - remove elements from the HUD.
  • ReleaseShowScores - Toggle displaying the scoreboard.
  • SetShowScores [bShowScores] - Show or hide the scoreboard based on the value of bShowScores.
  • ShowAllAI - Toggle the display of AI overlays in the HUD.
  • ShowSquadRoutes - Toggle display of squad routes.
  • ToggleMinimap - Toggles the display of the minimap on the HUD.
  • ToggleScreenShotMode - Toggles the display of all HUD elements for taking screenshots.