Legacy:How UT Weapons Work/Switching To Another Weapon

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 06:00, 19 July 2002 by Wormbo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Switching weapons consists of two parts

  1. putting down the old weapon
  2. bringing up the new weapon

Putting Down The Old Weapon

Weapon changes can origin from different functions, like PlayerPawn.SwitchWeapon, .GetWeapon, .Prev/.NextWeapon or Pawn (UT).SwitchToBestWeapon. All these functions have a common structure:

  1. The pawn's PendingWeapon property is set to the new weapon.
  2. If the pawn's Weapon and PendingWeapon are already the same switching is aborted and nothing happens.
  3. If the pawn doesn't currently have a selected Weapon, PendingWeapon is brought up. Otherwise the current weapon's PutDown function is called. This function can in some cases abort the weapon change by returning False. (e.g. SwitchWeapon function)

Bringing Up The New Weapon

This part of the weapon change starts with the Pawn (UT).WeaponChanged function.

(...)