Left 4 Dead 2

Left 4 Dead 2

Selective Fire
 This topic has been pinned, so it's probably important
Rapid Hold2Fire Variant (30 pistol shots in 3.0-3.1 s) V4.1
Hello there! I love this mod and it had great code! I was looking for a way to make a hold2fire pistol script, to help with the carpal tunnel since i love using pistols, but my hands always cramp up using them!

I used a fork of two mods to combine two together, Full credit to all authors! One mod was used for fire mode switching. The other was a rapid fire script.

// Hold2Fire Pistols V4.1 Tweaks by Rukanth

// Merge of two mods. All Credits to their respective owners!
// [Mod1: Selective fire By: LoadedAK47 , Alexandrovich , Gejsiv , Crowbait , GingaNinja , EvilJackCarver" , Mod2: Rapid fire by Oskin]

// To install this, you need to copy paste this file into notepad, save as "autoexec.cfg",
// and place it in your local files \Steam\steamapps\common\Left 4 Dead 2\left4dead2\cfg\ files saved as autoexec.cfg.

// Guide: Pressing Q Swaps modes, white = Normal fire, Green = Hold2fire on pistols.
// V makes you go afk (optional)

// NOTE: You will get Press [?] to join when m1 is set to hold2Fire, just press q to rebind m1 so you can join.


// (V 5.1: 6/13/2023: Basically in finished state. Fire rates has a note for modern computers that may be worth a try.

// CrossHair Binds {Selective Fire}
alias doNormal "bind mouse1 +attack; normalcross" // Normal Fire
alias doHold2Fire "bind mouse1 +burst; autoCross" // Green Crosshair: Hold to fire (Good for pistols, tank snipers, and easier ak47 tap fire)

// Fast Fire Script, Based on Oskin's, tweaked numbers to fit pistols and work with modes..
alias "+burst" "alias 3 +2; +2" // (Autofire works by making a +- attack loop)


alias "+2" "+attack; wait 2; -attack; wait 2; 3" // (+2's Waits control firing rates. The ideal firing time is about 3.0-3.1s for 30 shots. I found 2+2 worked best on my old pc, and 5+4 worked best on my new pc. Feel free to experiment.)

// Alternative fire rate
// alias "+2" "+attack; wait 5; -attack; wait 4; 3" // (Depending on computer, changing waits's timer can affect the speed of your shots. Feel free to try messing around with it for your computer/desired speed.)

alias "3" "+2" // {This line makes canceling fire possible. If you remove this, you CAN'T stop.}
alias "-burst" "alias 3 -attack"


// [Below Alias are for the fire modes you switch between. ]
alias firetoggle baseFire; -burst;
alias baseFire "doNormal; -burst; alias firetoggle hold2Fire"
alias hold2Fire "doHold2Fire; -burst; alias firetoggle baseFire"


// These lines control the crosshair colors. White = Normal fire, Green = Hold2fire.
alias normalcross "cl_crosshair_blue 255; cl_crosshair_green 255; cl_crosshair_red 255; cl_crosshair_thickness 3; cl_colorblind 1; -reload"
alias autoCross "cl_crosshair_red 0; cl_crosshair_blue 0; cl_crosshair_green 255; cl_crosshair_thickness 3; cl_colorblind 0; -reload"


// [These bindings let you determine the default mode you enter when using 1-5 to switch.]]
// [For sake of convenience, 2 sets autofire on by default, but you can disable it if you want.]]

bind 1 "baseFire; -burst; normalcross; slot1" // Primaries set to base fire. Q to swap
bind 2 "hold2Fire; autoCross; slot2" // Sets Pistols/melee to hold2Fire by default, can be changed to toggle only. -Ruk
bind 3 "baseFire; -burst; normalcross; slot3" // If for some reason you had rapid fire grenades, you could turn this on.
bind 4 "baseFire; -burst; normalcross; slot4" // You don't want rapid fire medkit spam, DO you?
bind 5 "baseFire; -burst; normalcross; slot5" // Pills/Adrenaline
bind mwheelup "baseFire;normalcross; invprev"
bind mwheeldown "baseFire;normalcross; invnext"

//bind q "lastinv; baseFire; normalcross; reload2" // If you want to keep q's functionality, delete the comment lines and change out the q bind below to another key to swap modes..

// Key Binding
bind q "firetoggle; -burst; playgamesound Weapon_Scout.ClipLocked" // This button is what you use to switch modes. Feel free to change Q to your button of choice if desired.

bind v go_away_from_keyboard // Optional V to go AFK, Only needs to be ran once ever. "unbind v" to remove bind, or delete this line if you don't want it.

// mat_monitorgamma_tv_enabled 1 // Can Brightens my dark Screen problems / Makes l4d2 brighter for certain pcs. This has nothing to do with hold2fire. It just also uses the autoexec.cfg file lol.
Last edited by Ruke (Soreasan); 13 Jun, 2023 @ 9:06am
< >
Showing 1-7 of 7 comments
Ruke (Soreasan) 9 Feb, 2022 @ 2:18pm 
NOTES
(The fire rate will be fps dependent, try to tweak it until it empties a clip within 3-4 seconds and fires really fast to your eye if you want. Dual pistols fire at 10 shots a second, so You want the wait time to correspond to your fps / 10 to get the 10 shots a second and modify the wait X commands and tweak it until it feels right.

(Misc note: Some third party servers also disable the wait command, causing l4d2 to crash. Most third party servers are ass anyways, but if that happens you might need to windows tab out. This seemed more a problem with the first week when the script was private and in personal development, but it seems less common now.

Also OFC when you join games, remember to press q to join if you get "Press [?] to play" -> "Press m1 to play" ofc. You need normal fire bounded to join games. Also make sure to set your fire to normal if you uninstall this mod or to reset keybinds. As it works by modifying the m1 mouse keybind to autofire.

== (Dps chart:) ==
(Made for personal use, but feel free to use)

Hold2fire Pistols
- 3.0s (Fast Fire): 360 Firing dps, 196 Overall dps
- 4.0s (Slow Fire): 270 Firing dps, 166 Overall dps

- Single Pistol (3.0s Fast fire + 2.0s reload): 180 Firing dps, 108 Overall dps.

Magnum: 246 firing dps (133 dps overall w/reload)

- M60: 450 Firing dps. (Can't reload)
- Ak 47:445 firing dps (300 dps overall)
- SCAR: 365 firing dps, ( 255 overall dps)
- M16: 377 Firing dps, ( 250 Overall dps)

- Military Sniper: 360 Firing dps, ( 210 overall dps)
- Hunting Rifle: 360 Firing dps, (170 overall dps)

- Silenced Smg (Tube=): 400 Firing dps (227 overall dps)
- Smg (Point>): 320 firing dps (182 overall dps)

- Grenade launcher: 400-1000 dmg / 4.0s. (100-250 overall dps),

== Sustained dps ==
150 shot M60 :450 dps > Ak 47 300 dps > SCAR (255) >= M16 (250)
?= Grenade launcher (100-250) ?= Silenced SMG (227)
> 3.0s Pistols (196 dps)> Smg (182) > Hunting rifle (170 ) > 4.0s pistols (166) *Magnum(133) > Single pistol (108)

*(Magnum excludes 1 hit kill perks or the convenience of fast reloading. It's still a top tier secondary especially for expert modes for knowing 1 bullet = 1 kill.)

So as we can see, with overall reload time taken into account, fast fire pistols don't dominate sustained dps charts. But they were sometimes close enough to get away without being noticable.

However, by removing worries about running out of ammo, you can mow zombies down and use primaries much more aggressively!

If you really want to be ballsy, you could even try playing with a m60 for tanks if you wanted, carry shotguns for witches, grenade launchers for funsies. (Make sure to HIT the witch or you might get downed!). And it really opens up the primary slot a lot more.
Last edited by Ruke (Soreasan); 26 Aug, 2023 @ 3:05pm
Honyan 22 Jun, 2022 @ 2:15am 
Thanks to those who figured all of this out, got back into the game after a friend suddenly asked to play it again. Had been looking for this functionality as previous scripts didn't work after that particular update, and attempts to crudely emulate some of the function with the most basic commands could be inconsistent. The "hold2Fire" works quite well
Ruke (Soreasan) 25 Jun, 2022 @ 9:31pm 
Glad to hear you got good use out of it! To be honest, i always loved pistols akimbo haha, even over the others and just saving ammo, but it always would just strain up my hands, and after seeing the smash player who like torn up his arm ligaments playing too much competitive smash, i just figured i'd keep it working haha.

Glad to hear it helped you guys and had fun! Yeah, i saw some server scripts and i had half of each, a script that worked but required the middle wheel button held to fire, and thought it'd be nice to toggle modes. So i just kinda took both of them and merged them together, added V for afk, tweaked the modes to liking, and streamlines the modes from like single shot fire to normal and hold fire. It's great for taking down tanks with sniper rifles.

I find the hold fire can still actually be used to tap fire a little with easier control. It also throttles smgs and most guns to 10 shots a second and it can be easier to tap fire headshots with the ak47 and m16 with it, but for the most part it's mostly a pistol mod so people don't blow up their fingers haha. Im glad you guys got some good use out of it!

Only side complaint is i think some servers just disable the command and make you crash if you try to use a wait command, but that's more on the server end than the script. I just like to play unmodded servers over junk mods though so works for me.
Ruke (Soreasan) 27 Nov, 2022 @ 10:35pm 
(Self reference Note: Top post had been updated to version 4.1. Old laptop hard drive failed after 7 years and now im getting my code back from my own forum post trying to remember if i had anything important on the private version lol. Probably just crosshair width edits lost at most lol )
maceleet 10 Feb, 2023 @ 9:13pm 
Wooow, preem work. Thank you dude! 🥰
Ruke (Soreasan) 10 Jul, 2023 @ 3:20pm 
== (Dps chart:) ==
(Made for personal use, but feel free to use)
(Overall dps marks sustained dps with reloads taken into account. Firing dps is only when firing the gun)
o Reload Notes: Most guns seem to have about a 2.4s reload time (ak47/duals), the SCAR/Desert rifle is slower, single pistol and magnum have 2.0s reload


Hold2fire Pistols
- 3.0s (Fast Fire): 360 Firing dps, 196 Overall dps
- 4.0s (Slow Fire): 270 Firing dps, 166 Overall dps

- Single Pistol (3.0s Fast fire + 2.0s reload): 180 Firing dps, 108 Overall dps.

Magnum: 246 firing dps (133 dps overall w/reload)

- M60: 450 Firing dps. (Can't reload)
- Ak 47:445 firing dps (300 dps overall)
- SCAR: 365 firing dps, ( 255 overall dps)
- M16: 377 Firing dps, ( 250 Overall dps)

- Military Sniper: 360 Firing dps, ( 210 overall dps)
- Hunting Rifle: 360 Firing dps, (170 overall dps)

- Silenced Smg (Tube=): 400 Firing dps (227 overall dps)
- Smg (Point>): 320 firing dps (182 overall dps)

- Grenade launcher: 400-1000 dmg / 4.0s. (100-250 overall dps),

== Sustained dps ==
150 shot M60 :450 dps > Ak 47 300 dps > SCAR (255) >= M16 (250)
?= Grenade launcher (100-250) ?= Silenced SMG (227)
> 3.0s Pistols (196 dps)> Smg (182) > Hunting rifle (170 ) > 4.0s pistols (166) *Magnum(133) > Single pistol (108)

*(Magnum excludes 1 hit kill perks or the convenience of fast reloading. It's still a top tier secondary especially for expert modes for knowing 1 bullet = 1 kill.)

So as we can see, with overall reload time taken into account, fast fire pistols don't dominate sustained dps charts. But they were sometimes close enough to get away without being noticable.

However, by removing worries about running out of ammo, you can mow zombies down and use primaries much more aggressively!

If you really want to be ballsy, you could even try playing with a m60 for tanks if you wanted, carry shotguns for witches, grenade launchers for funsies. (Make sure to HIT the witch or you might get downed!). And it really opens up the primary slot a lot more.

But ak47 is still more powerful. Only weapon dualies beat in raw dps is the weak smg or ammo conservation.
Last edited by Ruke (Soreasan); 26 Aug, 2023 @ 2:55pm
Ruke (Soreasan) 10 Jul, 2023 @ 3:26pm 
== (Fire rate disclaimer) ==
(Note: Firing rates appear to vary hardware to hardware. I've gone through 3 hardware setups since making this script, and fire rates have varied for EACH computer hardware's framerate.

[Best fire rates appear to be usually somewhere around your computer's fps / 10. Give or take. Wait i think waits in frames, so if you want to fire 10x a sec as best as possible, you might want to play around with each wait value in the hold2fire command under the `"+2" "+attack; wait 2; -attack; wait 2; 3" command.]

Ex: 40 fps might fire fastest around wait 2, wait 2.
60 Fps might try wait 3, wait 3.
100 Fps might be best on wait 5, wait 5.

Feel free to play around with values and pick the speed you like best. Either blazing fast, or smooth or comfy are both valid.
Last edited by Ruke (Soreasan); 28 Jul, 2023 @ 1:05am
< >
Showing 1-7 of 7 comments
Per page: 1530 50