| Home Page | Recent Changes | Preferences

TheHealer/TUTHealerPickup

TUTHealerPickup - The Healer Part 2 of 9

In this part of the Healer tutorial, we will set up our pickup class – what you see on the ground in the game. Before we get into the code, make sure that your file is set up correctly.

Filename: {Base Directory}/TheHealer/classes/TUTHealerPickup.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.

Heading and Class Declaration

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 : TUTHealerPickup
// class type : Pickup
// description: The Healer pickup - what sits on the ground
// author     : HSDanClark
//------------------------------------------------------------------------------
// TODO       :
//
//------------------------------------------------------------------------------
class TUTHealerPickup extends UTWeaponPickup
      placeable;
  • Our pickup extends (or is a child of, so-to-speak) the UTWeaponPickup class.
  • The placeable keyword allows us to place this object directly into a level within UnrealEd.

Functions

static function StaticPrecache(LevelInfo L)
{
    L.AddPrecacheMaterial(Texture'XEffectMat.link_muz_green');
    L.AddPrecacheMaterial(Texture'XEffectMat.link_muzmesh_green');
    L.AddPrecacheMaterial(Texture'XEffectMat.link_ring_green');
    L.AddPrecacheMaterial(Texture'XEffectMat.link_beam_green');
    L.AddPrecacheMaterial(Texture'XEffectMat.link_spark_green');
    L.AddPrecacheStaticMesh(StaticMesh'WeaponStaticMesh.linkprojectile');
    L.AddPrecacheStaticMesh(StaticMesh'WeaponStaticMesh.LinkGunPickup');
}

simulated function UpdatePrecacheMaterials()
{
    Level.AddPrecacheMaterial(Texture'XEffectMat.link_muz_green');
    Level.AddPrecacheMaterial(Texture'XEffectMat.link_muzmesh_green');
    Level.AddPrecacheMaterial(Texture'XEffectMat.link_ring_green');
    Level.AddPrecacheMaterial(Texture'XEffectMat.link_beam_green');
    Level.AddPrecacheMaterial(Texture'XEffectMat.link_spark_green');
}

simulated function UpdatePrecacheStaticMeshes()
{
    Level.AddPrecacheStaticMesh(StaticMesh'WeaponStaticMesh.linkprojectile');
    Super.UpdatePrecacheStaticMeshes();
}

These are the functions that load all the textures and materials that our weapon needs to look right. Notice that we're using textures, materials, and meshes from the Link Gun. This tutorial doesn't cover modelling/animating, texturing, or sound creations.

Default Properties

defaultproperties
{
    InventoryType=class'TUTHealer'
    PickupMessage="You got the Tutorial Healer."
    PickupSound=Sound'PickupSounds.LinkGunPickup'
    PickupForce="TUTHealerPickup"
    MaxDesireability=+0.7
    StaticMesh=StaticMesh'WeaponStaticMesh.LinkGunPickup'
    DrawType=DT_StaticMesh
    DrawScale=0.6
    Physics=PHYS_None
}

Let's take a look at the properties.

  • InventoryType – This line links this class to the weapon that it corresponds to.
  • PickupMessage – When you pick up a weapon in the game, this is the line of text that flashes onscreen for a moment.
  • PickupSound – The sound that you hear when you run over the weapon pickup in the game.
  • MaxDesireability – This value is used for the AI-controlled bots in their pathfinding.
  • StaticMesh – Again, we are using the Link Gun's properties here. This tutorial doesn't cover modelling.
  • DrawScale – This value is used to normalize a model within the game. If your model is slightly too big or too small, this value can be altered to make it the same size as the rest of your models.
  • Physics – The default value of the UT2003 weapons is PHYS_Rotating, but if you don't want your weapon pickup to rotate, you can set it to PHYS_None.

The Next Step

Continue to Part 3, TheHealer/TUTHealerAmmo

The complete tutorial map:

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

Discussion

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In