Sniper's Paradise!


An introduction to UnrealScript

“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.”

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 the 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 would start by modifying monsters and from there move to weapons, mutators and the HUD.

C++ is very similar to UnrealScript and one book to use for reference, which will greatly help you in starting out is the O’Reilly C++ Pocket Reference book.

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. 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.

Unreal Example Class Tree

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 ScriptedPawn, so Monster inherits all the functions and variables in Object>Actor>Pawn>ScriptedPawn. Pawn 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.



Spam Killer

Back To Top
2005 Sniper's Paradise
All logos and trademarks are properties of their respective owners.
Unreal™ is a registered trademark of Epic Games Inc.
Privacy Policy
Website by Softly
Powered by RUSH