Bind To Change Weapon

eagleceaglec 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

Comments

  • LucidLucid Join Date: 2002-12-11 Member: 10534Members, Constellation
    well i think there are some scripts for thast kinda thing but until then you can just bind a key to "lastinv". This will switch between your 2 most recently used weapons.
  • FireStormFireStorm Join Date: 2002-11-06 Member: 7390Members
    hud_fastswitch 1
    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
  • eagleceaglec Join Date: 2002-11-25 Member: 9948Members, Constellation
    edited February 2003
    Thanks Firestorm, it works great.

    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?
  • UnipacUnipac Join Date: 2003-01-27 Member: 12864Members, Constellation
    Can anyone translate the above two posts in plain english? lol
  • FireStormFireStorm Join Date: 2002-11-06 Member: 7390Members
    <!--QuoteBegin--Unipac+Feb 16 2003, 10:30 AM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Unipac @ Feb 16 2003, 10:30 AM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> Can anyone translate the above two posts in plain english? lol <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
    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.
  • aeckaeck Join Date: 2003-02-15 Member: 13600Members
    Nice script, but wouldn't it be much simpler with just

    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-->
  • eagleceaglec Join Date: 2002-11-25 Member: 9948Members, Constellation
    And to translate my changes, because I didn't want to customise the NS configurations file half-life/ns/config.cfg too heavily in case I screwed it up I only added the line "exec switcher.cfg" t othe end of it. When NS started it runs config.cfg to set all the client configurations, now when it gets to the end on config.cfg it is told to execute switcher.cfg.

    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.
  • FireStormFireStorm Join Date: 2002-11-06 Member: 7390Members
    <!--QuoteBegin--aeck+Feb 16 2003, 04:32 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (aeck @ Feb 16 2003, 04:32 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> Nice script, but wouldn't it be much simpler with just

    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...
  • KhadajiKhadaji Join Date: 2003-02-07 Member: 13229Members
    here's another control setup that i use to great effect.

    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.
  • HEAD_d_bHEAD_d_b Join Date: 2003-02-01 Member: 12967Members
    <!--QuoteBegin--FireStorm+Feb 9 2003, 01:38 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (FireStorm @ Feb 9 2003, 01:38 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> hud_fastswitch 1
    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
  • FireStormFireStorm Join Date: 2002-11-06 Member: 7390Members
    <!--QuoteBegin--HEAD d^_^b+Feb 17 2003, 08:52 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (HEAD d^_^b @ Feb 17 2003, 08:52 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> <!--QuoteBegin--FireStorm+Feb 9 2003, 01:38 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (FireStorm @ Feb 9 2003, 01:38 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> hud_fastswitch 1
    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"
  • OkaboreOkabore Join Date: 2002-11-21 Member: 9505Members
    <!--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-->here's another control setup that i use to great effect.

    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.
  • MaTTMaTT Join Date: 2002-11-01 Member: 3033Members
    edited February 2003
    Since your all posting weapon selection scripts I thought I may aswell show u mine... Basically if your an alien you use a toggle key to let the script know how many hives you have. Then if you are only on your first hive you can tell the script you only have 1 hive and it will ignore the slot3 and slot4 weapon positions meaning it will only toggle between bite and parasite if your a skulk. When your second hive is built you press the hive selector key only once and the third weapon slot becomes available on your mousewheel. Press it again when your third hive gets built and your fourth weapon slot becomes available in your mousewheel. You can also press it a few times to go back to your 2 or 1 hive weapons if you happen to lose a hive or two.

    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.
Sign In or Register to comment.