Sega 500
This presentation is the property of its rightful owner.
Sponsored Links
1 / 37

Sega 500 PowerPoint PPT Presentation

  • Uploaded on
  • Presentation posted in: General

Sega 500. Close Combat weapons. Jeff “Ezeikeil” Giles [email protected] So far. We’ve created a weapons template for mapping out all the weapon dependencies and a Flamethrower which fired globs of flaming goo. Today.

Download Presentation

Sega 500

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

Sega 500

Sega 500

Close Combat weapons

Jeff “Ezeikeil” Giles

[email protected]

So far

So far

  • We’ve created a weapons template for mapping out all the weapon dependencies and a Flamethrower which fired globs of flaming goo.



  • We’re going to get up close & personal by building a Tazer.

  • Using the Shield gun mesh & some of it’s functionality to shock our subject to death.

  • Our goal is to cover the basics of setting up this weapon.

Close combat

Close Combat

  • At it’s core, a close combat weapon is not all that different from the regular weapons in UT.

  • In effect, to build this I just used the template I build in lesson 21 & copied all these files into a new package.

  • I then added CC as a prefix to the namesCC as in “Close combat”.

Close combat1

Close Combat

  • It still derives from the Weapon base class and simply made some name changes…Only the changes are shown here:

Close combat2

Close Combat

class CCStick extends Weapon;




FireModeClass(0)=CCFire //what we shoot


//the pickup item which spawns this to our inventory




… <snip>

bMeleeWeapon=true //yes, I'm a close combat weapon...used in AI


Close combat3

Close Combat

class CCAmmoPickup extends UTAmmoPickup;



InventoryType=class'CCAmmo' //what item to create in inventory

PickupMessage="You picked up some CC-stick ammo“


Close combat4

Close Combat

class CCAmmo extends Ammunition;



ItemName="CC Charge" //our name




Close combat5

Close Combat

class CCStickPickup extends UTWeaponPickup;


{ //item created in inventory


//pickup message displayed to the player

PickupMessage="Close combat BoomStick!!!"


//mesh & draw type to use




Close combat6

Close Combat

class DamTypeCCStick extends WeaponDamageType;



//death messages to the player

DeathString="%o got smacked %k's S-Mart special."

MaleSuicide="%o Bitch slaped himself"

FemaleSuicide="%o Bitch slaped herself"

//what weapon class causes this message



Close combat7

Close Combat

class CCFire extends WeaponFire;

var class<DamageType> DamageType;

var int Damage;

var float range;



AmmoClass=class'CCAmmo' // what type of ammo to use





PreFireAnim=Charge // the charge ani in the shield gun







bFireOnRelease=true// fire when mouse button goes up


Close combat8

Close Combat

  • And these are all the BASIC changes needed to get our weapon in…

  • We can summon it…

Close combat9

Close Combat

  • We can pick it up

Close combat10

Close Combat

  • And we can use it.

  • Notice the sounds & are in and it animates.

  • However, it don’t do jack…no damage… nada…zip…nil!

Close combat11

Close Combat

  • But as you can see that by following this template, we go a new weapon in the game in under 10 minutes…

  • Hooray for good object orientation!!!

Close combat12

Close Combat

  • Ok, granted it doesn’t DO anything other than make some noise, but we have out starting point.

  • Lets start by making it deal some hurt. Then we’ll worry about pretty…

    Functionality over fashion.

Close combat13

Close Combat

  • So, open up the CCFire class & add one function named DoFireEffect.

  • This fella is going to calculate what we hit & deal damage for us.

    …In all it’s glory…

Close combat14

Close Combat

Function DoFireEffect()


local Vector HitLocation, HitNormal, StartTrace, EndTrace, X,Y,Z;

local Rotator Aim;

local Actor Other;



//where to start the trace from

StartTrace = Instigator.Location

//direction + error

Aim = AdjustAim(StartTrace, AimError);

//where the trace ends

EndTrace =a StartTrace + Range * Vector(Aim);

Close combat15

Close Combat

  • //trace from start to finish & returns what I hit

  • Other = Trace(HitLocation, HitNormal, EndTrace, StartTrace, true);

  • if ( Other != None && Other != Instigator )

  • {

    • if ( Pawn(Other) != None )

    • {

    • //hurt the opponent

    • Other.TakeDamage(Damage, Instigator, HitLocation, X+vect(0,0,0.5), DamageType);

    • }

    • else

    • Instigator.TakeDamage(Damage/2, Instigator, HitLocation,, DamageType)

  • }

Close combat16

Close Combat

  • Something to note: We’re not using a projectile here. This is an instant hit weapon which is why you see the trace functions.

  • Hence we also dispensed with projectile class from the class list.

Close combat17

Close Combat

  • What’s going on?

  • Weapon.GetViewAxes(X,Y,Z);

    • The orientation of the x,y,z axis of our weapon in model space…not world space

Close combat18

Close Combat

StartTrace = Instigator.Location;

//direction + error

Aim = AdjustAim(StartTrace, AimError);

//where the trace ends

EndTrace = StartTrace + Range * Vector(Aim);

  • Setting up our start & end points for the trace call.

Close combat19

Close Combat

Other = Trace(HitLocation, HitNormal, EndTrace, StartTrace, true);

  • Traceintrinsic(277) final function Actor Trace(out vector HitLocation, out vector HitNormal, vector TraceEnd, optional vector TraceStart, optional bool bTraceActors, optional vector Extent);Traced a line and see what it collides with first. Takes this actor's collision properties into account. Returns first hit actor, Level if hit level, or None if hit nothing.

Close combat20

Close Combat

  • In English…Draws a line from you to the end point in the direction your weapon is facing & returns the actor you hit.

Close combat21

Close Combat

  • Now, deal some damage:

if ( Other != None && Other != Instigator )


if ( Pawn(Other) != None )


//hurt the opponent

Other.TakeDamage(Damage, Instigator, HitLocation,

X+vect(0,0,0.5), DamageType);



//hurt ourselves

Instigator.TakeDamage(Damage/2, Instigator, HitLocation,,


Close combat22

Close Combat

  • Now we deal some pain…

Close combat23

Close Combat

  • This is all well & good, but we really have to make it interesting to look at.

  • Now that we’ve the function down…time for the fashion.

  • Since a Tazer is an electric shock weapon, lets cause some appropriate effects.

Close combat24

Close Combat

  • What we’re after:

  • Shock effect which ripples over the pawn.

  • A glow.

  • These are 2 separate effects.

Close combat25

Close Combat

  • The first thing to add was the blue flare around the torso of the pawn.

  • Defined here in one of the UT texture packages:


Close combat26

Close Combat

  • Nothing more than a texture which, like the fire from yesterday, is nicely wrapped up into an xEmitter for us.

  • So we can do pretty much the same thing…Spawn it & set it’s base.

Close combat27

Close Combat

local ShockProjElec BFlame;


//Add an additional flare effect on target pawn a






  • And that’s all it takes to give a pawn a nice healthy blue glow.

Close combat28

Close Combat

  • Lastly was the electric shock effect on the pawn.

  • Surprisingly, this is really quite easy to do, it’s just a matter of knowing where to look for it.

Close combat29

Close Combat

  • If you open up the XGameShaders in the texture browser you’ll find this one alone with a bunch of others.

  • Notice that it’s animated.

Close combat30

Close Combat

  • To get this effect in the game, we just have to add 2 lines of code.



  • But the big surprise is where.

Close combat31

Close Combat

class DamTypeCCStick extends WeaponDamageType;

  • In our custom damage type.

  • But if you think about it… Kind of makes sense. When damage occurs, render the overlay.

Close combat32

Close Combat

  • And that’s it, basic functionality for close combat weapons…

  • Now, some food for thought. Look at *how* this weapon works. It does a trace over a very short range…in effect, functioning like an instant fire weapon

Close combat33

Close Combat

  • This is as far as I got on close combat weapons. There’s a bit more to do, like binding the proper attachments and spawning impact effects on non-actor surfaces (like walls).

  • But the basics of the functionality are in and as you can see it does have a shocking effect on our opponents.

  • Login