I don't need to test my programs. I have an error-correcting modem.
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 PerformWeaponChange
- 1.65 PlayArmAnimation
- 1.66 PlayFireEffects
- 1.67 PlayFiringSound
- 1.68 PlayWeaponAnimation
- 1.69 PlayWeaponEquip
- 1.70 PlayWeaponPutDown
- 1.71 PreloadTextures
- 1.72 ProcessInstantHit
- 1.73 ProjectileFire
- 1.74 ReadyToFire
- 1.75 RefireCheckTimer
- 1.76 SendToFiringState
- 1.77 ServerReselectWeapon
- 1.78 ServerStartFire
- 1.79 SetMuzzleFlashParams
- 1.80 SetSkin
- 1.81 SetupArmsAnim
- 1.82 SetWeaponOverlayFlags
- 1.83 ShakeView
- 1.84 ShouldFireWithoutTarget
- 1.85 ShouldLagRot
- 1.86 ShouldSwitchTo
- 1.87 SplashJump
- 1.88 StartFire
- 1.89 StartZoom
- 1.90 StillFiring
- 1.91 StopFireEffects
- 1.92 ThrottleLook
- 1.93 TimeWeaponEquipping
- 1.94 TimeWeaponPutDown
- 1.95 TryPutDown
- 1.96 WeaponEmpty
- 1.97 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[edit]
Activate[edit]
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[edit]
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[edit]
Overrides: Weapon.AddAmmo
This function is used to add ammo back to a weapon. It's called from the Inventory Manager
AdjustPlayerDamage[edit]
called every time owner takes damage while holding this weapon - used by shield gun
AdjustWeaponTimingForConsole[edit]
Adjust weapon equip and fire timings so they match between PC and console This is important so the sounds match up.
AllowSwitchTo[edit]
called on both Instigator's current weapon and its pending weapon (if they exist)
Returns:
- whether Instigator is allowed to switch to NewWeapon
AmmoMaxed[edit]
Returns true if the ammo is maxed out
AttachMuzzleFlash[edit]
Called on a client, this function Attaches the WeaponAttachment to the Mesh.
AttachWeaponTo[edit]
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[edit]
BestMode() choose between regular or alt-fire
bReadyToFire[edit]
Returns:
- false if the weapon isn't ready to be fired. For example, if it's in the Inactive/WeaponPuttingDown states.
CalcInventoryWeight[edit]
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[edit]
Overrides: Weapon.CanAttack
return false if out of range, can't see target, etc.
CanHeal[edit]
CanHeal() used by bot AI should return true if this weapon is able to heal Other
CanThrow[edit]
Overrides: Weapon.CanThrow
Returns true if this item can be thrown out.
CanViewAccelerationWhenFiring[edit]
This determines whether or not the Weapon can have ViewAcceleration when Firing.
ChangeVisibility[edit]
This function is called from the pawn when the visibility of the weapon changes
CheckZoom[edit]
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[edit]
ClientWeaponSet[edit]
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[edit]
Overrides: Weapon.ClientWeaponThrown
This function is called when the client needs to discard the weapon
ConsumeAmmo[edit]
Overrides: Weapon.ConsumeAmmo
Consumes some of the ammo
CoversScreenSpace[edit]
CreateOverlayMesh[edit]
DenyPickupQuery[edit]
Overrides: Weapon.DenyPickupQuery
When you pickup an weapon, the inventory system has a chance to restrict the pickup.
DesireAmmo[edit]
This function retuns how much of the clip is empty.
DetachMuzzleFlash[edit]
Remove/Detach the muzzle flash components
DetachWeapon[edit]
Overrides: Weapon.DetachWeapon
Detach weapon from skeletal mesh
Parameters:
- SkeletalMeshComponent - weapon is attached to.
DisplayDebug[edit]
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[edit]
Draw the locked on symbol
DrawWeaponCrosshair[edit]
Draw the Crosshairs
DropFrom[edit]
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[edit]
EndFire[edit]
Overrides: Weapon.EndFire
We Override endfire to add support for zooming
EndZoom[edit]
Called when zooming ends
Parameters:
- PC - cast of Instigator.Controller for convenience
FireAmmunition[edit]
Overrides: Weapon.FireAmmunition
Deactiveate Spawn Protection
FireHack[edit]
FireOnRelease[edit]
Overrides: Weapon.FireOnRelease
tells AI that it needs to release the fire button for this weapon to do anything
FiringPutDownWeapon[edit]
GetAmmoCount[edit]
GetArmAnimNodeSeq[edit]
GetEffectLocation[edit]
Returns:
- the location + offset from which to spawn effects (primarily tracers)
GetEquipTime[edit]
GetFireInterval[edit]
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[edit]
Returns the current Weapon Hand
GetOptimalRangeFor[edit]
used by bot AI to get the optimal range for shooting Target can be called on friendly Targets if trying to heal it
GetOwnerName[edit]
GetPhysicalFireStartLoc[edit]
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[edit]
Overrides: Weapon.GetViewAxes
Pawn/Controller/View functions
GetWeaponRating[edit]
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[edit]
Returns true if we are currently zoomed
GivenTo[edit]
Overrides: Weapon.GivenTo
(Description copied from Weapon.GivenTo)
This Weapon has just been given to this Pawn
Parameters:
- thisPawn - new weapon owner
HasAmmo[edit]
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[edit]
Overrides: Weapon.HasAnyAmmo
returns true if this weapon has any ammo
HolderEnteredVehicle[edit]
called when Instigator enters a vehicle while we are its Weapon
InstantAimHelp[edit]
Look for "near miss" of target within UTPC.AimHelpModifier() * AimingHelpRadius Return that target as a hit if it was a near miss
InstantFire[edit]
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[edit]
Returns:
- end trace position for instantfire()
InstantFireStartTrace[edit]
Returns:
- position of trace start for instantfire()
IsFullyCharged[edit]
Returns:
- whether this is a charging weapon and is fully charged up
LagRot[edit]
Loaded[edit]
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[edit]
Returns true if the current ammo count is less than the default ammo count
PerformWeaponChange[edit]
Called when the pawn is changing weapons
PlayArmAnimation[edit]
PlayFireEffects[edit]
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[edit]
Overrides: Weapon.PlayFiringSound
Tells the weapon to play a firing sound (uses CurrentFireMode)
PlayWeaponAnimation[edit]
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[edit]
Show the weapon begin equipped
PlayWeaponPutDown[edit]
Show the weapon being put away
PreloadTextures[edit]
ProcessInstantHit[edit]
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[edit]
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[edit]
ReadyToFire() called by NPC firing weapon. bFinished should only be true if called from the Finished() function
RefireCheckTimer[edit]
Overrides: Weapon.RefireCheckTimer
SendToFiringState[edit]
Overrides: Weapon.SendToFiringState
Don't send a zoomed fire mode in to a firing state
ServerReselectWeapon[edit]
This function is called whenever you attempt to reselect the same weapon
ServerStartFire[edit]
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[edit]
Allows a child to setup custom parameters on the muzzle flash
SetSkin[edit]
Material control
Parameters:
- NewMaterial - The new material to apply or none to clear it
SetupArmsAnim[edit]
SetWeaponOverlayFlags[edit]
ShakeView[edit]
plays view shake on the owning client only
ShouldFireWithoutTarget[edit]
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[edit]
Returns:
- whether the weapon's rotation is allowed to lag behind the holder's rotation
ShouldSwitchTo[edit]
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[edit]
return true if recommend jumping while firing to improve splash damage (by shooting at feet) true for R.L., for example
StartFire[edit]
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[edit]
Called when zooming starts
Parameters:
- PC - cast of Instigator.Controller for convenience
StillFiring[edit]
Overrides: Weapon.StillFiring
This function returns true if the weapon is still firing in a given mode
StopFireEffects[edit]
Overrides: Weapon.StopFireEffects
StopFireEffects Main function to stop any active effects This is called from Pawn::WeaponStoppedFiring
ThrottleLook[edit]
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[edit]
Overrides: Weapon.TimeWeaponEquipping
Sets the timing for equipping a weapon. The WeaponEquipped event is trigged when expired
TimeWeaponPutDown[edit]
Overrides: Weapon.TimeWeaponPutDown
Sets the timing for putting a weapon down. The WeaponIsDown event is trigged when expired
TryPutDown[edit]
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[edit]
Overrides: Weapon.WeaponEmpty
Called when the weapon runs out of ammo during firing
WeaponPlaySound[edit]
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