Please, do NOT use the Unreal Editor that comes with the game for this!
For UnrealScript, you need a text editor which is able to show line numbers and highlight the UnrealScript syntax.
There isn't such a thing as "the best one" on this matter, so I will just provide the ones I use out of personal preference:
- Notepad++ (with custom UnrealScript plugin): http://www.mediafire.com/?501s9mutukpwcmf
- UMake: http://www.mediafire.com/?kh7481rhh86fit4
You can of course use any other suitable to your needs, like WOTGreal or Eclipse, it doesn't matter which one you use as long as you like the one you're using and it actually works, however in this and any upcoming lessons I am going to use Notepad++ and UMake since these are the ones I use.
________________________________________________________________________________________________________________________
In this lesson we're going to make a new mutator for the game, and what this mutator is going to do is very simple:
- Every single time the player (re)spawns, the message "The player X respawned!" will be shown, being X the name of the player.
1 - To start, create a new folder with the same name your final package will have.
In this lesson the package will be called MyFirstMutator.u, therefore your folder name should be called MyFirstMutator as well.
2 - Next you enter the folder you just created, and create another called Classes.
All coding files (.uc) go here.
3 - Now it's time to create your first script.
First we must also give it a name, and that name will be MyMut.
Open Notepad++ (or any other editor you use), create a new file and save it as MyMut.uc in the Classes folder you just created.
From here you can start the code itself.
4 - Start the code with the class declaration, as:
Code: Select all
class MyMut extends Mutator;
5 - Now, we write the rest of the code, using ModifyPlayer from the Mutator class.
Code: Select all
function ModifyPlayer(Pawn Other)
{
if (Other.PlayerReplicationInfo != None)
BroadcastMessage("The player"@Other.PlayerReplicationInfo.PlayerName@"respawned!");
if (NextMutator != None)
NextMutator.ModifyPlayer(Other);
}
Next, a check is made to see if the player Other has a valid PlayerReplicationInfo, since without it there's no way to know the player's name.
Then all there's left to do is to broadcast the message itself to everyone.
The last NextMutator lines are there to keep all the other mutators working. So every time you see this kind of NextMutator code in the original function, be sure to keep it in your code, otherwise you may break other mutators when using them together.
6 - In the end your class should look like this:
7 - Save the file.
Now it's time to create the .u package where your mutator will be stored, so it can be read and used by the game.
For that, copy your MyFirstMutator folder and paste it to your Unreal Tournament main directory.
8 - Next, run UMake, and set the path to the folder you pasted to the Unreal Tournament directory in the previous step, and hit Compile.
9 - Let it finish, and once it says "Done", close UMake.
10 - Now as you can see, a new MyFirstMutator.u in your System folder, in your Unreal Tournament directory.
11 - However, creating the package is not enough, as the game needs to know about its existence in order to load up your mutator.
For that you need to create, in the same directory as your MyFirstMutator.u package, another file with the .int extension.
In this case, we will call it MyFirstMutator.int, and write the following:
Code: Select all
[Public]
Object=(Name=MyFirstMutator.MyMut,Class=Class,MetaClass=Engine.Mutator,Description="My First Mutator")
MetaClass: for now (for the sake of simplicity), consider this to be the way you define what kind of mod you want to load up, in the case of mutators is always Engine.Mutator.
Description: here is where you write how your mutator is called, and the name that will appear in the mutator list when your start the game.
12 - So now you have made all the files needed to run your new mutator, so just launch the game and test it up!
________________________________________________________________________________________________________________________
You can download the source and compiled package used in this lesson here:
Source: http://www.mediafire.com/?xvj31raf9ljdi73
Package: http://www.mediafire.com/?y2hryny7vwfuwsc
________________________________________________________________________________________________________________________