SMOD Custom Weapons - Explained

A Tutorial for SMOD

Attention Gamer! We are one of the oldest mod sites on the Interwebs. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation by sending Daxent points.
  • Post: Give Daxent your thoughts on this Tutorial.
  • Vote: Help Daxent win the Monthly Awards.
  • Rate: Give this Tutorial a rating out of 10.
  • Flag: Alert moderators and warn members of a problem with this Tutorial.
  • Watch: Get notified when this Tutorial is updated.

Resistance is futile...

Sign up

Already a Bananite? Login

A full tutorial, explaining all of SMOD's scripts.

___________________________________________________________________________________ PLEASE NOTE!: Before I start with this, if you wish to make your own weapons I HIGHLY SUGGEST you use Phatcat's Ironsight config! ___________________________________________________________________________________ SMOD has a extensive system for adding your own weapons in. These are each divided by it's ability to support up to 30 weapons. Here is the script code as explained. ___________________________________________________________________________________ WeaponData "printname" "Random Gun-Shits" This is what your HUD will display for the name. "viewmodel" "models/weapons/v_penis.mdl" This is for the v_model of the weapon you are using. "playermodel" "models/weapons/w_penis.mdl" The optional bread and butter to the v_model; the world model. "anim_prefix" "slapping bitches" This is where things will start to get tricky. This is what animation the world model will use. E.G. Say you have a HL2 Shotgun W Model, you'd want it to use shotgun_prefix "bucket" "5" This tells you what row in the HUD weapon selection screen that weapon should lay in. "bucket_position" "4" What slot your weapon is going to be under the HUD weapon selection. "clip_size" "30" How many bullets/buckshots/yo momma's your weapon is going to carry in it's magazine max. "clip2_size" "-1" This is for secondary ammo, such as grenades from grenade launchers and what not. "default_clip" "20" Ammo that you get when you first pick up the gun. "default_clip2" "-1" Secondary ammo you get when you first pick up the gun. "primary_ammo" "ar2" What ammo your weapon can use. These include: pistol. smg1. smg1_grenade. ar2. ar2_altfire. grenade. xbowbolt. buckshot. rpg_missile. customammo1-10 (editable in game_skill.cfg I believe). "secondary_ammo" "None" Again; secondary ammo. The above list explains which ones are elidgable. "weight" "167" This makes NPC's decide how much they like to pick up the gun. E.G. a Rebel won't pick up a pistol if it's rated too high but he'll sure as hell will pick up that shotgun if it's rated at 5. "item_flags" "0" Sadly, I have no idea what these do. :/ If I toy with it enough I'll let you all know what it is. "BuiltRightHanded" "1" If the model is animated right handed in Valve games, Valve games will just say lolfukumirroredmodel. But in SMOD, you can set the script to flip left-sided models. "AllowFlipping" "0" Lets you flip the model with cl_righthand 1 "CSViewModel" "1" This allows moar support for Non-Half-Life 2 weapons, such as CS:S and DoD:S. "CSWorldModel" "1" Essentially; this makes the NPC the weapon's bitch. Makes NPC's attack with the weapon even if it's not their normal weapon. Is buggy as hell and I don't recommend it to anyone for use. "MuzzleType" "CSRIFLE" This tells you what muzzleflash to use. Examples are - MZRifle; MZSMG; CSSMG; CSRIFLE. *NOTE*This will ONLY work if you have cs_viewmodel enabled to 1*NOTE* "MuzzleSize" ">9000" This requires CSViewModel to be at 1. This is self-explanatory, but for goodness sake I'll post it. This is to set the size of the muzzleflash you are using. "MuzzleAttach" "0" And again; this requires CSViewmodel to be at 1. This forces the model to attach muzzleflash. Can be buggy at times, but who cares. "MuzzleOfs" "-3" This is to offset the muzzleflash. And again, requires CSViewmodel to be at 1. "LagScale" "0.5" This scales movement lag. By all means, do not use 0.0. "RunSpeed" "0.1" The speed at which you move with the gun. "DisableROAimmode" "1" Pretty much a useless command, but hell it's there so I'll explain it. If smod_ro_aimmode (console; not script) then this will cancel it out. "NoDrop" "1" Lets you know whether or not you can drop your weapon. And now it's time for ironsights. :D "Adjust View Model" { "Forward" "dongs" "Up" "999999" "Fov" "999999" } This is for adjusting origins for the v_model IronSight { "right" "99999" "up" "2.0999" "forward" "99999" "fov" "99999" "pitch" "999999" "yaw" "99" "roll" "99" "AdjustAccuracy" "999999" ___________________________________________________________________________________ Okay, for the sake of this tutorial I'm just going to break it down like this. Right - This is for setting the view model right. Making it a - sends it to the left. Up - This is for setting the model up. If you set it to - it's down. Forward - For moving it forward. - moves it backwards. Pitch, Yaw, and Roll - Pitch is for setting the model up, and yaw is for setting it down. Roll is for turning the model, E.G. making a gangsta glock. AdjustAccuracy - A bonus or a hinder on accuracy. If you want, you can give yourself aimbots with adjust accuracy. Or you can make it like your playing on a 33 tick server on CS:S. ___________________________________________________________________________________ Onto the next part for ironsights... "VMDOF" { "Default" { "start" "39" "end" "-12" } "IronSight" { "start" "2" "end" "4" } } This is for setting model depth of field effects while in ironsights. Haven't dicked around in here too much though so I might be wrong. SoundData { "single_shot" "Weapon_Dongs.Single" "double_shot" "Weapon_Takingamilliondumps.Single" "reload" "Weapon_4chon.Reload" "single_shot_npc" "Weapon_Trollin.Single" "double_shot_npc" "Weapon_Dongs.NPC.Double" "reload_npc" "Weapon_Pistol.NPC_Reload" "empty" "Weapon_Pistol.Empty" "special1" "Weapon_Pistol.Special1" "special2" "Weapon_Penis.Special2" "burst" "Weapon_Penis.Burst" "melee_hit" "Weapon_Cocks.Melee_Hit" "melee_hit_world" "Weapon_Dongs.Melee_HitWorld" } Now this, is a REAL pain in the ass. You'll be spending a lot of your time dicking around in here, this is for sound scripts that are found in game_sounds_weapons.txt and game_sounds_cs_weapons.txt. TextureData { "weapon" { "font" "WeaponIcons" "character" "c" } "weapon_s" { "font" "WeaponIconsSelected" "character" "c" } "ammo" { "font" "WeaponIcons" "character" "c" } "ammo2" { "file" "sprites/640hud7" "x" "48" "y" "72" "width" "24" "height" "24" } "crosshair" { "font" "Crosshairs" "character" "Q" } "autoaim" { "file" "sprites/crosshairs" "x" "0" "y" "48" "width" "24" "height" "24" } } For stuff like HUD materials and ammo shits. Haven't messed with this too much but from what I know this will go through the sprite folder in your materials folder. Not much to be messed with, but if you have shitloads of OCD and MUST ABSOLUTELY change it, then do it at your own risk. :p And this is where the fun stuff begins. This is the last part of the tutorial, and definitely the lengthiest. ___________________________________________________________________________________ "WeaponSpec" This is where you'll choose how your weapons will act. ___________________________________________________________________________________ "FireMode" "1" These are for firemodes. There are quite a couple supported. 1 = Single 2 = Burst 4 = Automatic. In addition, you can add them up. Say you wanted to use Single and Burst, you would use the number 3. If you wanted to use all three of them, you would use 7. ___________________________________________________________________________________ "WeaponType" "0" This for what type of weapon you are using. There are five supported. 0 = Semi Auto 1 = Full Auto 2 = SHAWTGAWN 3 = AUTO SHAWTGAWN 4 = Melee 5 = OH GOD IT'S A GRENADE GET DOWN! ___________________________________________________________________________________ "FireRate" "69" Lets SMOD know how fast your weapons will fire. ___________________________________________________________________________________ "UnderWater" "0" Determines whether or not you can shoot underwater. ___________________________________________________________________________________ "Options" { Optional Options for your custom weapons. Basically a pimp-my-ride-esque code. "ReloadSound" "1" This is kinda' tricky to explain, but if the weapon is loaded in sounds from SoundData, then it would load those sounds. If the sounds were already in the .qc however, then there's no need to set it to 1. ___________________________________________________________________________________ "LastFireSound" "0" Sets a special sound to your last bullet. ___________________________________________________________________________________ "TurnoffScope" "0" This forces the player to exit the ironsights after shooting. I verily recommend this for bolt-action sniper rifles. The same applies for TurnoffIron (see below) "TurnoffIron" "0" ___________________________________________________________________________________ "TimeScale" "0" How fast your weapons move. ___________________________________________________________________________________ } "LaserPointer" { Lasers and stuff. Essential for LAM's. "AccBonus" "0.5" Same as the original Accuracy Bonus. Except, y'know, for ironsights. // "UseButton" "0" If you set this to 1, Mouse2 will launch the designated laser sight. "UseIronsight" "0" This is for setting lasers to appear when you are in Ironsights. Pretty cool for EOTech's and what not. "DeactivateinReload" "1" Self-explanatory. Causes the gun to deactivate the laser in the reload. ___________________ "Material" "materials/sprites/eotech.vmt" The material that you wish to use. // "DrawTrail" "1" Sets whether or not a trail should be drawn from the laser. "SwitchSound" "0" Causes a sound to play when the laser or something else you freaks made is activated. "DrawRange" "512" Distance which the dot fades out. "TraceLength" "64" Distance where it's at max size. "FixSize" "1" If you select this, the size of the laser will never change. Ever. Ever ever ever. "PointerSize" ".2" } Chooses the size of the pointer to use. ___________________________________________________________________________________ "ShootPos" { "UpperPitch" "5 1 -2.5" "LowerPitch" "5 1 -2.5" "IronSight" "5 0 -.5" } If I remember correctly, this selects where the gun will fire from. I do NOT recommend editing this. "Burst" { "FireCount" "3" "Delay" "0.085714286" } This lets you know how much you want to fire out when you burst. If you aren't using burst in the first place don't bother. "Recoil" { "PunchPitch" "-1.5 0" "PunchYaw" "-1 1" "EnableSnap" "0" "SnapPitch" "0 0" "SnapYaw" "0 0" "Crouch" ".5" "Amp" "1" "PunchLimit" "5" } For adjusting recoil. "Spread" { "Default" "0" "MaxSpread" "0" "Run" "0" "RunSpeed" "100" "Crouch" "0" "Fire" "0" } For adjusting bullet spread. "Bullet" { "AmmoType" "ak47" "Damage" "25" "ShotCount" "1" "Tracer" "3" "Force" ".2" "Penetrate" "5" } For adjusting what bullet to use and it's activity. "Npc" { "RifleAnim" "1" "BurstMax" "3" "BurstMin" "1" "FireRate" "0.075" "Range" "80000" "MuzzleFire" "1" } } } Determines NPC's actions with the weapon.



Shareable Image:
Share banner
HTML embed code:
BB embed code:
Markdown embed code:

More embeddable images

Bookmark and Share


Key Authors
The SMOD Author
For creating KeyValues that made weapons possible.
Happy Cat
For further understanding of scripts
For schooling me about scripts. :p


Daxent avatar
Daxent Offline
Member Joined 8y
355 points Ranked 11630th

Sign up to access this!
Sign up to access this!
Sign up to access this!


Sign up to access this!



Difficulty Level
Intermediate Difficulty



Date Added
Date Modified


88 bScore
9.8 Rating

2 voters

Sign up to access this!

WiPs by Submitter tracking pixel