Game Development Reference
How it works...
By overriding UTWeapon's ProcessInstantHit() , we remove its default functionality
of performing damage on a pawn and instead do just the opposite; heal it! Alternatively, you
could set a function that causes damage to a pawn to a negative number, and that could also
heal the pawn.
We simply heal the pawn, let it know which pawn is performing the heal, and finally assign a
firing mode to the function. In our case, this is the secondary function for our new weapon.
Don't forget, arrays in UDK start at 0 , so 0 is really the first firing mode, and 1 is the second.
Also don't forget to change your pawn's default inventory, so that it
uses your new weapon!
See if you can make the weapon rapid fire by increasing its firing speed. This can be done in
the default properties again. You may want to decrease how much health each shot is worth,
however, otherwise you can increase a pawn's health to maximum capacity instantly.
Creating a weapon that can damage over
Damage over Time (DoT) weapons have been a staple in gaming for decades. They can
be anything from a pawn taking acid damage, falling into a pool of lava, drowning, or even
Our next recipe will have us creating a weapon that allows our pawn to take a set amount of
damage over a brief period of time. This will require both a weapon, as well as a number of
changes to our pawn.
Start by creating a new class called MyWeapon_PoisonDamage and have it extend
from MyWeapon .
class MyWeapon_PoisonDamage extends MyWeapon;