| Home Page | Recent Changes | Preferences

Exec Function

Exec Functions are functions that a player or user can execute by typing its name in the console. Basically, they provide a way to define new console commands in UnrealScript code.

exec function God()
{
    if ( bGodMode )
    {
        bGodMode = false;
        ClientMessage("God mode off");
        return;
    }

    bGodMode = true; 
    ClientMessage("God Mode on");
}

Passing Parameters

You can allow parameters for your console command by simply adding those parameters to the exec function's definition:

exec function Slap(string Player, int Strength)
{
    Level.Game.Broadcast(None, Player @ "was slapped with strength" @ Strength);
}

When entering this console command, separate the parameters with blanks (not commas). If the last function parameter is a string, it gobbles up everything that's remaining on the console command line.

  (> Slap Mychaeel 1337
  Mychaeel was slapped with strength 1337

You can make exec function parameters optional if you want.

Valid Places for Exec Functions

Exec functions can be placed anywhere, but they only actually work in the following classes:

Note: this is only for UT2003, not UT and Unreal

Note that an exec function must be simulated to work client-side.

Related Topics

  • GUIUserKeyBinding – adding your custom console commands to the game's Controls setup menu.

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In