Worst-case scenario: the UEd Goblin wipes the map and burns down your house.
UE3:UTWeapon instance functions (UT3)
Contents
- 1 Instance functions
- 1.1 Activate
- 1.2 ActiveRenderOverlays
- 1.3 AddAmmo
- 1.4 AdjustPlayerDamage
- 1.5 AdjustWeaponTimingForConsole
- 1.6 AllowSwitchTo
- 1.7 AmmoMaxed
- 1.8 AttachMuzzleFlash
- 1.9 AttachWeaponTo
- 1.10 BestMode
- 1.11 bReadyToFire
- 1.12 CalcInventoryWeight
- 1.13 CanAttack
- 1.14 CanHeal
- 1.15 CanThrow
- 1.16 CanViewAccelerationWhenFiring
- 1.17 ChangeVisibility
- 1.18 CheckZoom
- 1.19 ClientEndFire
- 1.20 ClientWeaponSet
- 1.21 ClientWeaponThrown
- 1.22 ConsumeAmmo
- 1.23 CoversScreenSpace
- 1.24 CreateOverlayMesh
- 1.25 DenyPickupQuery
- 1.26 DesireAmmo
- 1.27 DetachMuzzleFlash
- 1.28 DetachWeapon
- 1.29 DisplayDebug
- 1.30 DrawLockedOn
- 1.31 DrawWeaponCrosshair
- 1.32 DropFrom
- 1.33 EnableFriendlyWarningCrosshair
- 1.34 EndFire
- 1.35 EndZoom
- 1.36 FireAmmunition
- 1.37 FireHack
- 1.38 FireOnRelease
- 1.39 FiringPutDownWeapon
- 1.40 GetAmmoCount
- 1.41 GetArmAnimNodeSeq
- 1.42 GetEffectLocation
- 1.43 GetEquipTime
- 1.44 GetFireInterval
- 1.45 GetHand
- 1.46 GetOptimalRangeFor
- 1.47 GetOwnerName
- 1.48 GetPhysicalFireStartLoc
- 1.49 GetViewAxes
- 1.50 GetWeaponRating
- 1.51 GetZoomedState
- 1.52 GivenTo
- 1.53 HasAmmo
- 1.54 HasAnyAmmo
- 1.55 HolderEnteredVehicle
- 1.56 InstantAimHelp
- 1.57 InstantFire
- 1.58 InstantFireEndTrace
- 1.59 InstantFireStartTrace
- 1.60 IsFullyCharged
- 1.61 LagRot
- 1.62 Loaded
- 1.63 NeedAmmo
- 1.64 PlayArmAnimation
- 1.65 PlayFireEffects
- 1.66 PlayFiringSound
- 1.67 PlayWeaponAnimation
- 1.68 PlayWeaponEquip
- 1.69 PlayWeaponPutDown
- 1.70 PreloadTextures
- 1.71 ProcessInstantHit
- 1.72 ProjectileFire
- 1.73 ReadyToFire
- 1.74 RefireCheckTimer
- 1.75 SendToFiringState
- 1.76 ServerReselectWeapon
- 1.77 ServerStartFire
- 1.78 SetMuzzleFlashParams
- 1.79 SetSkin
- 1.80 SetupArmsAnim
- 1.81 SetWeaponOverlayFlags
- 1.82 ShakeView
- 1.83 ShouldFireWithoutTarget
- 1.84 ShouldLagRot
- 1.85 ShouldSwitchTo
- 1.86 SplashJump
- 1.87 StartFire
- 1.88 StartZoom
- 1.89 StillFiring
- 1.90 StopFireEffects
- 1.91 ThrottleLook
- 1.92 TimeWeaponEquipping
- 1.93 TimeWeaponPutDown
- 1.94 TryPutDown
- 1.95 WeaponEmpty
- 1.96 WeaponPlaySound
- UTWeapon instance functions in other games:
- UDK
- Other member categories for this class:
- internal variables
This is an auto-generated page and may need human attention. Please remove the {{autogenerated}} tag if the page seems reasonably complete or replace it with the {{expand}} tag if the page is not yet complete. |
Instance functions
Activate
Overrides: Weapon.Activate
All inventory use the Activate() function when an item is selected for use. For weapons, this function starts the Equipping process. If the weapon is the inactive state, it will go to the 'WeaponEquipping' followed by 'Active' state, and ready to be fired.
ActiveRenderOverlays
Overrides: Inventory.ActiveRenderOverlays
Access to HUD and Canvas. Event always called when the InventoryManager considers this Inventory Item currently "Active" (for example active weapon)
Parameters:
- HUD - HUD with canvas to draw on
AddAmmo
Overrides: Weapon.AddAmmo
This function is used to add ammo back to a weapon. It's called from the Inventory Manager
AdjustPlayerDamage
called every time owner takes damage while holding this weapon - used by shield gun
AdjustWeaponTimingForConsole
Adjust weapon equip and fire timings so they match between PC and console This is important so the sounds match up.
AllowSwitchTo
called on both Instigator's current weapon and its pending weapon (if they exist)
Returns:
- whether Instigator is allowed to switch to NewWeapon
AmmoMaxed
Returns true if the ammo is maxed out
AttachMuzzleFlash
Called on a client, this function Attaches the WeaponAttachment to the Mesh.
AttachWeaponTo
Overrides: Weapon.AttachWeaponTo
Attach Weapon Mesh, Weapon MuzzleFlash and Muzzle Flash Dynamic Light to a SkeletalMesh
Parameters:
- who - is the pawn to attach to
BestMode
BestMode() choose between regular or alt-fire
bReadyToFire
Returns:
- false if the weapon isn't ready to be fired. For example, if it's in the Inactive/WeaponPuttingDown states.
CalcInventoryWeight
Each Weapon needs to have a unique InventoryWeight in order for weapon switching to work correctly. This function calculates that weight using the various inventory values
CanAttack
Overrides: Weapon.CanAttack
return false if out of range, can't see target, etc.
CanHeal
CanHeal() used by bot AI should return true if this weapon is able to heal Other
CanThrow
Overrides: Weapon.CanThrow
Returns true if this item can be thrown out.
CanViewAccelerationWhenFiring
This determines whether or not the Weapon can have ViewAcceleration when Firing.
ChangeVisibility
This function is called from the pawn when the visibility of the weapon changes
CheckZoom
We Override beginfire to add support for zooming. Should only be called from BeginFire()
Parameters:
- FireModeNum - The current Firing Mode
Returns:
- true we should abort the BeginFire call
ClientEndFire
ClientWeaponSet
Overrides: Weapon.ClientWeaponSet
(Description copied from Weapon.ClientWeaponSet)
is called by the server to tell the client about potential weapon changes after the player runs over a weapon (the client decides whether to actually switch weapons or not. Network: LocalPlayer
Parameters:
- bOptionalSet - Set to true if the switch is optional. (simple weapon pickup and weight against current weapon).
ClientWeaponThrown
Overrides: Weapon.ClientWeaponThrown
This function is called when the client needs to discard the weapon
ConsumeAmmo
Overrides: Weapon.ConsumeAmmo
Consumes some of the ammo
CoversScreenSpace
CreateOverlayMesh
DenyPickupQuery
Overrides: Weapon.DenyPickupQuery
When you pickup an weapon, the inventory system has a chance to restrict the pickup.
DesireAmmo
This function retuns how much of the clip is empty.
DetachMuzzleFlash
Remove/Detach the muzzle flash components
DetachWeapon
Overrides: Weapon.DetachWeapon
Detach weapon from skeletal mesh
Parameters:
- SkeletalMeshComponent - weapon is attached to.
DisplayDebug
Overrides: Weapon.DisplayDebug
list important Weapon variables on canvas. HUD will call DisplayDebug() on the current ViewTarget when the ShowDebug exec is used
Parameters:
- HUD - HUD with canvas to draw on
- out_YL - Height of the current font
- out_YPos - Y position on Canvas. out_YPos += out_YL, gives position to draw text for next debug line.
DrawLockedOn
Draw the locked on symbol
DrawWeaponCrosshair
Draw the Crosshairs
DropFrom
Overrides: Weapon.DropFrom
(Description copied from Weapon.DropFrom)
Drop this weapon out in to the world
Parameters:
- StartLocation - The World Location to drop this item from
- StartVelocity - The initial velocity for the item when dropped
EnableFriendlyWarningCrosshair
EndFire
Overrides: Weapon.EndFire
We Override endfire to add support for zooming
EndZoom
Called when zooming ends
Parameters:
- PC - cast of Instigator.Controller for convenience
FireAmmunition
Overrides: Weapon.FireAmmunition
Deactiveate Spawn Protection
FireHack
FireOnRelease
Overrides: Weapon.FireOnRelease
tells AI that it needs to release the fire button for this weapon to do anything
FiringPutDownWeapon
GetAmmoCount
GetArmAnimNodeSeq
GetEffectLocation
Returns:
- the location + offset from which to spawn effects (primarily tracers)
GetEquipTime
GetFireInterval
Overrides: Weapon.GetFireInterval
Returns interval in seconds between each shot, for the firing state of FireModeNum firing mode.
Parameters:
- FireModeNum - fire mode
Returns:
- Period in seconds of firing mode
GetHand
Returns the current Weapon Hand
GetOptimalRangeFor
used by bot AI to get the optimal range for shooting Target can be called on friendly Targets if trying to heal it
GetOwnerName
GetPhysicalFireStartLoc
Overrides: Weapon.GetPhysicalFireStartLoc
This function returns the world location for spawning the projectile, pulled in to the Pawn's collision along the AimDir direction.
GetViewAxes
Overrides: Weapon.GetViewAxes
Pawn/Controller/View functions
GetWeaponRating
Overrides: Weapon.GetWeaponRating
Returns a weight reflecting the desire to use the given weapon, used for AI and player best weapon selection.
Parameters:
- Weapon - W
Returns:
- Weapon rating (range -1.f to 1.f)
GetZoomedState
Returns true if we are currently zoomed
GivenTo
Overrides: Weapon.GivenTo
(Description copied from Weapon.GivenTo)
This Weapon has just been given to this Pawn
Parameters:
- thisPawn - new weapon owner
HasAmmo
Overrides: Weapon.HasAmmo
This function checks to see if the weapon has any ammo available for a given fire mode.
Parameters:
- FireModeNum - The Fire Mode to Test For
- Amount - Optional] Check to see if this amount is available. If 0 it will default to checking for the ShotCost
HasAnyAmmo
Overrides: Weapon.HasAnyAmmo
returns true if this weapon has any ammo
HolderEnteredVehicle
called when Instigator enters a vehicle while we are its Weapon
InstantAimHelp
Look for "near miss" of target within UTPC.AimHelpModifier() * AimingHelpRadius Return that target as a hit if it was a near miss
InstantFire
Overrides: Weapon.InstantFire
Performs an 'Instant Hit' shot. Also, sets up replication for remote clients, and processes all the impacts to deal proper damage and play effects.
Network: Local Player and Server
InstantFireEndTrace
Returns:
- end trace position for instantfire()
InstantFireStartTrace
Returns:
- position of trace start for instantfire()
IsFullyCharged
Returns:
- whether this is a charging weapon and is fully charged up
LagRot
Loaded
Cheat Help function the loads out the weapon
Parameters:
- bUseWeaponMax - Optional] If true, this function will load out the weapon with the actual maximum, not 999
NeedAmmo
Returns true if the current ammo count is less than the default ammo count
PlayArmAnimation
PlayFireEffects
Overrides: Weapon.PlayFireEffects
PlayFireEffects Is the root function that handles all of the effects associated with a weapon. This function creates the 1st person effects. It should only be called on a locally controlled player.
PlayFiringSound
Overrides: Weapon.PlayFiringSound
Tells the weapon to play a firing sound (uses CurrentFireMode)
PlayWeaponAnimation
Overrides: Weapon.PlayWeaponAnimation
(Description copied from Weapon.PlayWeaponAnimation)
Play an animation on the weapon mesh Network: Local Player and clients
Parameters:
- Anim - Sequence to play on weapon skeletal mesh
- desired - duration, in seconds, animation should be played
PlayWeaponEquip
Show the weapon begin equipped
PlayWeaponPutDown
Show the weapon being put away
PreloadTextures
ProcessInstantHit
Overrides: Weapon.ProcessInstantHit
(Description copied from Weapon.ProcessInstantHit)
Processes a successful 'Instant Hit' trace and eventually spawns any effects. Network: LocalPlayer and Server
Parameters:
- HitActor - Actor hit by trace
- AimDir - Aim direction of shot
- HitLocation - world location vector where HitActor was hit by trace
- HitNormal - hit normal vector
- HitInto - TraceHitInfo struct returning useful info like component hit, bone, material..
ProjectileFire
Overrides: Weapon.ProjectileFire
Fires a projectile. Spawns the projectile, but also increment the flash count for remote client effects. Network: Local Player and Server
ReadyToFire
ReadyToFire() called by NPC firing weapon. bFinished should only be true if called from the Finished() function
RefireCheckTimer
Overrides: Weapon.RefireCheckTimer
SendToFiringState
Overrides: Weapon.SendToFiringState
Don't send a zoomed fire mode in to a firing state
ServerReselectWeapon
This function is called whenever you attempt to reselect the same weapon
ServerStartFire
Overrides: Weapon.ServerStartFire
When StartFire() is called on a client, it replicates the start by calling ServerStartFire. This begins the event on server. Server side actors (such as bots) should not call ServerStartFire directly and should instead call StartFire().
Network: Dedicated Server only, or Listen Server for remote clients.
SetMuzzleFlashParams
Allows a child to setup custom parameters on the muzzle flash
SetSkin
Material control
Parameters:
- NewMaterial - The new material to apply or none to clear it
SetupArmsAnim
SetWeaponOverlayFlags
ShakeView
plays view shake on the owning client only
ShouldFireWithoutTarget
called by AI when camping/defending return true if it is useful to fire this weapon even though bot doesn't have a target for example, a weapon that launches turrets or mines
ShouldLagRot
Returns:
- whether the weapon's rotation is allowed to lag behind the holder's rotation
ShouldSwitchTo
returns true if this weapon is currently lower priority than InWeapon used to determine whether to switch to InWeapon this is the server check, so don't check clientside settings (like weapon priority) here
SplashJump
return true if recommend jumping while firing to improve splash damage (by shooting at feet) true for R.L., for example
StartFire
Overrides: Weapon.StartFire
Called on the LocalPlayer, Fire sends the shoot request to the server (ServerStartFire) and them simulates the firing effects locally. Call path: PlayerController::StartFire -> Pawn::StartFire -> InventoryManager::StartFire Network: LocalPlayer
StartZoom
Called when zooming starts
Parameters:
- PC - cast of Instigator.Controller for convenience
StillFiring
Overrides: Weapon.StillFiring
This function returns true if the weapon is still firing in a given mode
StopFireEffects
Overrides: Weapon.StopFireEffects
StopFireEffects Main function to stop any active effects This is called from Pawn::WeaponStoppedFiring
ThrottleLook
Allow the weapon to adjust the turning speed of the pawn
Parameters:
- aTurn - The aTurn value from PlayerInput to throttle
- aLookup - The aLookup value from playerInput to throttle
FIXME: Add support for validation on a server
TimeWeaponEquipping
Overrides: Weapon.TimeWeaponEquipping
Sets the timing for equipping a weapon. The WeaponEquipped event is trigged when expired
TimeWeaponPutDown
Overrides: Weapon.TimeWeaponPutDown
Sets the timing for putting a weapon down. The WeaponIsDown event is trigged when expired
TryPutDown
Overrides: Weapon.TryPutDown
When attempting to put the weapon down, look to see if our MinReloadPct has been met. If so just put it down
WeaponEmpty
Overrides: Weapon.WeaponEmpty
Called when the weapon runs out of ammo during firing
WeaponPlaySound
Overrides: Weapon.WeaponPlaySound
(Description copied from Weapon.WeaponPlaySound)
This function handles playing sounds for weapons. How it plays the sound depends on the following:
If we are a listen server, then this sound is played and replicated as normal If we are a remote client, but locally controlled (ie: we are on the client) we play the sound and don't replicate it If we are a dedicated server, play the sound and replicate it to everyone BUT the owner (he will play it locally).
Parameters:
- SoundCue - The Source Cue to play