* Login   * Register * FAQ    * Search
It is currently Tue Feb 07, 2012 7:10 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sat Dec 13, 2008 11:39 am 
Offline

Joined: Sat Nov 15, 2008 11:54 am
Posts: 166
When you look at the class tree in editor is may seem a bit messed up and hard to grasp, but once you understand how it's build it gets a lot easier to navigate through.

Say you want to make a new bullit box for a sniper rifle, the default one has 10 bullet pickup and a max ammo set to 50. But you want it to be like 50 bullets on pickup and a max ammo count of 999. Here's what to do and a perfect example to tell a story about enharitance. first a screenshot of the classes:

Image

As you can see the bulletbox is located in : Actor > Inventory > Pickup > Ammo > TournamentAmmo > BulletBox

now, enheritance what is that? Well just like you and I classes enherit from their parents, classes however does not have a mom and dad, so we just refer to "them" as "parent class". What it means is that BulletBox have all the code build in that are inside any of it's parent classes, all the way back to the mother class : Actor. The way to make a new bulletbox is therefore simple, just make it a subclass of the BulletBox class and it will enherit all code of the BulletBox, it is done by beginning your script like this:

Code:
Class MyBulletBox extends BulletBox;


Now since all we want to do is to edit the properties of the BulletBox we don't need to add or change any code to the new class as the default bulletbox has all it takes, so we just change the properties like this:

Code:
Class MyBulletBox extends BulletBox;

defaultproperties:
{
     MaxAmmo=999
     AmmoAmount=50
}


Now there are loads of stuff you customize just by changing the default properties of some class, just open the class in editor and snoop arround it's properties, then you can make your new class suit your needs better by adding more stuff like this:

Code:
Class MyBulletBox extends BulletBox;

defaultproperties:
{
     MaxAmmo=999
     AmmoAmount=50
     PickupMessage="You got 50 more bullets, now nail some heads!"
     RespawnTime=10 // default is 30 seconds
     bRotatingPickup=True // default is False
     RotationRate=(Pitch=0,Yaw=10000,Roll=0) // default is (Pitch=0,Yaw=5000,Roll=0)
}


This will make a new bulletbox that rotates with double speed than default rotating pickups, it has a custom pickup message and 50 bullets per box and a max ammo count of 999.

Your new bulletbox will have all the code in it from these classes : Actor > Inventory > Pickup > Ammo > TournamentAmmo > BulletBox , just with altered properties.

Now just compile it and put it in the level and it will work just the same as any other bulletbox.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 15, 2008 7:35 am 
Offline
BANNED

Joined: Mon Aug 11, 2008 9:44 am
Posts: 848
Location: Coos Bay Oregon
Nicely done Dane. Well written!

And it's "inherit" :whip: rofl

Seriously, if you feel like adding sections, please do. I explain things not nearly as well as you but if I can start the discussion, then great. Clarify what you think should be clarified.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO