I don't need to test my programs. I have an error-correcting modem.

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

Property group 'Weapon'

DefaultAnimSpeed

Type: float

When no duration is specified, speed to play anims.

Default value: 1.0

EquipTime

Type: float

How long does it take to Equip this weapon

Default value: 0.33

FireInterval

Type: array<float>

Holds the amount of time a single shot takes

FireOffset

Type: Object.Vector

Holds an offest for spawning protectile effects.

InstantHitDamage

Type: array<float>

How much damage does a given instanthit shot do

InstantHitMomentum

Type: array<float>

momentum transfer scaling for instant hit damage

Mesh

Type: MeshComponent

Modifiers: editinline

Weapon Mesh

PutDownTime

Type: float

How long does it take to put this weapon down

Default value: 0.33

Spread

Type: array<float>

How much of a spread between shots

WeaponRange

Type: float

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

Default value: 16384.0

Internal variables

AIController

Type: AIController

Modifiers: protectedwrite

Current AI controlling this weapon

AIRating

Type: float


Default value: 0.5

bCanThrow

Type: bool

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

Default value: True

bInstantHit

Type: bool


bMeleeWeapon

Type: bool


bWasDoNotActivate

Type: bool

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

bWasOptionalSet

Type: bool

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

bWeaponPutDown

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

Type: float

Cache MaxRange of weapon

CurrentFireMode

Type: byte

Current FireMode

FiringStatesArray

Type: array<name>

Array of firing states defining available firemodes

InstantHitDamageTypes

Type: array<class<DamageType> >

DamageTypes for Instant Hit Weapons

Priority

Type: float

Modifiers: databinding, config

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

Default value: -1.0

ShouldFireOnRelease

Type: array<byte>


WeaponFireTypes

Type: array<EWeaponFireType>

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

WeaponProjectiles

Type: array<class<Projectile> >

The Class of Projectile to spawn

Default values

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

Enums

EWeaponFireType

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

Static functions

PassThroughDamage

simulated static function bool PassThroughDamage (Actor HitActor)

returns true if should pass trace through this hitactor

Native functions

GetPhysicalFireStartLoc

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

Destroyed

simulated event Destroyed ()

Overrides: Inventory.Destroyed

Event called when weapon actor is destroyed

GetMuzzleLoc

simulated event Object.Vector GetMuzzleLoc ()

This function returns the world location for spawning the visual effects

GetTraceRange

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

simulated event bool IsFiring ()

Returns true if the weapon is firing, used by AI

Other instance functions

See Weapon instance functions.

States

Active

Modifiers: simulated

Active.BeginState

simulated event BeginState (name PreviousStateName)

Overrides: Object.BeginState (global)

Initialize the weapon as being active and ready to go.

Active.Activate

simulated function Activate ()

Overrides: Activate (global)

Activate() ignored since already active

Active.BeginFire

simulated function BeginFire (byte FireModeNum)

Overrides: BeginFire (global)

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

Active.ReadyToFire

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

simulated function bool TryPutDown ()

Overrides: TryPutDown (global)

Put the weapon down

Inactive

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

Modifiers: auto

Inactive.BeginState

simulated event BeginState (name PreviousStateName)

Overrides: Object.BeginState (global)

Clear out the PendingFires

Inactive.ServerStartFire

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

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

simulated function StartFire (byte FireModeNum)

Overrides: StartFire (global)

do not allow firing in the inactive state

Inactive.TryPutDown

simulated function bool TryPutDown ()

Overrides: TryPutDown (global)

can't put down an inactive weapon

PendingClientWeaponSet

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

PendingClientWeaponSet.BeginState

simulated event BeginState (name PreviousStateName)

Overrides: Object.BeginState (global)

Event called when weapon enters this state

PendingClientWeaponSet.EndState

simulated event EndState (name NextStateName)

Overrides: Object.EndState (global)

Event called when weapon leaves this state

PendingClientWeaponSet.PendingWeaponSetTimer

simulated function PendingWeaponSetTimer ()


WeaponEquipping

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

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

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

simulated function Activate ()

Overrides: Activate (global)

Activate() ignored since already becoming active

WeaponEquipping.WeaponEquipped

simulated function WeaponEquipped ()


WeaponFiring

Modifiers: simulated

WeaponFiring.BeginState

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

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

simulated event bool IsFiring ()

Overrides: IsFiring (global)

Returns true if the weapon is firing, used by AI

WeaponFiring.RefireCheckTimer

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

Modifiers: simulated

WeaponPuttingDown.BeginState

simulated event BeginState (name PreviousStateName)

Overrides: Object.BeginState (global)

Time the process and clear the Firing flags

WeaponPuttingDown.EndState

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

reliable client function ClientWeaponThrown ()

Overrides: ClientWeaponThrown (global)

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

WeaponPuttingDown.TryPutDown

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

simulated function WeaponIsDown ()

Overrides: WeaponIsDown (global)

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