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

Having enemies flash quickly as their health decreases


Gamers require some sort of feedback each time something happens to their pawn. This can be auditory, visual, or kinetic (controller vibrations). Most frequently the cues are visual, as many controllers still do not support a vibration feature, however. Unreal Tournament pawns flash red briefly each time they are hit. While UDK natively does this, why not extend that idea, and bring back something from the NES era of gaming, wherein enemies flash red as their health decreases, and continues to do so more quickly as it reaches zero.

Getting ready

Start by having your IDE open and ready to make some changes. We won't have to create any new classes, but we will alter the behavior of our existing ones by adding some functions.

How to do it...

  1. Let's start by declaring the variables we'll use.

    /** Used for flashing damage as pawn's HP drops */
    var float           DamageOverlayTime;
    var LinearColor     DamageBodyMatColor;

    These will be used to store...