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 weapon that can damage over time

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 being poisoned.

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.

Getting ready

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

class MyWeapon_PoisonDamage extends MyWeapon;

How to do it...

We're only going to add one function to this class.

  1. Just as we did with our healing weapon, we need to override the UTWeapon class's ProcessInstantHit() ...

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