sega 500 the ut2k3 gunsmith jeff “ezeikeil” giles [email protected] jgiles
TRANSCRIPT
Last day
We wrapped up states & state programming.
Learned how objects can exist in different states & how they can have different functionality and effects for each.
Today
Were going to desend into the one of the core elements that makes UT2k3 what it is.
We’re going to build our own, unique, stand alone weapon.
Gunsmithing for UT
This is not for the faint of heart, after poking around the forums, this looks like it’s causing lots of people some headaches.
To top it off, the weapon functionality has *completely* changed from the previous version of Unreal Tournament.
Gunsmithing for UT
The previous version was fairly straight forward in that it had very limited dependencies on other classes.
Usually limited to the weapon, ammo and projectile classes…
Gunsmithing for UT
This is no longer the case. For UT2k3, by my count, to get a unique
stand alone weapon you require a minimum of 8 classes.
Yes…EIGHT!
Gunsmithing for UT
Now, it’s true that you can radically change the functionality of a weapon in less…but that’s now what we want here.
In order to truly understand what’s going on with the weapons, and have a unique toy to play with, we need to build it from scratch.
Gunsmithing for UT
So our goal for today is not to build all the functionality for a completely unique weapon, but to cover all the bases of what’s required to build one.
We’ll do that tomorrow.
Gunsmithing for UT
So why the heck then does UT need to have 8 classes to get a weapon to function.
Consider all the parts we have to reference. Weapon
Inventory & pickup Ammo
Inventory & pickup Projectile
Type, fire class & damage type Attachment class
Object dependencies for the weapon
The Parent class is in brackets
Gunsmithing for UT
With this many inter dependant classes, explaining how one relates to another is a bit tricky, so bare with me…
Gunsmithing for UT
So the first thing to look at is all the parent classes that we’ll need to derive from…
Starting with Weaponclass BoomStick extends Weapon;
This class contains all the core functionality for the weapon operate.
Gunsmithing for UT
It’s an abstract class, so one can never instantiate a “weapon”, we must deriver from it.
It’s also huge, open it up & you’ll find all the functionality which is common to and required by all weapons in UT.
Gunsmithing for UT
Cut & paste the defaults from the link gun and change some defaults
DefaultProperties{ ItemName="BoomStick"
FireModeClass(0)=BoomFire //what we shoot FireModeClass(1)=BoomFire //the pickup item which spawns this to our inventory PickupClass=class'BoomStickPickup' ... Mesh=mesh'Weapons.LinkGun_1st' //which mesh to use… AttachmentClass=class'BoomAttach' //attachement class}
Gunsmithing for UT
From here, we’ll just step through the changes we made in the weapon defaults & see where it takes us.
The next change was the FireModeClass. Ours is very simple…
Gunsmithing for UT
In essence, defining what we shoot.
class BoomFire extends BioFire;
DefaultProperties{ AmmoClass=class'BoomAmmo' // what type of ammo to use ProjectileClass=class'Eze.BoomProj' //what projectile to spawn}
Gunsmithing for UT
Now, notice something rather important. There are 2 types for base fire classes, PojectileFire and Instantfire.
Using Instantfire is a bit more tricky, so we’re going to stick to projectiles for today.
Gunsmithing for UT
The next thing to set up is the ammo type we which to use:
class BoomAmmo extends Ammunition;
DefaultProperties{ ItemName="Boomstick shells" //our name IconMaterial=Material'InterfaceContent.Hud.SkinA' IconCoords=(X1=545,Y1=75,X2=644,Y2=149)
PickupClass=class'BoomAmmoPickup' // what our ammo pickup class is MaxAmmo=50 InitialAmount=20}
Gunsmithing for UT
And the ammo pickup class used by our weapon:
class BoomAmmoPickup extends UTAmmoPickup;
DefaultProperties{ InventoryType=class'BoomAmmo' //what item to create in inventory
PickupMessage="You picked up some BOOM-stick ammo" PickupSound=Sound'PickupSounds.FlakAmmoPickup' PickupForce="FlakAmmoPickup" // jdf… StaticMesh=StaticMesh'WeaponStaticMesh.BioAmmoPickup' //mesh to use DrawType=DT_StaticMesh}
Gunsmithing for UT
Recall how the inventory system works.
When you pickup an item, it spawns a different item in your inventory for use by the player.
Gunsmithing for UT
In this case:
This is why we have the double arrow in the diagram.
BoomAmmoPickup creates the BoomAmmo inventory item,
And the BoomAmmo knows what item creates it.
Gunsmithing for UT
Moving back to the projectilefire object, we also define a projectile type.
Essentially, not much more than what projectile to create.
class BoomProj extends BioGlob;
DefaultProperties{ //our damage class MyDamageType=class'DamTypeBoomStick‘}
Gunsmithing for UT
We now have our damage class which is specific to this projectile.
class DamTypeBoomStick extends WeaponDamageType;
defaultproperties{ //death messages to the player DeathString="%o bought %k's S-Mart special." MaleSuicide="%o ate his own boomstick" FemaleSuicide="%o ate her own boomstick"
//what weapon class causes this message WeaponClass=class'BoomStick'}
Gunsmithing for UT
This leads us back to the weapon, which has two other important classes.
The pickupclass,
and the attachement
Gunsmithing for UT
How the item appears in the world before pickup & what item it spawns into the players inventory
Gunsmithing for UT
class BoomStickPickup extends UTWeaponPickup;
DefaultProperties{ //item created in inventory InventoryType=class'BoomStick' //pickup message displayed to the player PickupMessage="BoomStick!!!" PickupSound=Sound'PickupSounds.FlakCannonPickup' PickupForce="BoomStickPickup"
MaxDesireability=+0.7 //mesh & draw type to use StaticMesh=StaticMesh'WeaponStaticMesh.LinkGunPickup' DrawType=DT_StaticMesh DrawScale=0.75}
Gunsmithing for UT
Finally, the attachment class
DefaultProperties
{
//how the weapon appears in 3rd person
Mesh=mesh'Weapons.LinkGun_3rd'
}
Gunsmithing for UT
Also in the ThirdPersonEffects function, I changed the muzzle flash type to
simulated event ThirdPersonEffects()
{ …//some code <snip>
MuzFlash3rd = Spawn(class'XEffects.RocketMuzFlash3rd');
Gunsmithing for UT
Okay, at this point we’ve templated out our weapon and (hopefully) covered all the bases.
We should get a customize linkgun which fires bioglobs (BoomProj actually…but we kept most of the functionality), has its own damage types and attachments to the pawn.
Gunsmithing for UT
Run UT, pull down the console and type:
You must call the pickup class, or nothing will appear.
Summon yourPackage.Boomstickpickup
Gunsmithing for UT
This is what should appear.
Yup! That the linkgun mesh…As expected.
Gunsmithing for UT
Walk over it like any other pickup.
Cool! It’s our pickup message from the BoomStickPickup class.
Gunsmithing for UT
Fire some goo
He-HEY! It works Now for the final test.
Suicide by my own hand.
Gunsmithing for UT
Even better, our own death messages.
Gunsmithing for UT
To summon the ammo pickups pull the console again & type
Summon yourPackage.BoomAmmoPickup
Your weapon now functions on it’s own ammo type…not the biogoo.
Gunsmithing for UT
However you can now also use the weapon placement items in the editor. It will appear there too.
Gunsmithing for UT
Using the editor…
Boomstick ammo xWeaponsBase which now acceptsThe Boomstick as a Valid weapon
Yes, they look like regular UT pickups…but they are ours
Gunsmithing for UT
Lastly, to be 100% complete, we need to set up our int’s so that our weapon appears in the menus.
Gunsmithing for UT
Starting with the weapon declaration in your packages int:
This will allow the weapon along with a description to be displayed in the menu.
[Public]Object=(Class=Class,MetaClass=Engine.Weapon,Name=eze.BoomStick, Description="Ezeikeil's custom boomstick... Shop smart... Shop S-mart.")
Gunsmithing for UT
For the ammo pickups:
[BoomAmmo]ItemName="Boomstick shells"
[BoomAmmoPickup]PickupMessage="You picked up some BOOM-stick ammo"
Gunsmithing for UT
The weapon itself:
[Boomstick]ItemName="Boomstick"
[BoomstickPickup]PickupMessage="Boomstick!!!"
Gunsmithing for UT
And the damage messages
[DamTypeBoomStick]DeathString="%o bought %k's S-Mart special."MaleSuicide="%o ate his own boomstick"FemaleSuicide="%o ate her own boomstick"
Gunsmithing for UT
This is important to know for 2 reasons.
First, the int file overrides the specified parameter listed in that class…
Gunsmithing for UT
Second, this provides an easy one-stop-shop to make changes to the messages displayed to the screen, without changing the code…handy for internationalization of the product.
Gunsmithing for UT
Exactly what is the int doing? Look at the boomstick, this can also be read as:
[Boomstick]
ItemName="Boomstick"
Class name
Variable nameValue
Gunsmithing for UT
This should make int files clear as mud right?
It’s just a matter of figuring out where things live.
The net result…
Gunsmithing for UT
My weapon
My weapon model
My description
Gunsmithing for UT
And all the other values we set will appear during gameplay.
Gunsmithing for UT
Ok, earth shattering functionality this isn’t, but look at what we do have…
We’ve mapped and templated all the basic steps that are required to create your own weapons in UT2k3.
That’s a wrap
That’s all for today. However, customizing the weapons in UT
is sufficiently complicated that we’ll spend the rest of the class building our own.
Consider this an in class assignment. Tomorrow, we’ll start making some
changes to the weapons functionality.