Garry's Mod

Garry's Mod

Fiery Weapons Base
Jazzy Joyce  [developer] 16 Oct, 2020 @ 10:01am
Developer Help:
The focus Fiery Weapons Base has always been to make creating both, complex SWEPs and "Drag-N-Drop" SWEPs easy!

To get started, all you need is to set the SWEP.Base to a fiery base. For most users bases like:
├─── weapon_fiery_base_auto_rifle
├─── weapon_fiery_base_dual
├─── weapon_fiery_base_melee
├─── weapon_fiery_base_mg
├─── weapon_fiery_base_pistol
├─── weapon_fiery_base_revolver
├─── weapon_fiery_base_rifle
├─── weapon_fiery_base_shotgun
├─── weapon_fiery_base_smg
├─── weapon_fiery_base_sniper
├─── weapon_fiery_base_templated

From there, its just about filling in certain variables, but also ignoring others:
• SWEP.Mag and SWEP.Mag2 define the models for mag drops
• SWEP.HoldType2 and SWEP.ReloadHoldType and RunHoldType will define hipfire and reload holdtypes
• Killicons dont need to be registered, this is done at Init & Headshot
• DefaultClip is obsoleet and will change initial ammo (important for DarkRP)
• If a reload sound is needed, its set by SWEP.ReloadSound = Sound("")
• If a draw sound is needed, its set by SWEP.DrawSound = Sound("")
• Select Icons can be forced with SWEP.SelectIconLetter
• IconFont cant be set with SWEP.IconFont = "Fiery_<See list below>_Font"
CSKillIcons
CSKillIcons2
DODKillIcons
HLKillIcons
HLKillIcons2

SelectNumbers
SelectNumbers2
SelectNumbers3

SelectFiremode
SelectFiremode2

DODSelectIcons
CSSelectIcons
CSSelectIcons2
CSSelectIcons3
HLSelectIcons


• Burst settings are set with SWEP..<side>/BurstFire as an integer
• This is the code to setup a fire modes
SWEP.FireMode = 1 -- Where to start on the table
SWEP.data = {} -- VERY IMPORTANT
SWEP.data.modes = {} -- DIDO
SWEP.data.modes[1] = 3 -- AUTO
SWEP.data.modes[2] = 1 -- SEMI
SWEP.data.modes[3] = 2 -- BURST

• For weapons with scopes, the zoom is done like so
SWEP.Scope = { 2, 4, 8 } -- Standard, each int is a ZOOM
SWEP.ScopeReddot = false -- Maybe you want a red dot?
SWEP.BadToHipFire = true -- Inflate the cone (for rp snipers)

• If you need the SWEP to animate differently than it is, place this
/*---------------------------------------------------------
Animation Index
---------------------------------------------------------*/
SWEP.Primary.EmptyAnim = ACT_VM_PRIMARYATTACK -- ACT_VM_DRYFIRE
SWEP.Primary.ShootAnim = ACT_VM_PRIMARYATTACK

SWEP.Secondary.EmptyAnim = ACT_VM_SECONDARYATTACK
SWEP.Secondary.ShootAnim = ACT_VM_SECONDARYATTACK

SWEP.ReloadAnim = ACT_VM_RELOAD
SWEP.EmptyReloadAnim = ACT_VM_RELOAD --_EMPTY

SWEP.DrawAnim = ACT_VM_DRAW
SWEP.EmptyDrawAnim = ACT_VM_DRAW_EMPTY

SWEP.EmpytyIdleAnim = ACT_VM_IDLE --_EMPTY
SWEP.IdleAnim = ACT_VM_IDLE
/*---------------------------------------------------------*/

These are used inside of the animation engine, which can produce context correct animations via a call like so:

self:VMact(anim_name, playbackrate, sound, volume, idle_after, iron_off)

Any of these arguments can be null
anim_name can be an enumerated ACT or a string like "PRIMARY" "IDLE" "SECONDARY" "DRAW"


• World models can be affixed to the hand with SWEP.FixWorldModel = true and adjusted with these floats
SWEP.WMr,
SWEP.WMf,
SWEP.WMu,
SWEP.WMra,
SWEP.WMfa,
SWEP.WMua

• Some bases are still in development, such as grenade launcher, RPG, Grenade, Melee, Magic, Bomb and Tool! I can outline how to make these, but there is no official form currently

----------------------------------------------------------------------------------------------------------------------------
Got a question about developing a SWEP or about how the base works itself,
Post a reply below, and I will get back to you within a day or so!



I appreciate external views on the Base and will work with other developers to encode functionality! I want to make it easier for everyone!


Thank you for your support!
Last edited by Jazzy Joyce; 4 Dec, 2020 @ 9:05am
< >
Showing 1-2 of 2 comments
nkruger31 22 Oct, 2022 @ 4:41pm 
Is fire-mode switching supported?
Jazzy Joyce  [developer] 24 Oct, 2022 @ 10:59am 
Originally posted by nkruger31:
Is fire-mode switching supported?
Hello nkruger,

fire mode switching is supported, the swep in question simply needs the firemodes outlined in its data, like so

SWEP.Primary.BurstFire = 3
SWEP.FireMode = 1 -- INDEX
SWEP.data = {} -- VERY IMPORTANT
SWEP.data.modes = {} -- DIDO
SWEP.data.modes[1] = 3 -- AUTO
SWEP.data.modes[2] = 2 -- BURST
SWEP.data.modes[3] = 1 -- SEMI

This would make the default firemode Auto, then be able to switch to burst, then Semi, and back again
< >
Showing 1-2 of 2 comments
Per page: 1530 50