Time for action – Creating the weapon branch
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 calledAwesomeWeapon.uc
. While we're here, let's deleteAwesomeGun
,AnotherGun
, andUberActor
if they're still there. Now we should haveAwesomeActor
,AwesomeGame
,AwesomePlayerController
, and nowAwesomeWeapon
.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...