Setting Up UnrealScript
This page is one of a series of UnrealScript Lessons.
To create a mutator or mod for Unreal Tournament 2003, all you need is a copy of the game and the tools it comes with. Of course, it doesn't all come pre-assembled. You will have to do this. You also might want to make sure you have the latest patches to the game before setting up here.
1 Get the Source Code
Out of the box, UnrealScript classes are compiled in .u files. These contain the source as well as the compiled bytecode. You can see the source within UnrealEd, but we want to get it into standalone plaintext UC files. You have two choices here:
- You can go to UnrealScript Source and download the original sources from there. Extract this into your UT2003 folder and voila – you have the source code.
- Or, you can go into UnrealEd 3, bring up the [Script Editor]? and export the scripts from there. To do this, do UnrealEd Main Menu → View → Show Script Editor and then in the editor do File → Export all scripts. Nine times out of ten, UnrealEd will then crash (unless that bug has been fixed) – but you will generally get the source code.
If you look at your UT2003 directory now, there should be about a dozen new folders. Inside each of these folders should be at least one subfolder "Classes", containing a bunch of UC files. .uc is the file extension of uncompiled UnrealScript sources while .u is the extension of compiled code.
The folders all represent packages. A package in object-oriented design is pretty much just the grouping of specific types of files. UT2003 has a lot more organization to it than UT did, more fully separating out weapon classes from effect classes and so on.
2 Choose a scripting environment
Even though there is only one compiler for UnrealScript, Ucc, there are many different ways in which to write your code and compile it. Some are downright bats, but in most cases it's horses for courses.
You may notice that further tutorials assume different methods of scripting and compiling. This is basically due to the tutorial writer's personal preference. If you can rewrite it to be a little bit more general, please do!
UnreadEd
First of all you could use UnrealEd for coding. But you probably don't want to. It's great for making levels, but really inferior for coding. It's fine for coding a one-off class like a Trigger to embed in a map, but for modding, there are far better ways.
Text editor + UCC
The original way was to write your code in a normal text editor, and compile with the external compiler. Compiling With UCC elaborates on that. See below for a more convenient way.
Short list of text editors:
- Notepad – yuck, although the XP version of Notepad is bearable – Ctrl-G and Ctrl-F are your friends
- TextPad – nice, supports UnrealScript syntax highlighting
- ConTEXT – another nice text editor with syntax highlighting
- UltraEdit – even better, as it has a function browser window (good for large classes)
- jEdit – powerful Java-based code editor; heaps of plugins, built-in UnrealScript syntax highlighting (4.2+)
Text editor + UMake
A simple stand-alone way to compile UnrealScript projects is UMake. It provides similar features as integrated development environments, but assumes that you use your own (favorite) text editor to create and edit your sources.
Integrated Development Environment
Both are good editors. Both have nice graphical user interfaces for editing and compiling. More on IDE.
Related Topics
- UnrealScript Hello World – your recommended next step
- UnrealScript Lessons – all the UnrealScript tutorials
- UnrealScript – all the reference pages
- Mutator Topics – more on mutators
- Making Mods – more on the organizational and social aspects
- Application – list of useful software
Comments
Some things that could have been mentioned in this tutorial:
- basic syntax features: functions, variables, conditional execution of code & loops, special keywords like None, Self, etc.
- lack of an "entry point". Simple classes like Mutator maybe?
- inheritance, link to OOP Overview