Bind To Change Weapon
eaglec
Join Date: 2002-11-25 Member: 9948Members, Constellation
A friend wanted to bind a key to change and select the next weapon, so it was a single keypress and then the weapon was drawn ready for use. I tried <b>bind "b" "nextinv;+attack"</b> but that didn't work? actually I think he wanted a keypress that toggles pistol/mg but I figured this would be too hard <!--emo&;)--><img src='http://www.unknownworlds.com/forums/html/emoticons/wink.gif' border='0' style='vertical-align:middle' alt='wink.gif'><!--endemo-->
Hopefully the bind would also work in when he is alien to assist in blink/slash manouvers
Hopefully the bind would also work in when he is alien to assist in blink/slash manouvers
Comments
developer 1
bind mwheelup ap
bind mwheeldown an
alias an a2
alias ap a4
alias a1 "alias an a2; alias ap a4; slot1; echo Weapon 1"
alias a2 "alias an a3; alias ap a1; slot2; echo Weapon 2"
alias a3 "alias an a4; alias ap a2; slot3; echo Weapon 3"
alias a4 "alias an a1; alias ap a3; slot4; echo Weapon 4"
bind 1 a1
bind 2 a2
bind 3 a3
bind 4 a4
I modified/simplified what you gave me a little, in config.cfg I put
exec switcher.cfg
Then write protected it again <!--emo&;)--><img src='http://www.unknownworlds.com/forums/html/emoticons/wink.gif' border='0' style='vertical-align:middle' alt='wink.gif'><!--endemo-->
Finally I created switcher.cfg with:-
hud_fastswitch 1
bind b switchwep
alias switchwep pistol
alias rifle "alias switchwep rifle; slot1"
alias pistol "alias switchwep pistol; slot2"
In HL we have got used to using b as the secondary fire button, we use zxcvb on the left hand for use,Lstrafe,RStrafe,Fire,Secondary, right hand for mouse look and mouse buttons for move.
My friend Captain_Carrot suggested using b to switch weapons but now I've tested it I think I'll be using it too. Seems much better than charging a fade down and then fumbling for next weapon!
I was curious why did you included developer 1 ? It apears to work without it?
no problem lol
hud_fastswitch 1
= set the console variable hud_fastswitch to 1 so your weapons are changed when you press the keys 1, 2, 3, 4 (commands slot1 to slot4)
developer 1
= set the developer mode so you can see console messages in the upper left corner of your screen while playing
bind mwheelup ap
bind mwheeldown an
= if you roll your mousewheel up it will execute the command "ap" and the command "an" if you roll it down.
alias an a2
alias ap a4
= "an" means "a2" and "ap" means "a4"
alias a1 "alias an a2; alias ap a4; slot1; echo Weapon 1"
alias a2 "alias an a3; alias ap a1; slot2; echo Weapon 2"
alias a3 "alias an a4; alias ap a2; slot3; echo Weapon 3"
alias a4 "alias an a1; alias ap a3; slot4; echo Weapon 4"
= "a1" means that: "an" means "a2", "ap" means "a4", "you select the weapon 1, you display the messsage "Weapon 1" in the upper left corner of the screen. The same goes for a2 to a4;
bind 1 a1
bind 2 a2
bind 3 a3
bind 4 a4
= if you press the keys 1 to 4 on your keyboard it will execute the commands a1 to a4 instead of slot1 to slot4.
hud_fastswitch 1
bind key1 "invnext"
bind key2 "invprev"
Much less to type, anyway. <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->
I write protected config.cfg so that I cant accidently make permenent chnges whilst playing but also to stop unscroupulous admins from being able to change my bindings. The final reason for write protecting it is so that Ns doesn't remove the exec command when I close NS.
Finally for the 'clever' bitI created switcher.cfg in the half-life/ns/ folder which is a simple text file with the following contents (minus the line numbers that are there for reference:-
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
1) hud_fastswitch 1
2) bind b switchwep
3) alias switchwep pistol
4) alias pistol "alias switchwep pistol; slot2"
5) alias rifle "alias switchwep rifle; slot1"
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
Line 1) Explained by Firestorm
Line 2) Simple keybind, probably should have stayed in config.cfg but what the hell
Line 3) Set Switchwep command equals pistol command
Line 4) Pistol command equals "set switchwep equals rifle command and then run slot2 command" the slot 2 command selects the pistol.
Line 5) Rifle command equals "set switchwep equals pistol command and then run slot1 command" the slot 1 command selects the rifle.
Firestorms code allows you to wheel scrol quickly through your armoury but mine allows a single button to toggle between the two most used marine weapons. My code is only really any good if you are a marine where as Firestorms is universal. Of course it would be simpe to create switcher-fade.cfg switcher-lerk.cfg etc including the 'impulse xxx' command to gestate to these aliens as well as bind new keys and then bind F5 - F8 to exec switcher-whatever. Of course evolving lerk instead of fade because you pressed the wrong F key could be bad <!--emo&;)--><img src='http://www.unknownworlds.com/forums/html/emoticons/wink.gif' border='0' style='vertical-align:middle' alt='wink.gif'><!--endemo-->
Generally speaking I am opposed to scripts but this one seems harmless.
hud_fastswitch 1
bind key1 "invnext"
bind key2 "invprev"
Much less to type, anyway. <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo--> <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
no, because when you're an alien you never know what weapon do you have. With your script when you're a fade and you see your "gun" you don't know if you'll launch an acid rocket or a bilebomb for example.
With my script you see "Weapon 1, Weapon 3 etc" in a screen corner so you know what you have.
I wrote this script because HL has many weapons ant the scroll & click method to select the right weapon was the best. In NS you have up to 4 weapons so the clicking is useless, like in Q3...
i bind the right mouse button to "most recently used weapon".
this way, i use the 1234 keys to setup the two weapons i know
i'm going to use.
e.g.: if i'm a 1 hive skulk -- i can swap between parasite and bite, or
as a 2 hive skulk, between bite and leap. as a lerk, i swap between
umbra and spikes, etc. as a spawn marine, i swap LMG/pistol, etc
so there are basically two weapons i'm really using in a given situation.
this works well for me. hope it helps.
if you're new, be aware that the right mouse button is usually used
for the menu. if you're not using hotkeys for the menu, then just bind
the menu to the Q button. you can hold down Q and release it when
your mouse is over the correct option. works nicely.
developer 1
bind mwheelup ap
bind mwheeldown an
alias an a2
alias ap a4
alias a1 "alias an a2; alias ap a4; slot1; echo Weapon 1"
alias a2 "alias an a3; alias ap a1; slot2; echo Weapon 2"
alias a3 "alias an a4; alias ap a2; slot3; echo Weapon 3"
alias a4 "alias an a1; alias ap a3; slot4; echo Weapon 4"
bind 1 a1
bind 2 a2
bind 3 a3
bind 4 a4 <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
u realy need a developer 0 in there or u will be geting loads of junk in your console
hud_fastswitch 1
alias d1 "developer 1"
alias d0 "developer 0"
bind mwheelup ap
bind mwheeldown an
alias an a2
alias ap a4
alias a1 "alias an a2; alias ap a4; slot1; d1; echo Weapon 1; d0"
alias a2 "alias an a3; alias ap a1; slot2; d1; echo Weapon 2; d0"
alias a3 "alias an a4; alias ap a2; slot3; d1; echo Weapon 3; d0"
alias a4 "alias an a1; alias ap a3; slot4; d1; echo Weapon 4; d0"
and if he does not want to use "hud_fastswitch 1" it whot work unless u
alias get1 "weapon_machinegun; weapon_heavymachinegun; weapon_grenadelauncher;.......... ect....... ect
alias get2 "weapon_pistol; weapon_welder ;............
and so on
developer 1
bind mwheelup ap
bind mwheeldown an
alias an a2
alias ap a4
alias a1 "alias an a2; alias ap a4; slot1; echo Weapon 1"
alias a2 "alias an a3; alias ap a1; slot2; echo Weapon 2"
alias a3 "alias an a4; alias ap a2; slot3; echo Weapon 3"
alias a4 "alias an a1; alias ap a3; slot4; echo Weapon 4"
bind 1 a1
bind 2 a2
bind 3 a3
bind 4 a4 <!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
u realy need a developer 0 in there or u will be geting loads of junk in your console
hud_fastswitch 1
alias d1 "developer 1"
alias d0 "developer 0"
bind mwheelup ap
bind mwheeldown an
alias an a2
alias ap a4
alias a1 "alias an a2; alias ap a4; slot1; d1; echo Weapon 1; d0"
alias a2 "alias an a3; alias ap a1; slot2; d1; echo Weapon 2; d0"
alias a3 "alias an a4; alias ap a2; slot3; d1; echo Weapon 3; d0"
alias a4 "alias an a1; alias ap a3; slot4; d1; echo Weapon 4; d0"
and if he does not want to use "hud_fastswitch 1" it whot work unless u
alias get1 "weapon_machinegun; weapon_heavymachinegun; weapon_grenadelauncher;.......... ect....... ect
alias get2 "weapon_pistol; weapon_welder ;............
and so on <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
I'm a mod coder so I'm used to this "junk"
i bind the right mouse button to "most recently used weapon".
this way, i use the 1234 keys to setup the two weapons i know
i'm going to use.
<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
This is the method I use when I play. It has the benefit of reducing the damage from pressing the right button in the middle of a fight. To just be able to strafe is a killer and I once managed to jump to ready room when I literally had the jump on a marine <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->
All beacuse I happend to pop up the menu.
<!--QuoteBegin--Khadaji+Feb 17 2003, 02:37 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Khadaji @ Feb 17 2003, 02:37 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->
if you're new, be aware that the right mouse button is usually used
for the menu. if you're not using hotkeys for the menu, then just bind
the menu to the Q button. you can hold down Q and release it when
your mouse is over the correct option. works nicely.<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
The standard bind for the middle mouse button is the menu so I use that. I find it hard to press in a fight and when I fight I dont have time for the menu so it works out fine.
I have instead placed chuckle/follow me on the Q.
In the script there is also another key you press to tell the script you are on the marine team so that you can toggle between the marines weapons.
///Below Section goes in your autoexec.cfg
//Dynamic Natural Selection weapon selector
hud_fastswitch 1
alias d1 "developer 1"
alias d0 "developer 0"
alias 1hive "d1; echo 1 hive weapons enabled; Bind mwheeldown 1hive1; Bind mwheelup 1hive1; Bind F8 2hive; d0"
alias 2hive "d1; echo 2 hive weapons enabled; Bind mwheeldown 2hive1; Bind mwheelup 2hive1; Bind F8 3hive; d0"
alias 3hive "d1; echo 3 hive weapons enabled; Bind mwheeldown 3hive1; Bind mwheelup 3hive1; Bind F8 1hive; d0"
alias 1hive1 "d1; echo Bite-Spit-Bite-Slash-Gore selected; slot1; bind mwheeldown 1hive2;bind mwheelup 1hive2; d0"
alias 1hive2 "d1; echo Parasite-Heal-Spike-Acid-Paralyse selected;slot2; bind mwheeldown 1hive1;bind mwheelup 1hive1; d0"
alias 2hive1 "d1; echo Bite-Spit-Bite-Slash-Gore selected; slot1; bind mwheeldown 2hive2; bind mwheelup 2hive3; d0"
alias 2hive2 "d1; echo Parasite-Heal-Spike-Acid-Paralyse selected;slot2; bind mwheeldown 2hive3;bind mwheelup 2hive1;d0"
alias 2hive3 "d1; echo Leap-Web-Umbra-Blink-Charge selected; slot3; bind mwheeldown 2hive1;bind mwheelup 2hive2;d0"
alias 3hive1 "d1; echo Bite-Spit-Bite-Slash-Gore selected; slot1; bind mwheeldown 3hive2; bind mwheelup 3hive4; d0"
alias 3hive2 "d1; echo Parasite-Heal-Spike-Acid-Paralyse selected; slot2; bind mwheeldown 3hive3; bind mwheelup 3hive1; d0"
alias 3hive3 "d1; echo Leap-Web-Umbra-Blink-Charge selected; slot3; bind mwheeldown 3hive4; bind mwheelup 3hive2; d0"
alias 3hive4 "d1; echo Xeno-Babbler-Gas-Bile-Primal selected; slot4; bind mwheeldown 3hive1; bind mwheelup 3hive3; d0"
alias marine1 "d1; echo LMG-Shotgun-HMG-Grens selected; slot1; bind mwheeldown marine2;bind mwheelup marine3; d0"
alias marine2 "d1; echo Pistol-Welder-Mines selected; slot2; bind mwheeldown marine3;bind mwheelup marine1; d0"
alias marine3 "d1; echo Knife selected; slot3; bind mwheeldown marine1;bind mwheelup marine2; d0"
alias marinewep "d1; echo Marine weapons enabled; Bind mwheeldown marine1; Bind mwheelup marine1; Bind F7 alienwep; Bind F8 disablese; d0"
alias alienwep "d1; echo Alien weapons enabled; Bind mwheeldown 1hive1; Bind mwheelup 1hive1; Bind F7 marinewep; Bind F8 1hive; d0"
alias disablese "d1; echo Key disabled in marine mode; d0"
///below goes in your config.cfg
//Mousewheel binds
bind "MWHEELDOWN" "1hive1"
bind "MWHEELUP" "1hive2"
//Toggler between alien and marine weps
bind "F7" "alienwep"
//Number of Hives weapon selector
bind "F8" "disablese"
///end
I know it looks complex but it works great! Also if you want to change the bind keys you will have to change them throughout the script as it uses metabinds on F7 and F8.