| Home Page | Recent Changes | Preferences

Weapon

Properties

Main

NUM_FIRE_MODES
Determines number of fire modes that are available. Defaults to 2.
FireModeClass[NUM_FIRE_MODES]
This specifies the class activated when the weapon is fired, in the correct mode.
FireMode[NUM_FIRE_MODES]
Class WeaponFire. This is used to determine information regarding the weapon's firemodes, availability, AI rating, etc.
Ammo[NUM_FIRE_MODES]
Class Ammunition. Used to track ammunition usage and type.
Name AimAnim
Name of the animation to play while aiming.
float AimAnimRate
Animation rate for AimAnim.
float AIRating
This variable determines how much the AI should like and use this weapon.
bool bCanThrow
Can this weapon be thrown.
bool bMeleeWeapon
Is this a melee weapon and should only be used in close quarters.
bool bNotInPriorityList
Should be displayed in a GUI weapon list. This refers to the display of weapons at the bottom of the screen.
int BotMode
The fire mode currently being used for bots.
bool bSniping
EWeaponClientState ClientState
This will always be none on the server. This is an indicator to the client as to what state the weapon is currently in and allows for quick checks to see if the weapon is available, etc.
byte DefaultPriority
This determines the default priority of the weapon, which can be overridden by the player.
float DisplayFOV
The default FOV displayed when the weapon is selected.
vector EffectOffset
Where muzzle flashes and smoke appear. To be replaced by a bone reference eventually.
byte ExchangeFireModes
Used to determine whether or not the firemodes should be exchanged due to player preferences.
Name IdleAnim
Idle animation.
float IdleAnimRate
Rate to play IdleAnim.
string MessageNoAmmo
Message given to the player when there is no ammo left for the selected firemode.
byte Priority
Used to hold the player determined priority.
Name PutDownAnim
Holster weapon animation.
float PutDownAnimRate
Rate to play PutDownAnim.
Name RestAnim
Resting weapon animation.
float RestAnimRate
Rate to play RestAnim.
Name RunAnim
Running weapon animation.
float RunAnimRate
Rate to play RunAnim.
Name SelectAnim
Unholstering animation.
float SelectAnimRate
Rate to play SelectAnim.
String SelectForce
Force feedback to be used when weapon is selected.
Sound SelectSound
Sound to be played when weapon is selected.

Hidden

bool bMatchWeapons
For team beacons (lightning gun potential links).
bool bNotInDemo
Determines whether the weapon is available in the demo.
bool bPendingSwitch
bool bShowChargingBar
Determines whether the charging bar is shown for this weapon.
float CurrentRating
Rating result from most recent RateSelf()
class<Weapon> DemoReplacement
Weapon to be used in demo if this weapon is not available.
float Hand

Enums

EWeaponClientState

WS_None
The client does not have this weapon.
WS_Hidden
The weapon is hidden and cannot be fired.
WS_BringUp
The weapon is being brought up. (SelectAnim is playing.)
WS_PutDown
The weapon is being put away. (PutDownAnim is playing.)
WS_ReadyToFire
The weapon is ready to fire.

Functions

simulated function GetAmmoCount(out float MaxAmmoPrimary, out float CurAmmoPrimary)
Returns the primary and secondary amount of ammo in the variables provided.
simulated function DrawWeaponInfo(Canvas C)
Used to show on the HUD the current weapon information.
function float RangedAttackTime()
AI function. Time it takes to perform a ranged attack. (??)
function bool RecommendRangedAttack()
AI function. Determines if the ranged attack is to be used.
function bool FocusOnLeader(bool bLeaderFiring)
function FireHack(byte Mode)
function bool SplashDamage()
AI function. Determines whether the weapon has splash damage so the bot knows to avoid close combat use.
function bool RecommendSplashDamage()
AI function. Determines whether the bot should take advantage of the splash damage.
function float GetDamageRadius()
AI function. Returns the radius of the splash damage.
function float RefireRate()
AI function. Returns how quickly the weapon should be fired.
simulated function DisplayDebug(Canvas Canvas, out float YL, out float YPos)
simulated function Weapon RecommendWeapon( out float rating )
AI function. Cycles through the available weapons and determines which should be used by the bot.
function SetAITarget(Actor T)
AI function. Determines who the bot should be aiming at.
function byte BestMode()
AI function. Determines whether primary or alternate fire should be used.
function bool BotFire(bool bFinished, optional name FiringMode)
AI function. Called when the bot fires the weapon.
simulated function vector GetFireStart(vector X, vector Y, vector Z)
This returns the actual projectile spawn location or trace start.
simulated function float AmmoStatus()
returns float value for ammo amount.
simulated function float RateSelf()
Need to figure out modified rating based on enemy/tactical situation.
function float GetAIRating()
Returns AIRating.
function float SuggestAttackStyle()
Suggest whether to attack or defend when using this weapon.
function float SuggestDefenseStyle()
Suggest whether to attack or defend when using this weapon.
function bool SplashJump()
AI function. Determines if the bot should jump when using splash damage.
function bool CanAttack(Actor Other)
AI function. Determines if the bot can attack the actor passed in.
simulated function PostBeginPlay()
A function called prior to play beginning. Can do initial ammo setup, etc., here.
simulated function Destroyed()
A function called when the weapon is destroyed. Used to release resources, etc.
simulated function Reselect()
Called when a weapon is reselected.
simulated event RenderOverlays( Canvas Canvas )
This draws the overlays onto the HUD like muzzle flashes, emitters, etc.
simulated function SetHand(float InHand)
Set which hand the weapon is held in.
simulated function GetViewAxes( out vector xaxis, out vector yaxis, out vector zaxis )
simulated function vector GetEffectStart()
Can be called to help determine where an effect should be played - tip of muzzle, etc.
simulated function IncrementFlashCount(int Mode)
Increments the FlashCount. To what purpose?
simulated function ZeroFlashCount(int Mode)
Zeroes out the flash count. Linked, obviously with above.
simulated function Weapon WeaponChange( byte F, bool bSilent )
Switch to a new weapon.
simulated function Weapon PrevWeapon(Weapon CurrentChoice, Weapon CurrentWeapon)
Switch to the previous weapon in inventory.
simulated function Weapon NextWeapon(Weapon CurrentChoice, Weapon CurrentWeapon)
Switch to the next weapon in inventory.
function HolderDied()
Called when the weapon holder has perished.
simulated function bool CanThrow()
Returns whether the weapon can be thrown.
function DropFrom(vector StartLocation)
Determines where the weapon will be dropped from. Used for applying physics and creating a pickup.
simulated function DetachFromPawn(Pawn P)
Detaches the weapon from the pawn.
simulated function ClientWeaponThrown()
Called when the weapon has been thrown. Used to delete reference in inventory amongst other things.
function GiveTo(Pawn Other, optional Pickup Pickup)
Called when the weapon has been given to a pawn. Set initial ammo count, etc.
function GiveAmmo(int m, WeaponPickup WP, bool bJustSpawned)
Give ammo to the player.
simulated function ClientWeaponSet(bool bPossiblySwitch)
Set the mode of the weapon.
simulated function ClientPlayForceFeedback( String EffectName )
Plays force feedback.
simulated function StopForceFeedback( String EffectName )
Stops force feedback.
simulated function BringUp(optional Weapon PrevWeapon)
Bring weapon up for use.
simulated function bool PutDown()
Holster weapon.
simulated function Fire(float F)
Fire the weapon.
simulated function AltFire(float F)
Secondary fire the weapon.
simulated event WeaponTick(float dt)
Tick for weapon; only called on currently active weapon.
simulated function OutOfAmmo()
Determines what happens when the weapon is out of ammo.
simulated function DoAutoSwitch()
Switches to the best weapon available.
simulated event ClientStartFire(int Mode)
Client side only, begin weapon firing.
simulated event ClientStopFire(int Mode)
Client side only, begin alternate weapon firing.
event ServerStartFire(byte Mode)
Server side only, begin weapon firing.
function ServerStopFire(byte Mode)
Server side only, stop weapon firing.
simulated function bool ReadyToFire(int Mode)
Determines if the weapon is ready to fire.
simulated function bool StartFire(int Mode)
Client and server, begin weapon firing.
simulated event StopFire(int Mode)
Client and server, start weapon firing.
simulated function Timer()
the always present Timer?.
simulated function bool IsFiring()
Returns whether the weapon is currently being fired, mostly for pawn animation.
function bool IsRapidFire()
Returns whether the weapon is rapidly firing, mostly for pawn animation.
function ConsumeAmmo(int Mode, float load)
Removes ammo after use.
simulated function bool HasAmmo()
Returns whether or not there is ammunition remaining for the weapon in either firemode.
function AdjustPlayerDamage( out int Damage, Pawn InstigatedBy, Vector HitLocation, out Vector Momentum, class<DamageType> DamageType)
Called every time owner takes damage while holding this weapon - used by shield gun
simulated function StartBerserk()
Used to start berserk mode with the weapon.
simulated function StopBerserk()
Used to stop berserk mode with the weapon.
function AnimEnd(int channel)
Stops animation, returns weapon to WS_READYTOFIRE state.
simulated function PlayIdle()
Play idle animation.
function bool CheckReflect( Vector HitLocation, out Vector RefNormal, int AmmoDrain )
function DoReflectEffect(int Drain)
function bool HandlePickupQuery( pickup Item )
function bool ShootHoop(Controller B, Vector ShootLoc)

Default Properties

Commented example of a defaultproperties section for a weapon.

defaultproperties
{
    // This class is called when primary fire is called.
    FireModeClass(0)=Class'MyPackage.MyWeaponFire'

    // This class is called when secondary fire is called.
    FireModeClass(1)=Class'MyPackage.MyWeaponAltFire'

    // Animation played when this weapon is selected, aka unholstered.
    SelectAnim="Pickup"

    // Animation played when this weapon is put away.
    PutDownAnim="PutDown"

    // This allows you to play a sound -- like a powerup sound, etc.
    SelectSound=Sound'WeaponSounds.MyWeapon.SwitchToMyWeapon'

    // Force feedback used when this weapon is selected.
    SelectForce="SwitchToMyWeapon"

    // ??
    AIRating=0.750000

    // ??
    CurrentRating=0.750000

    // Has to do with the location of the projectile spawned in 1st person view
    EffectOffset=(X=200.000000,Y=32.000000,Z=-25.000000)

    // This sets the player FOV when they have this weapon.
    // Can be used for scopes, etc., but can also be used for cheats.
    DisplayFOV=60.000000

    //For weapon switching <Chazums>
    Priority=8

    // Default priority of weapon.  Weapon priority can be overriden by player.
    DefaultPriority=8

    // Inventory groups work like Half Life.  You select 7 twice and you'll
    // go to the second weapon in the inventory group.
    InventoryGroup=7

    // What happens when you pick this weapon up?  PickupClass determines that.
    PickupClass=Class'MyPackage.MyWeaponPickup'

    // Moves the weapon model around screen <Chazums>
    PlayerViewOffset=(X=5.000000,Y=11.000000)

    // Rotates the weapon model, not sure if about weapon or player tho <Chazums>
    PlayerViewPivot=(Yaw=-16884,Roll=200)

    // Dampen the 'swing' of the weapon when moving <Chazums>
    BobDamping=2.6000

    // How does this attach to the pawn.
    AttachmentClass=Class'MyPackage.MyWeaponAttachment'

    // IconMaterial determines what is displayed on the screen in the weapon selection area.
    IconMaterial=Texture'InterfaceContent.HUD.SkinA'

    // IconCoords specify the location in the above texture of this particular texture.
    IconCoords=(X1=322,Y1=100,X2=444,Y2=200)

    // Just what it says -- the name of the item.  Used in lots of places.
    ItemName="MyWeapon"

    // The type of light that firing this weapon creates.
    // This is completely separate from the mesh used to show muzzle flash.
    LightType=LT_Pulse

    // ?? Find and investigate this.
    LightEffect=LE_NonIncidence

    // How bright is the light created by weapon fire?
    LightBrightness=150.000000

    // How far does light extend?
    LightRadius=4.000000

    // Hue of light produced.
    LightHue=30

    // Saturation of light produced.
    LightSaturation=150

    // Skeletal mesh is the actual mesh of the weapon.
    Mesh=SkeletalMesh'MyMeshes.MyWeaponMesh'
    
     // ??
    UV2Texture=Shader'XGameShaders.WeaponShaders.WeaponEnvShader'
    
    // Used by the AI to determine how to act with and against weapon <Chazums>
    bMeleeWeapon = False

    // Do not show charging bar.
    bShowChargingBar = False

    // Weapon cannot be thrown.  (Can be thrown include grenades, etc.)
    bCanThrow = False

    // Weapons are a static mesh.  DrawScale determines how big they are
    // compared to the original mesh.
    DrawScale=1.0

    // Message given to the player when they have run out of ammunition.
    // Prefixed with WeaponName I imagine.
    MessageNoAmmo=" has no ammo"
}

Related Topics

Comments

Trystan: Blast away. I know most of these are self documenting but it helps when you search for a keyword to have the explanation next to it IMHO.

Eldhrin: Anyone know what the float parameter to the Fire method does? Also, do all those animations and things have to be defined or can we cheat and have invisible weapons without meshes or anything? (Hoping you can, I kind of need them)

Trystan: Tarquin, hadn't moved the default properties onto this page because most of the other class pages seem to ignore them, so I was trying to stay within the style of Wiki. =) I'll get the comments cleaned up, remove my proprietary stuff, and move them into here.

As for invisible meshes I truly don't know - I rather doubt you could have -no- mesh, but you might be able to make and save a mesh with no data. No mesh would probably result in access nones and null references. Not having an animations seems to be okay as our mod is currently missing a ton. Your log file becomes inundanted with bug messages about them, but everything works and no access nones.

The only usage of the variable F I could find was in RedeemerWarhead.uc where it compares F to -1. I would think it would have to do with charging but I could see no such usage of it in that manner in the lightning gun. It is also optional, apparently.

Trystan: Okay, commented default properties added but it does seem to duplicate quite a bit of the properties section. If anyone thinks they're confusing feel free to remove.

KateM.: As far as I can tell, FlashCount is incremented solely for the purpose of the WeaponLight function in XWeaponAttachment. Seems to be used for Dynamic Lighting on firing weapons for the 3rd person effects.

MadNad: The float looks like it could be used if you fly the deemer and hit yourself. EffectOffset has to do with the location of the projectile spawned in 1st person view. DisplayFOV seems to only change your FOV of the weapon itself, not your world FOV. Now if any of you can figure out PlayerViewOffset, that would be helpful...It seems to move your view of the weapon, not the weapon itself. do another drawActor with handedness=-1 and you will see what i mean.

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In