Worst-case scenario: the UEd Goblin wipes the map and burns down your house.

Legacy:UT Low Gravity Mutator

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

This tutorial aims to get you hands experience making actual modifications to the game. It is geared toward UT although some of it might apply to UT2003 as well, I don't have that in mind while writing this. This tutorial assumes you have completed the following initial steps.

  1. Setting Up UnrealScript – you have to do this before anything else anyway.
  2. UnrealScript Hello World – get your feet wet.

Overview[edit]

Now you are ready to proceed. First of all let's start with modding the game in a way that the game's developers have actually provided for in a direct fashion. They included in the game a module named Mutator (UT) and it is intended for this purpose. This is by no means anywhere near the limit to what you can do. If it was, the wiki would have been complete in a day. This module contains functions that override functions in other parts of the game. For example look at this function from that module:

function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
	return true;
}

This function is in the Mutator module to allow you to mutate an actor as the game checks through the actors in the map to see if they are to to be replaced. Here you can replace one actor with another. You can replace all weapons with one particular weapon if you like (but if this what you want to do then study up on the Arena mutator as most of the work is done for you already there). This function will be called and all the code in it will be executed. You can do pretty much anything you want to here as it is an opportunity for your code to be executed.

One mutator included with the game is LowGrav. This mutator uses the CheckReplacement() function as an opportunity to modify all instances of ZoneInfo in any map that loads. It also uses this function to get rid of all UT JumpBoots in the map. That's all the mutator does. It's one function long. But that function is in a subclass of Mutator named LowGrav. It inherits all the rest of the code from Mutator so the rest of the work is already done. See Object Oriented Programming Overview for more on this, and Mutator Topics for more on mutators in general.


Project Defined[edit]

This is a good first mod for you, because you can study the mutator you make here against the mutator you changed to make this one. And you can study the [Mutator] module itself which is the class that the LowGrav class extends.

Okay, lets do it. The LowGrav mutator is popular and surely you have played on a low grav server. This server runs the LowGrav mutator and that's how it does it. On one of these servers you may have encountered a place you wanted to get to, but low gravity only afforded you to get almost high enough but not quite enough to reach that spot. We are going to make the XLowGrav mutator. This will be exactly like the LowGrav mutator but you will be able to jump quite a bit higher, and cover more map when you jump forward from a high point then you could in LowGrav.

Make your working directory[edit]

First you need to Set Up Package Folders where you will place your code for UCC to compile it from. In your UnrealTournament Base Directory, make a new folder named "XLowGrav". Open that folder and make a new folder inside named "Classes". This Classes folder is where you will save your code for UCC to find later.

Open the file that will be used as your template[edit]

Open the Botpack folder then open the Classes folder within. You should see the modules here named LowGrav.uc. If not you need to go back two steps and complete both the prerequisits for this tutorial. If you do see it there, then open it up with your text editor.

Edit the template[edit]

All the lines at the top that start with double slashes are comment lines and you can put what ever message you want here as long as you don't use the word class. It will be ignored by the game. So take a second and make this mutator your own. Change the name there from LowGrav to XLowGrav and change the description to say EXTRA low gravity. This next part is important. Change the line

 class LowGrav expands Mutator;

to show XLowGrav instead of LowGrav. This is the class declaration (see class syntax for more on this). It says that this class is named XLowGrav and that it will inherit and/or override any code in its parent class named Mutator.

All you are going to do is edit one number here. Find the line

 ZoneInfo(Other).ZoneGravity = vect(0,0,-200);

and change the (0,0,-200) to (0,0,-100). Now save this file as XLowGrav.uc (not XLowGrav.uc.txt !!) in the Classes folder you made in your working directory for this mod.

Add your class to the list of classes to be compiled.[edit]

There it waits for you to compile it with UCC. But you can't yet. First you have to leave a note for the compiler to know what all to compile. Open unrealtournament.ini in your ut system folder and use the find feature of notepad to locate all group of lines that say "EditPackages=Core" and such.

Everytime the Make commandlet is called in UCC it looks in the unrealtournament file for all the EditPackages lines and checks to see if those files are already compiled to the system folder as file with the extension ".u". If an EditPackages line is equal to a file that is not compiled to the system folder already, then and only then will UCC look for that file in the classes folder within a folder in your ut directory of the exact name that the EditPackes line is equal to. Thus, you have created this directory in the manor you have.

Now you will add another EditPackages line to the list. It will read, "EditPackages=XLowGrav".

Remember to put your EditPackages line at the bottom, beneath all the others, or you'll get Compiler errors. (make sure when you save the unrealtournamet.ini that notepad doesn't add ".txt" to the end of it.)

Compile that sucker![edit]

As soon as you see that you have successfully compiled your first mod, you will want to open it right away and test it. Wait! You need to make one more file so it will show up as a mutator in the game. After you compile this come back and read the section after this one (Make your .int file) to make that file.

Open a command prompt box (yes you can still do this in XP, start/run/cmd and hit enter) and change directory ("cd") to the ut system folder. Type "ucc make" and UCC will compile your script to a ".u" file and save it in your system folder. When its done you will see that tells you there were no errors and no warnings. You can close that prompt box now and complete the next and final step.

Make your .int file[edit]

When UT launches it loads the data in every INT file it finds in the system folder. So your int has to be there when UT loads. If UT is running, close it, and restart it after your int file is in the system folder. Open notepad and add this data:

[Public]
Object=(Name=XLowGrav.XLowGrav,Class=Class,MetaClass=Engine.Mutator,Description="Extra Low Gravity")

Save this file as XLowGrav.int (not XLowGrav.int.txt) in the Base Directory\system folder. I know you have to try it so go ahead and launch UT then you'll see "Extra Low Gravity" in your mutator list. Have fun, good job, and happy modding. You've come to the right place.

Related Topics[edit]

Discussion[edit]