UnrealScript Game Programming Cookbook

(Chris Devlin) #1
Chapter 8

241


  1. Compile the project and load your map. Hit the H key when it loads and take a look at
    your new debug menu!


How it works...


To make a debug menu we first needed to extend from UDK's CheatManager, which is a
series of executable functions that allow us to alter the way the game works. We create our
own cheat manager, which is really our debug screen, and allow it to combine various debug
functions on one page.


Our functions are organized into a struct type, which holds the name and command of the
debug function we're trying to call, such as Show PATHS. We then call a new function in our
HUD that we created called DrawDebugText, which actually draws the text on the screen.


In the defaultproperties block of our DebugMenu class, we list the number
of pages that we'll be using to organize our debug menu. Finally, we head to our
TutorialPlayerController class and in the defaultproperties block we told it to
use our DebugMenu class as the default cheat class, instead of the one previously defined.


Be sure to go to UDKGame.ini and scroll down to the bottom; you will
find your game HUD. Mine is listed as [tutorial.TutorialHUD].
Make sure that your bShowHUD value is set to true.
Free download pdf