I'm a doctor, not a mechanic

UE3:Weapon (UDK)

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UDK Object >> Actor >> Inventory >> Weapon

Contents

Package: 
Engine
Direct subclass:
GameWeapon
This class in other games:
RTNP, U1, UT, UE2Runtime, U2XMP, UT2004, U2, UT2003, UT3

Base Weapon implementation.

Properties[edit]

Property group 'Weapon'[edit]

DefaultAnimSpeed[edit]

Type: float

When no duration is specified, speed to play anims.

Default value: 1.0

EquipTime[edit]

Type: float

How long does it take to Equip this weapon

Default value: 0.33

FireInterval[edit]

Type: array<float>

Holds the amount of time a single shot takes

FireOffset[edit]

Type: Object.Vector

Holds an offest for spawning protectile effects.

InstantHitDamage[edit]

Type: array<float>

How much damage does a given instanthit shot do

InstantHitMomentum[edit]

Type: array<float>

momentum transfer scaling for instant hit damage

Mesh[edit]

Type: MeshComponent

Modifiers: editinline

Weapon Mesh

PutDownTime[edit]

Type: float

How long does it take to put this weapon down

Default value: 0.33

Spread[edit]

Type: array<float>

How much of a spread between shots

WeaponRange[edit]

Type: float

Range of Weapon, used for Traces (InstantFire, ProjectileFire, AdjustAim...)

Default value: 16384.0

Internal variables[edit]

AIController[edit]

Type: AIController

Modifiers: protectedwrite

Current AI controlling this weapon

AIRating[edit]

Type: float


Default value: 0.5

bCanThrow[edit]

Type: bool

Can player toss his weapon out? Typically false for default inventory.

Default value: True

bInstantHit[edit]

Type: bool


bMeleeWeapon[edit]

Type: bool


bWasDoNotActivate[edit]

Type: bool

Set from ClientWeaponSet() when it has to go through PendingClientWeaponSet, to preserve those variables.

bWasOptionalSet[edit]

Type: bool

Set from ClientWeaponSet() when it has to go through PendingClientWeaponSet, to preserve those variables.

bWeaponPutDown[edit]

Type: bool

Set to put weapon down at the end of a state. Typically used to change weapons on state changes (weapon up, stopped firing...)

CachedMaxRange[edit]

Type: float

Cache MaxRange of weapon

CurrentFireMode[edit]

Type: byte

Current FireMode

FiringStatesArray[edit]

Type: array<name>

Array of firing states defining available firemodes

InstantHitDamageTypes[edit]

Type: array<class<DamageType> >

DamageTypes for Instant Hit Weapons

Priority[edit]

Type: float

Modifiers: databinding, config

Configurable weapon priority. Ties (mod weapons) are broken by GroupWeight

Default value: -1.0

ShouldFireOnRelease[edit]

Type: array<byte>


WeaponFireTypes[edit]

Type: array<EWeaponFireType>

Defines the type of fire (see Enum above) for each mode

WeaponProjectiles[edit]

Type: array<class<Projectile> >

The Class of Projectile to spawn

Default values[edit]

Property Value
bOnlyDirtyReplication False
bReplicateInstigator True
ItemName "Weapon"
RespawnTime 30.0

Enums[edit]

EWeaponFireType[edit]

This enum defines the firing type for the weapon. EWFT_InstantHit - The weapon traces a shot to determine a hit and immediately causes an effect EWFT_Projectile - The weapon spawns a new projectile pointed at the crosshair EWFT_Custom - Requires a custom fire sequence

EWFT_InstantHit 
EWFT_Projectile 
EWFT_Custom 
EWFT_None 

Functions[edit]

Static functions[edit]

PassThroughDamage[edit]

simulated static function bool PassThroughDamage (Actor HitActor)

returns true if should pass trace through this hitactor

Native functions[edit]

GetPhysicalFireStartLoc[edit]

simulated native event Object.Vector GetPhysicalFireStartLoc (optional Object.Vector AimDir)

This function returns the world location for spawning the projectile, pulled in to the Pawn's collision along the AimDir direction.

Events[edit]

Destroyed[edit]

simulated event Destroyed ()

Overrides: Inventory.Destroyed

Event called when weapon actor is destroyed

GetMuzzleLoc[edit]

simulated event Object.Vector GetMuzzleLoc ()

This function returns the world location for spawning the visual effects

GetTraceRange[edit]

simulated event float GetTraceRange ()

Range of weapon Used for Traces (CalcWeaponFire, InstantFire, ProjectileFire, AdjustAim...) State scoped accessor function. Override in proper state

Returns:

range of weapon, to be used mainly for traces.

IsFiring[edit]

simulated event bool IsFiring ()

Returns true if the weapon is firing, used by AI

Other instance functions[edit]

See Weapon instance functions.

States[edit]

Active[edit]

Modifiers: simulated

Active.BeginState[edit]

simulated event BeginState (name PreviousStateName)

Overrides: Object.BeginState (global)

Initialize the weapon as being active and ready to go.

Active.Activate[edit]

simulated function Activate ()

Overrides: Activate (global)

Activate() ignored since already active

Active.BeginFire[edit]

simulated function BeginFire (byte FireModeNum)

Overrides: BeginFire (global)

Override BeginFire so that it will enter the firing state right away.

Active.ReadyToFire[edit]

simulated function bool ReadyToFire (bool bFinished)

ReadyToFire() called by NPC firing weapon. bFinished should only be true if called from the Finished() function

Active.TryPutDown[edit]

simulated function bool TryPutDown ()

Overrides: TryPutDown (global)

Put the weapon down

Inactive[edit]

State Inactive Default state for a weapon. It is not active, cannot fire and resides in player inventory.

Modifiers: auto

Inactive.BeginState[edit]

simulated event BeginState (name PreviousStateName)

Overrides: Object.BeginState (global)

Clear out the PendingFires

Inactive.ServerStartFire[edit]

reliable server function ServerStartFire (byte FireModeNum)

Overrides: ServerStartFire (global)

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.

Inactive.ServerStopFire[edit]

reliable server function ServerStopFire (byte FireModeNum)

Overrides: ServerStopFire (global)

When StopFire is called on a client, ServerStopFire is used to initiate the sequence on the server. Network: Dedicated Server only, or Listen Server for remote clients.

Inactive.StartFire[edit]

simulated function StartFire (byte FireModeNum)

Overrides: StartFire (global)

do not allow firing in the inactive state

Inactive.TryPutDown[edit]

simulated function bool TryPutDown ()

Overrides: TryPutDown (global)

can't put down an inactive weapon

PendingClientWeaponSet[edit]

State PendingClientWeaponSet A weapon sets in this state on a remote client while it awaits full replication of all properties.

PendingClientWeaponSet.BeginState[edit]

simulated event BeginState (name PreviousStateName)

Overrides: Object.BeginState (global)

Event called when weapon enters this state

PendingClientWeaponSet.EndState[edit]

simulated event EndState (name NextStateName)

Overrides: Object.EndState (global)

Event called when weapon leaves this state

PendingClientWeaponSet.PendingWeaponSetTimer[edit]

simulated function PendingWeaponSetTimer ()


WeaponEquipping[edit]

State WeaponEquipping The Weapon is in this state while transitioning from Inactive to Active state. Typically, the weapon will remain in this state while its selection animation is being played. While in this state, the weapon cannot be fired.

Modifiers: simulated

WeaponEquipping.BeginState[edit]

simulated event BeginState (name PreviousStateName)

Overrides: Object.BeginState (global)

Called immediately when entering a state, while within the GotoState() call that caused the state change (before any state code is executed).

WeaponEquipping.EndState[edit]

simulated event EndState (name NextStateName)

Overrides: Object.EndState (global)

Called immediately before going out of the current state, while within the GotoState() call that caused the state change, and before BeginState() is called within the new state.

WeaponEquipping.Activate[edit]

simulated function Activate ()

Overrides: Activate (global)

Activate() ignored since already becoming active

WeaponEquipping.WeaponEquipped[edit]

simulated function WeaponEquipped ()


WeaponFiring[edit]

Modifiers: simulated

WeaponFiring.BeginState[edit]

simulated event BeginState (name PreviousStateName)

Overrides: Object.BeginState (global)

Called immediately when entering a state, while within the GotoState() call that caused the state change (before any state code is executed).

WeaponFiring.EndState[edit]

simulated event EndState (name NextStateName)

Overrides: Object.EndState (global)

Called immediately before going out of the current state, while within the GotoState() call that caused the state change, and before BeginState() is called within the new state.

WeaponFiring.IsFiring[edit]

simulated event bool IsFiring ()

Overrides: IsFiring (global)

Returns true if the weapon is firing, used by AI

WeaponFiring.RefireCheckTimer[edit]

simulated function RefireCheckTimer ()

Overrides: RefireCheckTimer (global)

Timer event, call is set up in Weapon::TimeWeaponFiring(). The weapon is given a chance to evaluate if another shot should be fired. This event defines the weapon's rate of fire.

WeaponPuttingDown[edit]

Modifiers: simulated

WeaponPuttingDown.BeginState[edit]

simulated event BeginState (name PreviousStateName)

Overrides: Object.BeginState (global)

Time the process and clear the Firing flags

WeaponPuttingDown.EndState[edit]

simulated event EndState (name NextStateName)

Overrides: Object.EndState (global)

Called immediately before going out of the current state, while within the GotoState() call that caused the state change, and before BeginState() is called within the new state.

WeaponPuttingDown.ClientWeaponThrown[edit]

reliable client function ClientWeaponThrown ()

Overrides: ClientWeaponThrown (global)

This function is called when the client needs to discard the weapon

WeaponPuttingDown.TryPutDown[edit]

simulated function bool TryPutDown ()

Overrides: TryPutDown (global)

(Description copied from Weapon.TryPutDown)
Put Down current weapon Once the weapon is put down, the InventoryManager will switch to InvManager.PendingWeapon.

Returns:

returns true if the weapon can be put down.

WeaponPuttingDown.WeaponIsDown[edit]

simulated function WeaponIsDown ()

Overrides: WeaponIsDown (global)

We are done putting the weapon away, remove the mesh/etc.