UnrealScript Game Programming Cookbook

(Chris Devlin) #1

6


Weapons


In this chapter, we will be covering the following recipes:


f Creating a gun that fires homing missiles
f Creating a gun that heals pawns
f Creating a weapon that can damage over time
f Adding a flashlight to a weapon
f Creating an explosive barrel
f Creating a landmine

Introduction


Weapons in UDK are inventory items which can be handled by the player, and are generally
used to fire a projectile. On the surface, the default weapon system found in Unreal Engine
3 may appear to be catered to create various types of guns that are common in most FPS
games; but it's actually pretty easy to create various sorts of weapons and usable inventory
items, which may be found in other types of games, such as healing projectiles, bombs,
landmines, or flashlights, as in the case with Alan Wake.


Rather than reinvent the wheel, we're simply going to extend from the shock rifle for many of
our weapons, as its default abilities offer quite a bit of flexibility. We could dedicate an entire
book to creating an excellent base weapon and archetypes to extend from, but for simplicity's
sake we're going to create some practical examples in the following chapter. This knowledge
will allow you to easily create other similar types of weapons and devices.

Free download pdf