“UnrealScript is the Unreal Engine’s scripting language. It is a strongly-typed, object-oriented programming language very similar to Java and C++. If you want to learn UnrealScript, you should make yourself familiar with the fundamental concepts of object-oriented programming. It definitely helps already to know another programming language, preferably one that is strongly-typed and object-oriented as well.” – The Unreal Wiki
If you are new to UnrealScript, there are some basic things you should understand before you try to jump straight in and create a new mod or total conversion. I highly recommend reading this UnrealScript language reference page before you continue.
So you’ve read the UnrealScript language reference page but don’t quite understand what variables are or how to use them, and probably want to create something cool no doubt. But you don’t know where to start. I started coding for UT2004 without any prior knowledge. I started by modifying monsters slightly for an invasion server and from there progressed into other areas like weapons, controllers, mutators and the HUD to name a few.
C++ is very similar to UnrealScript and the one book I had for reference, and which helped me greatly when I first started was this O’Reilly C++ Pocket Reference book. Available at Amazon and all good book stores, however I recommend going digital and saving a tree by buying the PDF version from O’Reilly.com.
Probably the best place to start coding is to use a “Mutator” to alter game play. Mutators are a very special class that exist within unreal tournament. They provide a very convenient opportunity to alter the game play slightly. Mutators are a subclass of Actor. Actors are very important. Anything that exists “physically” in the game, is an Actor. Actor is a subclass of Object and therefor every Actor and therefor every subclass of Actor inherits all of the variables, functions and properties that exist in Object.
Lets take a look at the class tree to better help you understand how this works. Please note this is a simplified example class tree, only showing some of the main classes you will be interested in to start with. Full class trees can be seen in the editor in the actor browser or at the unreal.student.utwente.nl site.
As you can see, Object is the root of all the classes. Anything that exists in Object is inherited and accessible in its sub classes (child classes). Find where the Monster class is located in the tree. As you can see, Monster is a subclass of xPawn, so Monster inherits all the functions and variables in Object>Actor>Pawn>UnrealPawn>xPawn. xPawn and everything above it DOES NOT inherit what exists in Monster.Because they are not its child. A child can only have 1 parent, but a parent can have many children.
Back to mutators. When a mutator is added to the game via the mutator menu it will be spawned in the level when the level starts. At this point its Chain of Events are triggered. This is what kicks life into the mutator (actor) and makes it run the code contained within it. Spawning is the term used in UnrealScript when we talk about creating new Actors. Actors are created via the Spawn() method/function that exists in the Actor class. Note that this function isn’t accessible in the Object class because it was first declared in the child class Actor. Any children of Actor can access it.
In the chain of events you can see the list of the functions and tasks that are performed. We need to pick a relevant one as a place to start our code. In the first tutorial I will show one way of changing player properties by using a mutator and taking advantage of the chain of events.
TIP – The Unreal Wiki, UDN, and the uncodex are invaluable sources of information!
It appears that http://wiki.beyondunreal.com/ is having issues. It’s been down for about a week I think. 🙁
I noticed that too, their contact page is also down.