| Home Page | Recent Changes | Preferences

Unreal Coding FAQ

Got a question that isn't covered here? Add it to the list (at its appropriate place) and leave the answer out. Somebody else will fill it in.

Note: Only frequently asked questions, please. For anything else there are forums like [BUF Coding].

See also Compiler Errors.

Basics

I can't modify .uc files in my Text Editor. I get a message "This Document is Read Only"
Right click the file in Windows Explorer, then hit properties and uncheck the "read only" box. Epic seems to have had the foresight to make all the files in the UnrealScript Source distribution for UT2003 read-only, so if people are going to copy and paste a class to use as a template, they may run into this problem. Remember not to recompile the original Epic classes: Do Not Alter Default Packages.
I get an error when trying to compile Engine.u (or one of the other .u files that comes with the game)
You shouldn't change any of these. In UnrealScript, as in most Object Oriented programming (and unlike Quake? or HalfLife coding), you never change something that exists. You really don't want to change the code that comes with the game, since that will change all versions of the game and all mods, and most people don't want that, to say the least. Instead, when you want to change something in a class, you create your own version of the class, then get the game to use your version instead of the built in version. How you get it to use the new version depends pretty heavily on which class it is. See OOP Overview.
It doesn't work.
Make sure your package actually compiled without any compiler errors and is used in the game. (Simply subclassing stuff doesn't make the game use your new class! You have to explicitly add it in a map or through a mutator or gametype.)
See Debugging Techniques.
I am trying to get a bot to follow the player in a single player mod, how can I do this?
You ask in a dedicated Coding forum because this question is not a frequently asked and as simple as we would like the questions to be for this page.

The UnrealScript Language

Things that are built in to the language, not that come in any package.

Expands vs. Extends – What's the difference?
UnrealScript originally used "expands", but long ago switched to "extends", the keyword used in Java. The Unreal Tournament compiler supports both and treats them the same. So, always use extends when you have a choice. In UT2003, "expands" isn't supported at all anymore. Always use "extends" there.
Rotators... what the hell are they?
All is explained in technicolor on the Rotator page. :D
Function Pointers
See Delegate.
Unknown Code Token 04
When you create native functions in your UnrealScript class, you also have to define it in C++. For each UnrealScript argument, you need a P_ macro in C++. If you forget to put one of the P_ macros in your C++ code, you'll get the "Unknown code token 04" error.
How to save information between levels on the user's hard drive
See Config vars and .ini files.
How can I tell if my class exists in the game?
Bring up the Console and type editactor class=[name of your class]. You must be running UT2003 in windowed mode to see the results. You can also use the Log("something happened") in your class and later find it in the System/UT2003.log. If your class is not available, you will get a Target Not Found response in the console.
How can I get a reference to the object a piece of code belongs to?
Use the Self keyword. Also see Special UnrealScript Keywords for details.
How can I call an ancestor class' version of a function or a non-state function from within a state?
This is done via the Super and Global keywords respectively. Again, see Special UnrealScript Keywords for more details.

Replication

Replication is the name of UnrealScript's networking interface. It supports both remote procedure calls and the synchronization of variables across machines.

What should I read to understand replication?
In this order:

Input

Keybindings, mouse movements, exec functions, etc.

How do I bind keys?
See Binding Keys.

HUD (Heads-Up Display)

The icons displaying health, etc.

What are all those arguments to DrawTile()?
See Canvas, the class which defines that function.
How does transparency work in the HUD?
See Color Blending.

Other

Related Topics


Category FAQ

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