UnrealScript Game Programming Cookbook

(Chris Devlin) #1
Chapter 6

167

MuzzleFlashDuration=0.33
MuzzleFlashLightClass=
class'UTGame.UTShockMuzzleFlashLight'
CrossHairCoordinates=(U=256,V=0,UL=64,VL=64)
LockerRotation=(Pitch=32768,Roll=16384)

// Crosshair
IconCoordinates=(U=728,V=382,UL=162,VL=45)
IconX=400
IconY=129
IconWidth=22
IconHeight=48

/** The Color used when drawing the Weapon's Name on the
HUD */
WeaponColor=(R=160,G=0,B=255,A=255)


  1. Since weapons are part of a pawn's inventory, we need to declare which slot this
    weapon will fall into (from one to nine).
    // Inventory
    InventoryGroup=4 // The weapon/inventory set, 0-9
    GroupWeight=0.5 // position within inventory group.
    (used by prevweapon and nextweapon)

  2. Our final piece of code has to do with rumble feedback with the Xbox gamepad.
    This is not only used on consoles, but also it is generally reserved for it.
    /* Manages the waveform data for a forcefeedback device,
    specifically for the xbox gamepads.
    /
    Begin Object Class=ForceFeedbackWaveform
    Name=ForceFeedbackWaveformShooting1
    Samples(0)=(LeftAmplitude=90,RightAmplitude=40,
    LeftFunction=WF_Constant,
    RightFunction=WF_LinearDecreasing,Duration=0.1200)
    End Object


// controller rumble to play when firing
WeaponFireWaveForm=ForceFeedbackWaveformShooting1
}


  1. All that's left to do is to add the weapon to your pawn's default inventory. You
    can easily do this by adding the following line to your TutorialGame class's
    defaultproperties block:


defaultproperties
{
DefaultInventory(0)=class'MyWeapon_HomingRocket'
}
Free download pdf