UnrealScript Game Programming Cookbook

(Chris Devlin) #1
Chapter 6

165


  1. Our weapon will use a number of sounds that we didn't previously need,
    such as locking onto a pawn, as well as losing lock. So let's add those now.
    // Sound effects
    WeaponFireSnd[0] =
    SoundCue'A_Weapon_ShockRifle.Cue.A_Weapon_SR_FireCue'
    WeaponFireSnd[1]=SoundCue'A_Weapon_RocketLauncher.Cue.
    A_Weapon_RL_Fire_Cue'
    WeaponEquipSnd=
    SoundCue'A_Weapon_ShockRifle.Cue.A_Weapon_SR_RaiseCue'
    WeaponPutDownSnd=
    SoundCue'A_Weapon_ShockRifle.Cue.A_Weapon_SR_LowerCue'
    PickupSound=SoundCue'A_Pickups.Weapons.Cue.
    A_Pickup_Weapons_Shock_Cue'
    LockAcquiredSound=SoundCue'A_Weapon_RocketLauncher.Cue.
    A_Weapon_RL_SeekLock_Cue'
    LockLostSound=SoundCue'A_Weapon_RocketLauncher.Cue.
    A_Weapon_RL_SeekLost_Cue'

  2. We won't be the only one to use this weapon, as bots will be picking it up during
    Deathmatch style games as well. Therefore, we want to declare some logic for the
    bots, such as how strongly they will desire it, and whether or not they can use it for
    things like sniping.
    // AI logic
    MaxDesireability=0.65 // Max desireability for bots
    AIRating=0.65
    CurrentRating=0.65
    bInstantHit=false // Is it an instant hit weapon?
    bSplashJump=false


// Can a bot use this for splash damage?
bRecommendSplashDamage=true

// Could a bot snipe with this?
bSniping=false

// Should it fire when the mouse is released?
ShouldFireOnRelease(0)=0

// Should it fire when the mouse is released?
ShouldFireOnRelease(1)=0


  1. We need to create an offset for the camera too, otherwise the weapon wouldn't
    display correctly as we switch between first and third person cameras.
    // Holds an offset for spawning projectile effects
    FireOffset=(X=20,Y=5)


// Offset from view center (first person)
PlayerViewOffset=(X=17,Y=10.0,Z=-8.0)
Free download pdf