For this assignment, you will be required to make a new type of
weapon with a very specialized way of doing damage.
You are to make a new type of weapon based on
the ShockRifle. The ShockRifle
is your typical laser beam weapon. Pressing fire when holding the
produces a beam that shoots out of the
gun. Pressing "Alt fire" causes a ball of energy to launch from the gun
that explodes on impact, causing damage to anyone within a certain radius.
You are to create a new type of ShockRifle called DiscriminatingShockRifle
, which shoots a regular laser for the normal fire mode and a
ball of energy or the "alt fire" mode, as expected. Except, the ball of
energy is fired using the "alt fire", it only does damage to Bots (e.g.
characters in the game that are not controlled by human users).
Feel free to make any other creative modifications to the weapon,
as long as it meets the requirements above. For example, you can change
what the ball of energy looks like, how much damage it does, how much momentum
the weapon transfers to its victims when it explodes, etc. Make sure that
any additional changes are well documented. You will not receive extra
credit for any additional modifications, but creativity is encouraged.
Classes you should be aware of
is something that a Pawn can hold. Inventory objects are usually picked up during game play when
the player touches a Pickup object. Weapons are types of Inventory.
A class descriptor referring to
the type of Pickup that can spawn an inventory
object. You will probably want to change this in your DiscriminatingShockRifle so that it refers to class'DiscriminatingShockRiflePickup'.
The Weapon class is the base class for all weapons, including the
simulated event ClientStartFire (int
This function is called by the underlying
game engine every time the user presses the fire or alt-fire button.
is an indicator
of whether the regular fire or alternate fire mode should be used. This
function can be overridden if the weapon is to perform any special behavior
when it is fired.
function bool BotFire (bool bFinished, optional
This function is called when a Bot fires the weapon. It
does not use the same function as when a human player fires the
Reference to a Pawn object that is
using the weapon.
Reference to the Pawn object that is
currently holding the weapon.
An array of objects of type WeaponFire. A WeaponFire
is an object that
describes what happens when the weapon is fired. Objects in this array
are spawned dynamically by the weapon at runtime, based on the corresponding
class descriptor in FireModeClass.
An array of class descriptors that specify what type of object
each FireMode is. The array contains two
elements, one for each firing mode and can be a different class. This
array must be changed in order for different weapon types to have different
firing effects. Each class descriptor must list a type of class that
subclasses from WeaponFire.
A specific type of weapon that shoots a beam for its regular firing mode and
a ball of energy for its alternative firing mode.
A WeaponFire is an object that describes the behavior of how a weapon
fires. For example, whether the weapon is a beam weapon (InstantFire) or a projectile weapon (ProjectileFire). This class also specifies how to
animate the weapon when it is fired.
Floating point value that multiplies the amount of damage the firing mode
Floating point that specifies how often the weapon can be fired in this
Reference to the Pawn object that fired the
function DoFireEffect ()
This function is called when the weapon is fired in this particular
A specific type of WeaponFire in which a projectile is launched.
function projectile SpawnProjectile (Vector start, Rotator
This function creates the actual projectile which is launched by this
fire mode. start specifies the location in
absolute level coordinates of the place to spawn the projectile (typically
just off the tip of the weapon itself). dir
specifies the orientation of the projectile and the direction it will
travel. The projectile spawned is of the ProjectileClass type.
A specific type of ProjectileFire describing how to
shoot a ball of energy and how to animate the weapon when the ball of energy is
A base class for all projectiles that are shot out of projectile weapons.
Floating point value specifying the amount of damage to be applied to a
victim (if it is a direct hit).
Floating point value specifying how far from the exploding projectile a
victim must be to incur damage.
Floating point value specifying how much momentum is transfered to a
victim (if it is a direct hit). This is the "force" of the
Reference to the Pawn object that is causing the
simulated function ProcessTouch (Actor other, Vector
This function is called when the projectile touches something other than
a wall. other is a reference to the thing
touched. hitLocation is the place where the
touch occured in absolute level coordinates.
simulated function Explode (Vector hitLocation, Vector
This function describes what happens when the projectile explodes.
Probably because it hit something. hitLocation
is the place the explosion occurs, in absolute level
simulated function BlowUp (Vector hitLocation)
This function describes what happens when the projectile explodes for
some reason other than impact. hitLocation is
the place the explosion occurs, in absolute level coordinates.
simulated final function HurtRadius (float damageAmount, float
damageRadius, class<DamageType> damageType, float momentum, Vector
This function describes how to hand out damage to all actors in the
explosion radius. damageAmount is the maximum
amount of damage to do. damageRadius is the
radius of affected objects. momentum is the
maximum amount of force the explosion has on an object. hitLocation is the place where the explosion occurs in
absolute level coordinates.
The energy ball projectile.
Files that you will need
In order to complete your project you will need the following files:
- DM-hw1.ut2. This is a Death Match map that
your new weapon class should work in. The level consists of two starting
points and a weapon pickup that will spawn your DiscriminatingShockRifle. You do not need to
modify the map. Put this file in your UT2004\Maps directory. You
do not need to submit this file.
This is a special pickup class for the DiscriminatingShockRifle. Place this file in your Hw1
package so that it will be compiled with the rest of your
code. However, you do not need to submit
Setting up your homework project
If this is the first time you are developing UT2004, you must gain access to
all the class files in the UnrealScript class library.
- Open Unreal2004 Level Editor
- In the textures dialog (opens automatically when the
editor is run), click on the "Actor Classes" tab.
- In the dialog, pull down the "File" menu and select "Export All
Scripts". This will export all the packages and the class files within
to the UT2004 directory.
If you are using the WOTgreal editor for the first time.
- Open WOTGreal. If this is the first time you
have used WOTGreal, you should be presented with a Preferences dialog.
If not, select "Options" -> "Preferences".
- Enter the game information so that it looks like the following:
You must create a new package in the UT2004 class library. All the new classes you write should be part of this
package. The name of your package should be "Hw1".
- Create a new directory, UT2004\Hw1\Classes. All
your class files should go in this directory.
- Open WOTGreal and select "ut2004" -> "Refresh
Package/Class Tree" menu option.
- Edit UT2004\System\UT2004.ini and add "EditPackages=Hw1" to the
appropriate section of the file.
Testing your project
To test your project, run UT2004 and start a Death Match game (you can
use a multiplayer option or "instant action") using the DM-hw1 map. The map should already contain a weapon
pickup for a DiscriminatingShockRifle.
Pickup the weapon and practice shooting at Bots and at other players
(including yourself). You should be able to damage and kill Bots but not
be able to hurt yourself or any other players that enter your game. You
can set the number of Bots in the level before starting the level. I
suggest keeping this number to 1 or 0. Make sure you test your weapon on
at least one other player that enters the game in multiplayer mode.
What you must turn in
To get credit for your work, you must submit a single UMod file.
The UMod file should contain your modified weapon class, written in DiscriminatingShockRifle.uc --
containing a subclass of ShockRifle -- as well as any additional class
files that you created to complete your work. You should not have modified
any class file that is part of the original UT2004 distribution.
Most importantly, your UMod should contain your succesfully compiled package
bytecode, hw1.u which should be unpacked into
UT2004\System when the UMod is installed.
You should also write a readme.txt which describes
exactly how your homework project works. For example, what does your modified weapon do, exactly. What special things do you
have to do in the game to use your modified
weapon correctly. The readme.txt should be in your UT2004/Hw1 directory (not UT2004/Hw1/Classes). Make sure that
this file is included in your UMod.
Your UMod should not contain any map files! Nor should it
How to create a UMod for homework submission
Create a textfile called hw1mod.ini that looks something like this:
Next create a textfile called hw1mod.int that looks something like this:
Put these files in your UT2004/System directory. Then from the commandline run "ucc master hw1mod".
Or use UMod Wizard.
If your umod does not extract on the computer I use for grading, no credit will be given.