O'Reilly logo

UnrealScript Game Programming Cookbook by Dave Voyles

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a gun that heals pawns

UDK has built-in functionality for healing players through pickups such as health packs, but there is no way for one player to heal another.

In the following recipe, we'll create an instant hit weapon that heals a target for 10 points of health each time it is shot.

Getting ready

Start by creating a new class called MyWeapon_HealingInstantHit and have it extend from MyWeapon.

class MyWeapon_HealingInstantHit extends MyWeapon;

How to do it...

  1. The great thing about setting up our MyWeapon class is that adding additional functionality to it is a breeze. This class has only one function. Let's add the ProcessInstantHit() function now.

    First, we define the pawn that is being hit. Then, it takes the ProcessInstantHit() function ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required