-
Book Overview & Buying
-
Table Of Contents
Unreal Development Kit Game Programming with UnrealScript: Beginner's Guide
By :
Looking in the class tree with UnCodeX, under Actor | Inventory | Weapon | UDKWeapon | UTWeapon, we can see the rocket launcher, shock rifle, and link gun are all subclasses. It might seem like we should subclass off of these since they're already made, but in order for us to be able to use inheritance with our classes we'll need to create a different branch here for our own weapons. Let's do that now.
Create a new file in our Development/Src/AwesomeGame/Classes folder called AwesomeWeapon.uc
. While we're here, let's delete AwesomeGun, AnotherGun, and UberActor if they're still there. Now we should have AwesomeActor, AwesomeGame, AwesomePlayerController, and now AwesomeWeapon.
Type the following code into it:
class AwesomeWeapon extends UTWeapon;
var int CurrentWeaponLevel;
function UpgradeWeapon()
{
CurrentWeaponLevel++;
}
defaultproperties
{
}We're adding an int to keep track of our weapon's level, and putting a function in so we can increase...
Change the font size
Change margin width
Change background colour