I don't need to test my programs. I have an error-correcting modem.

Legacy:TheHealer/TUTHealerAmmo

From Unreal Wiki, The Unreal Engine Documentation Site
< Legacy:TheHealer
Revision as of 21:11, 20 November 2003 by HSDanClark (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

TUTHealerAmmo - The Healer Part 3 of 9[edit]

In this part of the Healer tutorial, we will set up our ammo class – what defines the ammunition for our Healer. Before we get into the code, make sure that your file is set up correctly.

Filename: {Base Directory}/TheHealer/classes/TUTHealerAmmo.uc

If you've changed the name of the package folder or the filename itself, make sure you make those changes throughout the code we'll be working with.

Quick Link: This is the complete source code for people who want to skip ahead. If you want to copy/paste into your file, this is the page to do it on.

Here's something that you should remember, as it may come up on the SAT's or something:

Weapon is to WeaponPickup as Ammo is to AmmoPickup.

This is to say, Ammo (like Weapon), is not what you see in the game.

Heading and Class Declaration[edit]

In order to keep our code reader-friendly (always a good thing if you need someone's help!), we will add a standard comment block to the top of the file. This will describe what's going on in the file.

After the comment block, we declare the class. Make sure you name the class with the same name as the filename, or bad things happen.

//------------------------------------------------------------------------------
// class name : TUTHealerAmmo
// class type : Ammunition
// description: The Healer's ammunition properties
// author     : HSDanClark
//------------------------------------------------------------------------------
// TODO       :
//
//------------------------------------------------------------------------------
class TUTHealerAmmo extends Ammunition;
  • Our pickup extends (or is a child of, so-to-speak) the Ammunition class.

Exec Directives and Variable Declarations[edit]

#EXEC OBJ LOAD FILE=InterfaceContent.utx

Here we load our texture package via an EXEC directive. This texture package contains the icon for the ammunition. We don't need any variables, since we have no functions.

Functions[edit]

None.

Default Properties[edit]

defaultproperties
{
    ItemName="Tutorial Healer Ammo"                     
    IconMaterial=Material'InterfaceContent.Hud.SkinA'
    IconCoords=(X1=545,Y1=150,X2=644,Y2=224)
 
    PickupClass=class'TUTHealerAmmoPickup'  // This links the ammo to the pickup
                                            // that you need to place in the game.
 
    MaxAmmo=120                             // The maximum Healer ammo you can carry
 
    InitialAmount=40                        // The amount of ammo you get when you 
                                            // first pick up the Healer
}

Check out the comments in the script for details. Notice that we don't define how much each ammo pack is worth when you pick it up! That amount is defined in the ammo's pickup class, which we will see next.

The Next Step[edit]

Continue to Part 4, TheHealer/TUTHealerAmmoPickup

The complete tutorial map:

  1. Legacy:TheHealer/TUTHealer – Our main weapon class.
    1. Filename: {Base Directory}/TheHealer/classes/TUTHealer.uc
  2. Legacy:TheHealer/TUTHealerPickup – Our weapon's pickup class, what you see on the ground.
    1. Filename: {Base Directory}/TheHealer/classes/TUTHealerPickup.uc
  3. Legacy:TheHealer/TUTHealerAmmo – Our weapon's ammo class.
    1. Filename: {Base Directory}/TheHealer/classes/TUTHealerAmmo.uc
  4. Legacy:TheHealer/TUTHealerAmmoPickup – The ammo's pickup class, what you see on the ground.
    1. Filename: {Base Directory}/TheHealer/classes/TUTHealerAmmoPickup.uc
  5. Legacy:TheHealer/TUTHealerFire – Our weapon's primary fire class.
    1. Filename: {Base Directory}/TheHealer/classes/TUTHealerFire.uc
  6. Legacy:TheHealer/TUTHealerAltFire – Our weapon's alternate (secondary) fire class.
    1. Filename: {Base Directory}/TheHealer/classes/TUTHealerAltFire.uc
  7. Legacy:TheHealer/TUTHealerBeamEffect – The Healer's Beam Effect
    1. Filename: {Base Directory}/TheHealer/classes/TUTHealerBeamEffect.uc
  8. Legacy:TheHealer/TUTHealerAttachment – Our weapon's attachment class.
    1. Filename: {Base Directory}/TheHealer/classes/TUTHealerAttachment.uc
  9. Legacy:TheHealer/TUT The End – Putting it all together.

Discussion[edit]