 |
|
01-27-2009, 10:41 AM
|
#1 (permalink)
|
Join Date: Jul 2005
Location: Hollywood, FL
Age: 24
Posts: 131
Tournaments Joined: 0 Tournaments Won: 0
|
HowTo: Scripting your way new firing modes
Since I started playing I always wanted the weapons to have firing modes. I decided I'd sit down and try and force the game into giving them to me. What I would up with is a pretty nice solution. Each firing mode has it's own crosshair color, and they are rotated using one button (default mouse4).
Primary weapons have the default (blue), semi-auto (yellow), 3 round burst (green).
Pistol(s) have the default (blue), 3 round burst (green), and full-auto (magenta).
The script will remember which firing mode you are using for each weapon, and tries to do stay sane with weapon switching well enough. Pressing the number for the inventory item, and using the auto-switch key (default Q) will always get the desired results. If you use the mousewheel to switch it automatically disables any firing mode. Pressing 1, 2, or auto-switch will equip the weapon again with it's last used firing mode.
Theres also something I like to call "Shotgun mode". Holding down the fire button in shotgun mode will fire either the Pump or AS as rapidly as possible. Also, while you're not firing you're character will automatically reload your shottie with shells. You can enter shotgun mode with mouse5.
Feel free to change any keybinds as you see fit. To install the script copy and paste the code below and save it as 'Steam\steamapps\common\left 4 dead\left4dead\cfg\firemodes.cfg' run it in the console at any time using 'exec firemodes' or run it with the game by adding 'exec firemodes' to 'Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg'
Code:
// Firemodes script v0.1 by saik0
// Visit tacticalgamer.com for the latest version
// -------- Documentation --------
// Add 'exec firemodes' to Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg to have it load with the game.
// shotty-next toggles "shotgun mode" on and off, auto-next toggles fire modes for primary and secondary.
// The script tries to remember which fireing mode you are using for which gun, and tries to do sane weapon/item switching.
// Using the numbers and auto-switch work good, the mousewheel is iffy however. If you use the mousewheel to select another
// item you'll have to press 1 or 2 (or auto switch) to go back to that firing mode for the corresponding weapon.
// -------- Keybinds --------
bind "MOUSE5" "shotty-next"
bind "MOUSE4" "auto-next"
bind "Q" "auto_switch"
// -------- Define crosshair colors--------
alias cross-semi "cl_crosshair_red 247; cl_crosshair_green 267; cl_crosshair_blue 163"
alias cross-burst "cl_crosshair_red 164; cl_crosshair_green 211; cl_crosshair_blue 164"
alias cross-auto "cl_crosshair_red 245; cl_crosshair_green 113; cl_crosshair_blue 228"
alias cross-shotty "cl_crosshair_red 237; cl_crosshair_green 84; cl_crosshair_blue 84"
alias cross-default "cl_crosshair_red 138; cl_crosshair_green 182; cl_crosshair_blue 220"
// ===================================
// ======== DO NOT EDIT BELOW ========
// ===================================
// -------- Define auto fire types --------
alias PRI_fire-semi "+attack; wait 5; -attack; wait 2"
alias PRI_fire-burst "+attack; wait 4; -attack; wait 6; +attack; wait 4; -attack; wait 6; +attack; wait 4; -attack"
alias SEC_fire-burst "+attack; wait 5; -attack; wait 8; +attack; wait 5; -attack; wait 8; +attack; wait 5; -attack"
alias +fire-auto "alias repeat_function +repeat; +repeat"
alias -fire-auto "alias repeat_function nothing"
alias repeat_function "+repeat"
alias +repeat "+attack; wait 5; -repeat"
alias -repeat "-attack; wait 5; repeat_function"
alias nothing ""
// -------- Firemode switching pseudo-code --------
alias PRI_firemode-default "bind MOUSE1 +attack; -reload; cross-default; alias PRI_firemode-last PRI_firemode-default"
alias PRI_switch "slot1; PRI_firemode-last; alias auto_switch SEC_switch; alias last_weapon PRI_switch; alias auto-next PRI_auto-next; alias shotty_next PRI_shotty_next"
alias PRI_firemode-shotty "bind MOUSE1 +fire-auto; +reload; cross-shotty; alias PRI_shotty-next PRI_shotty-reset; alias PRI_firemode-last PRI_firemode-shotty; alias PRI_shotty-last PRI_firemode-shotty; PRI_shotty-ONpress"
alias PRI_shotty-reset "alias PRI_shotty-next PRI_firemode-shotty; PRI_shotty-ONpress; PRI_firemode-default"
alias PRI_shotty-ONpress "alias PRI_auto-next PRI_firemode-semi; alias PRI_auto-last PRI_firemode-semi; "
alias PRI_firemode-semi "bind MOUSE1 PRI_fire-semi; cross-semi; alias PRI_auto-next PRI_firemode-burst;alias PRI_firemode-last PRI_firemode-semi; alias PRI_auto-last PRI_firemode-semi; PRI_auto-ONpress"
alias PRI_firemode-burst "bind MOUSE1 PRI_fire-burst; cross-burst; alias PRI_auto-next PRI_auto-reset;alias PRI_firemode-last PRI_firemode-burst; alias PRI_auto-last PRI_firemode-burst; PRI_auto-ONpress"
alias PRI_auto-reset "PRI_firemode-default; alias PRI_auto-next PRI_firemode-semi"
alias PRI_auto-ONpress "-reload; alias PRI_shotty-next PRI_firemode-shotty; alias PRI_shotty-last PRI_firemode-shotty"
alias SEC_firemode-default "bind MOUSE1 +attack; cross-default; alias SEC_firemode-last SEC_firemode-default"
alias SEC_switch "slot2; SEC_firemode-last; -reload; alias auto_switch PRI_switch; alias last_weapon SEC_switch; alias auto-next SEC_auto-next; alias shotty_next nothing"
alias SEC_firemode-burst "alias SEC_firemode-last SEC_firemode-burst; bind MOUSE1 SEC_fire-burst; cross-burst; alias SEC_auto-next SEC_firemode-auto"
alias SEC_firemode-auto "alias SEC_firemode-last SEC_firemode-auto; bind MOUSE1 +fire-auto; cross-auto; alias SEC_auto-next SEC_firemode-reset"
alias SEC_firemode-reset "SEC_firemode-default; alias SEC_firemode-last SEC_firemode-reset; alias SEC_auto-next SEC_firemode-burst;"
// -------- Initialize --------
slot1
alias PRI_shotty-next "PRI_firemode-shotty"
alias PRI_auto-next "PRI_firemode-semi"
alias SEC_auto-next "SEC_firemode-burst"
alias shotty-next "PRI_shotty-next"
alias auto-next "PRI_auto-next"
PRI_firemode-default
SEC_firemode-default
alias panic "-reload; bind MOUSE1 +attack; cross-default; alias auto_switch last_weapon"
bind "1" "PRI_switch"
bind "2" "SEC_switch"
bind "3" "slot3; panic"
bind "4" "slot4; panic"
bind "5" "slot5; panic"
bind "MWHEELUP" "invprev; panic"
bind "MWHEELDOWN" "invnext; panic"
Known Bugs: Pressing a number for an inventory item you dont have will take off your firing mode and leave you with your weapon equipped. (I dont see any way around this)
|
|
|
01-27-2009, 11:01 AM
|
#2 (permalink)
|
|
OFP Officer
OFP Admin 
Join Date: Oct 2005
Posts: 10,299
Tournaments Joined: 0 Tournaments Won: 0
|
Re: HowTo: Scripting your way new firing modes
wow nice saik0!! Definitely gonna check this out!
(also ... just an idea, take it or leave it: at the top, it might be nice if we could #define/customize the number of rounds in a burst...)
|
|
|
01-27-2009, 12:01 PM
|
#3 (permalink)
|
Join Date: Jul 2005
Location: Hollywood, FL
Age: 24
Posts: 131
Tournaments Joined: 0 Tournaments Won: 0
|
Re: HowTo: Scripting your way new firing modes
Just change the definition for primary fire burst
Code:
alias PRI_fire-burst "+attack; wait 4; -attack; wait 6; +attack; wait 4; -attack; wait 6; +attack; wait 4; -attack"
Each '+attack; wait 4; -attack; wait 6;' is a round being fired, just add or subtract to make it fire the number of times desired.
|
|
|
01-27-2009, 12:33 PM
|
#4 (permalink)
|
Join Date: Aug 2005
Location: Wisconsin, USA
Age: 38
Posts: 1,695
Tournaments Joined: 0 Tournaments Won: 0
|
Re: HowTo: Scripting your way new firing modes
This is cool saik0, and nicely documented as well. I like the fire mode selection for main weapons a lot, but the pistols and shotgun mode feel moddy for my tastes. Can you advise what parts of the code I should strip out to keep just the primary weaps?
I'd like to try this to see what it does to the game. The balance on many of the advanced weaps is they chew through ammo fast, causing tactical ammo conservation to be a concern. Four survivors with M16s in single shot mode and 50 round clips may be too hard for an infected team to pull down... which is really more fun than surviving.
|
|
|
01-27-2009, 01:02 PM
|
#5 (permalink)
|
Join Date: Jul 2005
Location: Hollywood, FL
Age: 24
Posts: 131
Tournaments Joined: 0 Tournaments Won: 0
|
Re: HowTo: Scripting your way new firing modes
Quote:
Originally Posted by Boot
This is cool saik0, and nicely documented as well. I like the fire mode selection for main weapons a lot, but the pistols and shotgun mode feel moddy for my tastes. Can you advise what parts of the code I should strip out to keep just the primary weaps?
|
I think this should do it, the lazy way without rewriting too much.
Code:
alias SEC_switch "slot2; SEC_firemode-default; -reload; alias auto_switch PRI_switch; alias last_weapon SEC_switch; alias auto-next nothing; alias shotty_next nothing"
and just comment out the bind for the shotgun toggle, or just dont use it
Code:
//bind "MOUSE5" "shotty-next"
Quote:
Originally Posted by Boot
I'd like to try this to see what it does to the game. The balance on many of the advanced weaps is they chew through ammo fast, causing tactical ammo conservation to be a concern. Four survivors with M16s in single shot mode and 50 round clips may be too hard for an infected team to pull down... which is really more fun than surviving.
|
I dont think this changes game balance, there are no changes that cant be achived by just pressing buttons in the right way. I decided to write this after my hand was stuck in a weird claw shape from holding CTRL and R using the shotgun.
Note to self...make crouch a toggle.
|
|
|
01-27-2009, 02:35 PM
|
#6 (permalink)
|
Join Date: Jan 2006
Posts: 788
Tournaments Joined: 0 Tournaments Won: 0
|
Re: HowTo: Scripting your way new firing modes
Hmm I guess its time to get a mouse with more than 2 buttons lol.
|
|
|
01-27-2009, 08:19 PM
|
#7 (permalink)
|
Join Date: Aug 2007
Location: Boise , ID
Posts: 1,076
Tournaments Joined: 0 Tournaments Won: 0
|
Re: HowTo: Scripting your way new firing modes
Mmh! This looks promising!
|
|
|
01-28-2009, 07:18 PM
|
#8 (permalink)
|
Join Date: May 2005
Location: Casting useless spells in Oklahoma.
Age: 28
Posts: 3,084
Tournaments Joined: 0 Tournaments Won: 0
|
Re: HowTo: Scripting your way new firing modes
Nicely done saik0
__________________
~~ Veritas simplex oratio est ~~
No matter how far a wizard goes, he will always come back for his hat. --T. Pratchett
<---- You know you're getting old when you rely on your forum meta-data to remind you how old you are.
My Rig
|
|
|
01-29-2009, 10:53 PM
|
#10 (permalink)
|
Join Date: Jul 2005
Location: Hollywood, FL
Age: 24
Posts: 131
Tournaments Joined: 0 Tournaments Won: 0
|
Re: HowTo: Scripting your way new firing modes
Quote:
Originally Posted by Avs
|
The author makes a decent argument. Pistols are the one exception to the rule, their max fire rate is much too fast. However, that aside scripting cant do anything an average player cant do without minimal effort. Any competitive "edge" that can be gained from using scripts is not from the direct benefit using single fire, or automatically reloading shells. It is from the tactical advantage gained. More focus can be paid to awareness, and strategy when the more mechanical aspects of playing are aided by scripts.
|
|
|
01-29-2009, 11:01 PM
|
#11 (permalink)
|
Join Date: Feb 2007
Location: Wherever my gallbladder isn't
Age: 21
Posts: 3,712
Tournaments Joined: 0 Tournaments Won: 0
|
Re: HowTo: Scripting your way new firing modes
I still disapprove of scripts that do things for the user
__________________
|TG-Mth| Ride.Everything.Also.Ponies.
Reaper & Co. - Now whopping PAC squads to run over and take their krylovs, please bring me an Otus PAC side
Krylovs and Otuses received so far - 7
|
|
|
01-30-2009, 12:30 PM
|
#12 (permalink)
|
Join Date: Aug 2005
Location: Columbia, SC
Age: 30
Posts: 1,096
Tournaments Joined: 0 Tournaments Won: 0
|
Re: HowTo: Scripting your way new firing modes
Quote:
Originally Posted by Reaperassault
I still disapprove of scripts that do things for the user
|
Kinda depends on the script, a crouch toggle for hunters just make sense as there's no real skill in keeping a pinkie on a button.
I don't mind burst mode on the assault rifle, as I believe the real life counterpart would have that toggle.
I don't like full-auto pistols or shotguns. One click of the mouse = one squeeze of the trigger. A full auto script would be simulating a rubber band around the trigger or similar, not entirely realistic that a zombie survivor would want that IMHO...
Again, L4D is clearly meant to put the player in the middle of a classic zombie movie, many of these scripts break that simulation (Glow & tweaked sounds). Some may want a more competitive game-style, and that's fine. But you can't have both at the same time as the cinematic experience is ruined by opponents or teammates playing for points. It'd be nice if the server could be configured to run stock-only cinematic mode, or fully customizable competitive mode.
|
|
|
01-30-2009, 12:52 PM
|
#13 (permalink)
|
Join Date: Mar 2007
Age: 39
Posts: 1,013
Tournaments Joined: 0 Tournaments Won: 0
|
Re: HowTo: Scripting your way new firing modes
Any script that automates an action you would normally have to do manually is imo a no-no. Toggles for crouch, walk are one thing, toggles that add a firing mode not included in the game are another however. I think it should go without saying to any honest player using a script to automate firing is a big no-no.
We use sv_allow_wait_command 0 on our server so any script with a wait command is blocked.
|
|
|
01-30-2009, 03:56 PM
|
#14 (permalink)
|
Join Date: Jan 2006
Posts: 788
Tournaments Joined: 0 Tournaments Won: 0
|
Re: HowTo: Scripting your way new firing modes
Right, Morganan's sv_allow_wait_command 0 is what is used on a lot of other HL2 game servers to prevent scripts (there are also other ways).
Another arguement I have heard is that theres no need to use scripts when the game demands a lot of flexibility at any given time. Consider this scenario:
You are bursting to shoot long range targets (actually only need 1 bullet to the head to kill, and the soft trigger on the assault rifle already bursts, but anyways). Then a boomer hits you and horde starts falling all over you. Ideally you'd start spraying around to shoot them down, but with scripts you'd have to toggle it since it cant detect a situational thing. In discussing this it became more clear that scripts were less necessary in a game where recoil wasnt a problem, and there were no issues hitting the max fire rate using any weapon (besides pistol).
The problem with using pistols is that its not a replacement for the UZI. Sure it can conserve ammo, but you can do the same. So the actual benefits here are not as high as it would seem initially. But still, I like Saik0's work done here. One guy argued that this actually made it worse for people who used it unless they felt it really improved their gameplay due to the fact that you had to rotate firing modes.
Here is an example of a script that has a much stronger argument towards cheating: Auto-reload with auto-shotty at 1 shell (so you never have to do a long reload).
|
|
|
01-30-2009, 04:27 PM
|
#15 (permalink)
|
Join Date: Mar 2007
Age: 39
Posts: 1,013
Tournaments Joined: 0 Tournaments Won: 0
|
Re: HowTo: Scripting your way new firing modes
sv_pure 1 forces the default models (not sure about default textures, but I *think* it forces those as well)
I've just never be a proponent of scripts past buy scripts or simple toggles. If you dont want to get repetitive injuries from clicking fire so much, either play less or not at all. Adding in firing modes the game doesnt offer is best suited for a mod, as anyone not having that script is at a disadvantage to someone who does.
|
|
|
 |
|
|
Tags
|
auto, autoexec.cfg, burst, customization, firemodes, keybinds, l4d, left 4 dead, saik0, script, semi-auto, single shot  |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|