Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /var/sites/a/ on line 20
Wavelength | Your Game Editing Resource | A Basic Gametype
Welcome, Guest! Login | Register

A Basic Gametype [Print this Article]
Posted by: Who_Cares
Date posted: Nov 12 2003
User Rating: 5 out of 5.0
Number of views: 5885
Number of comments: 0
Description: Creating the "Reverse Tag" gametype
This tutorial explains how to create a small gametype for Unreal Tournament 2003. You will need to know some basic UScript to understand this tutorial.
This tutorial assumes that you do your scripting in something like notepad, however you can do it with other editing programs.

The Gametype

First of all, i'm going to explain the gametype that we are about to create.
This gametype is called Reverse Tag. It is mainly just deathmatch with an added twist. Instead of everybody's kills increasing when they frag someone, they only increase when the tagged player kills someone. Killing the tagged player turns you into the person that is tagged. The objective of this gametype is to get the most kills while you are it. Oh... Did I mention that the tagged player has UDamage? user posted image

Creating The Files

First of all, I should let you know that this package will not show in Unreal Editor, so all of you Unreal Editor users, close it and open notepad.

Now, we create a package. To do this just go into your UT2003 folder and make a new folder in it called RevTag, then put a folder in the UT2003/RevTag folder

and call it classes. In the classes folder, make a file named "RevTag.uc" (excluding the quotes).

Next, we need to add this package to our EditPackages. To do this, simply go to your UT2003/System folder and open up UT2003.ini. Go to this line:



After that line, add this:



That should be all you need to do to set up your packages. Now, let's get to some scripting!

The Gametype Code

Finally, we have our files set up for editing. Now we can get into some real code! First of all, open up your RevTag.uc file. This file is where most of the code will be placed. First, let's declare the class. The class name is RevTag, and it extends xDeathMatch. So, add this:

 CODE © 

// Who_Cares's Simple Gametype Tutorial - Reverse Tag
class RevTag extends xDeathMatch;   // Class declaration

Now we add a variable global to the class. Changing something in this variable or calling a function in it will do it on the player that is tagged. When this variable is equal to none, it means that nobody is tagged. Add this:

 CODE © 

    var Pawn TaggedPawn;    // The player that is currently it.

Now we need to add a few functions that will help us later on with changing who is it. So, add these lines:

 CODE © 

function unsetTaggedPawn()
    // Make it so that there isnt a tagged pawn
    setTimer(0, false); // Stop the timer
    TaggedPawn = none;  // Unset the TaggedPawn variable

function setTaggedPawn(Pawn P)
    TaggedPawn = P;     // Set TaggedPawn to the newly tagged pawn
    setTimer(0.5, true);    // Set the timer to go every .05 seconds

First, we made a function that cleared the TaggedPawn variable (meaning there is nobody tagged). When there is nobody that is tagged, the next person to kill

somone becomes the tagged pawn. The second function "tags" a player.

For the readers who don't know what setTimer() is, I will explain it now. The setTimer() function is a function that all actor classes can use. The first parameter it takes specifies how much time there is until the timer is called as a float. The second one specifies if the timer should loop as a bool. If it loops, it will wait the specified amount of seconds, then call the function again repeatedly until you call the setTimer function again.

Now, we need to make the tagged player recieve UDamage whenever the timer is called, so put this in:

 CODE © 
function Timer()
    if (TaggedPawn != none)
        // If someone is tagged this will enable double damage for the tagged player

Now for the most important part of our gametype! The Killed function...
This function is called whenever someone is killed in the game. Add this (i'll explain it later):

 CODE © 

function Killed(Controller Killer, Controller Killed, Pawn KilledPawn, class<DamageType> damageType)
    if (TaggedPawn == none)
        // Either it's first blood or the tagged player killed themself
        setTaggedPawn(Killer.Pawn);   // Make him the tagged player
        super.Killed(Killer, Killed, KilledPawn, damageType);   // give a point
    else if (Killed.Pawn == TaggedPawn)
        if (Killer == Killed)
            // The tagged pawn committed suicide. gj...
            unsetTaggedPawn();   // clear the tagged pawn
            super.Killed(Killer, Killed, KilledPawn, damageType); // take a point
            setTaggedPawn(Killer.Pawn);   // set the new tagged pawn to the killer
            super.Killed(Killer, Killed, KilledPawn, damageType);   // Give a point
    else if (Killer.Pawn == TaggedPawn)
        if (Killer == Killed)
            // Suicide.
            unsetTaggedPawn();    // unset the tagged pawn variable
            super.Killed(Killer, Killed, KilledPawn, damageType); // Take a point
            super.Killed(Killer, Killed, KilledPawn, damageType); // give a point

So, what is this? This function controls the tagging of players. I'll go through each if block to show you what is happening.

The first block checks if there isnt a tagged player. If there isnt, it tags the killer, and gives him/her a point.

The second block checks if the person that was killed was the tagged player. If so, it checks if he/she committed suicide or if he/she was killed by someone else, and rewards the players depending on the situation.

The third block of code checks if the person that killed was the tagged player. If so,it checks if he/she committed suicide or if he/she killed someone else, and rewards the players depending on the situation.

Last, but certainly not least, we need to make it so that it shows the name of the gametype when you view the scores. Add this:


        GameName = "Reverse Tag"

What this will do, is tell the game that this gametype is called Reverse Tag. Without this, it would say you were playing deathmatch.

Now, compile this gametype. If you did it correctly, you should get no errors or warnings. Once it compiles, move onto the next section!

Testing your gametype

Now, we finally get to test our gametype! Well... almost. Before we can though, we need to make one more very small file. This file is the INT file, and every gametype,

mutator, weapon, etc has a description in some int file in the System folder. This pretty much tells the engine what classes to use for the game type, and

the description of it to show in game.
So, make a new file in UT2003/System and put this in it:


    Object=(Class=Class,MetaClass=Engine.GameInfo,Name=RevTag.RevTag,Description="DM|Reverse Tag|xinterface.Tab_IADeathMatch|xinterface.MapListDeathMatch|false")

Most of the variables in there are self-descriptive, but I want to explain the description variable. contains a lot of values that the engine needs to show the gametype information correctly. Each value is separated with a '|'. Here's what each value means:
  • DM is the prefix used to choose what maps show in the level select screen.
  • Reverse Tag is the name of the gametype
  • xinterface.Tab_IADeathMatch and xinterface.MapListDeathMatch are both classes used for the tabs that show in the instant action screen.
  • false is a boolean value used to tell the game whether this is a team game or not. I'm not totally sure on this though, please email me if this is wrong.

Now, add all of this and test! If it showed in the gametype selection, you have made your first gametype! I hope that you learned something new while reading this.

Since this is my first tutorial, i'd appreciate you to send any comments or feedback you have about this tutorial to . The source code to this tutorial can be located here.

Rate This Article
This article is currently rated: 5 out of 5.0 (2 Votes)

You have to register to rate this article.
Related Files
Zip FileFilename:
File Size: 1.7 KB

User Comments

No User Comments

You must register to post a comment. If you have already registered, you must login.

Latest Articles
3rd person View in Multiplayer
Half-Life 2 | Coding | Client Side Tutorials
How to enable it in HL2DM

By: cct | Nov 13 2006

Making a Camera
Half-Life 2 | Level Design
This camera is good for when you join a map, it gives you a view of the map before you join a team

By: slackiller | Mar 05 2006

Making a camera , Part 2
Half-Life 2 | Level Design
these cameras are working monitors that turn on when a button is pushed.

By: slackiller | Mar 04 2006

Storing weapons on ladder
Half-Life 2 | Coding | Snippets
like Raven Sheild or BF2

By: British_Bomber | Dec 24 2005

Implementation of a string lookup table
Half-Life 2 | Coding | Snippets
A string lookup table is a set of functions that is used to convert strings to pre-defined values

By: deathz0rz | Nov 13 2005

Latest Comments
knock knock
General | News
By: MIFUNE | Dec 31 2017
knock knock
General | News
By: omega | Dec 22 2016
knock knock
General | News
By: MIFUNE | Oct 10 2015
New HL HUD Message System
Half-Life | Coding | Shared Tutorials
By: chbrules | Dec 31 2011
knock knock
General | News
By: Whistler | Nov 05 2011
Particle Engine tutorial part 4
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 18 2010
Particle Engine tutorial part 2
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
Particle Engine tutorial part 3
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
Game Movement Series #2: Analog Jumping and Floating
Half-Life 2 | Coding | Shared Tutorials
By: mars3554 | Oct 26 2009
Particle Engine tutorial part 5
Half-Life | Coding | Client Side Tutorials
By: Deadpool | Aug 02 2009

Site Info
297 Approved Articless
8 Pending Articles
3940 Registered Members
0 People Online (7 guests)
About - Credits - Contact Us

Wavelength version:
Valid XHTML 1.0! Valid CSS!