PacktLib: UnrealScript Game Programming Cookbook

UnrealScript Game Programming Cookbook


About the Author

About the Reviewers


Development Environments


Using UnCodeX

Dungeon Defenders to save the day

Unreal Script IDE


Unreal X-Editor

Editing runtime values with Remote Control

Archetypes and Prefabs


Constructing a leaking pipe prefab

Adding particles to our prefab

Adding audio effects to our prefab

Creating a PointLight archetype

Creating a subarchetype from an archetype

Scripting a Camera System


Configuring the engine and editor for a custom camera

Writing the TutorialCamera class

Camera properties and archetypes

Creating a first person camera

Creating a third person camera

Creating a side-scrolling camera

Creating a top-down camera

Crafting Pickups


Creating our first pickup

Creating a base for our pickup to spawn from

Animating our pickup

Altering what our pickup does

Allowing vehicles to use a pickup

AI and Navigation


Laying PathNodes on a map

Laying NavMeshes on a map

Adding a scout to create NavMesh properties

Adding an AI pawn via Kismet

Allowing a pawn to wander randomly around a map

Making a pawn patrol PathNodes on a map

Making a pawn randomly patrol PathNodes on a map

Allowing a pawn to randomly patrol a map with NavMeshes

Making a pawn follow us around the map with NavMeshes



Creating a gun that fires homing missiles

Creating a gun that heals pawns

Creating a weapon that can damage over time

Adding a flashlight to a weapon

Creating an explosive barrel

Creating a landmine



Displaying a bar for the player's health

Drawing text for a player's health

Displaying a bar for the player's ammo

Drawing text for the player's ammo

Drawing the player's name on screen

Creating a crosshair

Miscellaneous Recipes


Creating an army of companions

Having enemies flash quickly as their health decreases

Creating a crosshair that uses our weapon's trace

Changing the crosshair color when aiming at a pawn

Drawing a debug screen

Drawing a bounding box around pawns