-
Book Overview & Buying
-
Table Of Contents
Unreal Development Kit Game Programming with UnrealScript: Beginner's Guide
By :
Declaring an exec function is easy enough; using it is almost as easy. Let's make a function that will make it easier to test our game by upgrading our weapon when we call it. Exec functions can only be used in a few places, mostly Controller, Pawn, GameInfo, and CheatManager (which can be subclassed and put in the default properties of a PlayerController). For this experiment we'll put ours in AwesomePlayerController.
First, let's delete all of the cheeseburger functions and related variables and default properties from AwesomeEnemySpawner so we don't get logs from that class anymore.
Now for the function declaration. Add the following function to AwesomePlayerController:
exec function Upgrade()
{
if(Pawn != none && AwesomeWeapon(Pawn.Weapon) != none)
AwesomeWeapon(Pawn.Weapon).UpgradeWeapon();
}This will test if we have a Pawn and it's holding an AwesomeWeapon, and if so upgrade it. Easy!
That's all we need to do in the classes, so let's...
Change the font size
Change margin width
Change background colour