Book Image

UnrealScript Game Programming Cookbook

By : Dave Voyles
Book Image

UnrealScript Game Programming Cookbook

By: Dave Voyles

Overview of this book

<p>Designed for high-level game programming, UnrealScript is used in tandem with the Unreal Engine to provide a scripting language that is ideal for creating your very own unique gameplay experience. By learning how to replicate some of the advanced techniques used in today's modern games, you too can take your game to the next level and stand out from the crowd.<br /><br />By providing a series of engaging and practical recipes, this "UnrealScript Game Programming Cookbook" will show you how to leverage the advanced functionality within UDK. You'll be shown how to implement a wide variety of practical features using the high-level scripting language ranging from designing your own HUD, creating your very own custom tailored weapons, to generating pathfinding solutions, and even meticulously crafting your own AI.<br /><br />Learn how you can fully augment your projects with UnrealScript, with the additional inclusion of specific techniques that cover disciplines as diverse as AI scripting and HUD design. Initially starting with recipes that cover tinkering with your IDE, developing archetypes, and scripting cameras, you'll soon move on to creating advanced artificial intelligence, weapons, and vehicles alongside unique HUD and inventory systems.</p> <p>&nbsp;</p>
Table of Contents (15 chapters)
UnrealScript Game Programming Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a gun that fires homing missiles


UDK already has a homing rocket launcher packaged with the dev kit (UTWeap_RocketLauncher). The problem however, is that it isn't documented well; it has a ton of excess code only necessary for multiplayer games played over a network, and can only lock on when you have loaded three rockets.

We're going to change all of that, and allow our homing weapon to lock onto a pawn and fire any projectile of our choice. We also need to change a few functions, so that our weapon fires from the correct location and uses the pawn's rotation and not the camera's. These are the same functions which we added to our ShockRifle class in Chapter 3, Scripting a Camera System. We'll need to create two classes for this first, so let's get started!

Getting ready

As I mentioned earlier, our main weapon for this chapter will extend from the UTWeap_ShockRifle, as that gun offers a ton of great base functionality which we can build from.

Let's start by opening your IDE and creating...