Binds & Scripts for CS: Source

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Red_October

    #1

    Binds & Scripts for CS: Source

    First, I'd like to thank Bokuho for his Basic CS1.6 binding guide v2.0, it gave A LOT of information on binding & scripting, and the consequential responds gave even more information as people posted their own questions and answers.

    But from what I can see, there's very little in the way of a scripting and binding guide specificallyfor CounterStrike: Source, and seeing as there's a lot of differences between 1.6 and Source, I thought it'd be nice to have a such guide in its own spot right on the Editing section of the forums.

    That said, I have a couple of tips of my own, mostly in response to Bokuho's post, but I'm posting them here because I'm playing Source, and this is now the official place to talk about scripting for Source (I'm hoping). I also have some questions of my own.

    All of Bokuho's guide on binding radio commands and such works great, and although I have my own personal arsenal of radio commands binded all over the right side of my keyboard, I won't waste space telling you about them. But I definitely suggest binding some frequently used commands to easily available keys as soon as you can.

    Bokuho's post has some talk about a Bomb script for planting a bomb. I've copied it below:
    - One Button Bomb Plant, hold down the button to take out bomb, crouch, and give radio command "Cover Me", release the button at any time to stand back up and switch to previous weapon. Good for in case you come under fire while planting.

    alias w3 "wait; wait; wait"
    alias +plant "slot5; +duck; w3; +attack; cover me"
    alias -plant "-attack; w3; -duck; lastinv"
    bind [Key] "+plant"
    The problem with his "lastinv" command is that although it will switch back to the previous (usually primary) weapon if the bomb-planting animation is interrupted, in the case that the bomb is planted successfully, it will end up switched to the second-to-last weapon equipped (usually the pistol). This is because when you successfully plant the bomb, you automatically switch to your best weapon, and the lastinv command makes you switch again. So, I've modified the third line of the script so that you switch to your best weapon (in the order of primary-secondary-knife) regardless of setting the bomb successfully or not:

    alias -plantc4 "-attack; w3; -duck; slot3; slot2; slot1"

    Notice the game's logic is first switching to the least advantageous weapon first, and then to the better weapon. If there is no better weapon (i.e: primary), then it doesn't switch, and just sticks with what you have. Believe it or not, this works perfectly, as the engine interrupts its own "switch to knife" animation to instead switch to the pistol, then primary weapon, so there is no hitch where your character is cycling through the three weapons. It just goes straight to whatever your best weapon is.

    It would probably also be wise to have the character switch to a flash, smoke, or frag grenade if they have it in the case of not having a primary gun, since any of these would possibly be a little more usable if interrupted by an enemy while setting the bomb. You can figure that out on your own.

    Bokuho also has this extra script below:
    - Crosshair Script, changes the color of your crosshair everytime you fire your gun. This can help you concentrate on the crosshair rather then your purdy new AWM model.

    //Crosshair Script
    bind mouse1 "+attack; adjust_crosshair"
    I liked the idea of this script more because changing the crosshair color helps in situations when the textures you're facing start blending in with your crosshair. It's nice to have the color change so you can always see it. Source doesn't have a "adjust_crosshair" command, though, so I've had to write the script below. Notice though, that instead of making the color change every time I fire my gun, I binded to the letter "j". This is because I have "zoom" buttons on [link="http://www.logitech.com/index.cfm/mice_pointers/mice/devices/165&cl=us,en"]my mouse[/link] that I've changed to be binded to certain keys on my keyboard, so I can use these extra buttons in-game for binds.

    alias crosshaircolor1 "Cl_crosshaircolor 0; bind j crosshaircolor2 " //This sets the alias for the crosshair color changes
    alias crosshaircolor2 "Cl_crosshaircolor 1; bind j crosshaircolor3 "
    alias crosshaircolor3 "Cl_crosshaircolor 2; bind j crosshaircolor4 "
    alias crosshaircolor4 "Cl_crosshaircolor 3; bind j crosshaircolor5 "
    alias crosshaircolor5 "Cl_crosshaircolor 4; bind j crosshaircolor1 "

    crosshaircolor1 //This line starts the crosshair color default as green

    bind j "crosshaircolor2" //This makes sure the key will start by changing the crosshair color to red

    Finally, for a couple questions of my own. First, is there yet anyway to have a command return the amount of health or armor a player has? So that there can be a command like:

    alias hp "player_health"
    bind * "Say Wanna knife? I've got... ; Say "hp" "

    This would be nice thing to be able to do.

    Next, someone asked about binding their 4, 5, and 6 number keys to equipping their flash, frag, and smoke grenades. There was a solution posted for 1.6, but I finally figured out how to do this in Source. Here's the script below:

    bind 4 "use weapon_hegrenade"
    bind 5 "use weapon_flashbang"
    bind 6 "use weapon_smokegrenade"

    Is there a way to display text on a player's screen? I know that you can do this in the server, but I just mean displaying it on your own screen, on the client-side. (This may sound dumb, but I'd like to have a small box come up to remind me of less-used binded keys when I press a key)

    I think that's it for now. My only other comment is that I hope people are making more CS:S Skin of the Day's, because I LOVE the ones I've got so far. (And remember people, world models make Jesus happy and Santa give more presents)

    I appreciate any (well-intended) feedback given. Thanks. Out.
  • Red_October

    #2
    Okay, next subject: buy binds. Bokuho explains it one way, and it definitely is not working with Source. So I spent some time trying to figure out some, and finally figured it out after some internet searching. The following is my examples:
    (note: w3 or w5 stands for a wait alias I have earlier in the script)

    alias cls "slot10"
    alias cls2 "cls; wait; wait; cls" //These were taken from AutoScript Source v1.0 Dec 2004
    alias close "w2; cls2"

    alias armor "buy vesthelm; close; buy vest; close" //The armor func buys the Kevlar&Helmet if there's enough cash, but if there isn't, it just buys the Kevlar
    bind F5 "armor"

    bind F6 "buy hegrenade; close"//Buys a frag grenade
    bind F7 "buy flashbang; close"//Buys a flashbang
    bind F8 "buy smokegrenade; close"//Buys a smoke grenade
    bind F11 "buy defuser; close"//Buys a defusal kit

    The problem I do still have, though, is that I still can't figure out how to make one button bring up and exit the Buy Menu. The following is the script I've come up with so far:

    alias ToggleBM "BMon" //Starts func ToggleBM as turning on the buymenu
    alias BMon "buymenu; w2; alias ToggleBM BMoff" //Brings up the buymenu, then toggles the TBM to off
    alias BMoff "close; w2; alias ToggleBM BMon"//Exits the buymenu, then toggles the TBM to on
    bind ALT "ToggleBM"

    Pressing ALT brings up the BuyMenu, and then after closing it manually (with the 0 key), pressing ALT twice will bring the BuyMenu up again. So, there's nothing wrong with the ToggleBM func, it's just not closing the menu. Any thoughts?

    EDIT: Hell, is anyone even reading this friggin' thread, or am I just talking to myself here?

    Comment

    • Red_October

      #3
      On a high note, I have figured out a way to set binds so that they are Team-specific. For example, in the above I talk about binding F9 to func the bomb-planting script. As a Counter-Terrorist, I want to be defusing the bomb. I could just as easy write a script binding a different button to do this, but in combat, it's easier to associate "Bomb" with one button - in my case, F9. So I made two more .cfg files in my cfg folder: CTconfig and Tconfig. To the Tconfig file I moved the Bomb-plant script from above, and in the CTconfig file I wrote the following:

      alias +diffuse "coverme; w3; say_team I'm trying to diffuse the bomb! ; wait; +duck; w3; +use" //This makes the player ask for cover, drop, and start defusing
      alias -diffuse "-use; w3; -duck; slot3; slot4; slot2; slot1" //Whether the bomb is diffused or not, upon release of F9 the player gets up and switches to their best weapon, being primary, secondary, grenade, or knife, in that order.
      bind F9 "+diffuse" //Binds F9 to diffuse

      Now I have a bomb-diffusing scrip for the CT. Next, I added the following to my userconfig.cfg file so that upon joining a team, I could hit F10 to toggle which team I was going to have my binds set for.

      alias Tteam "teamcounterterrorist"//Starts Tteam as CT
      alias teamcounterterrorist "exec CTconfig; echo TeamConfig set as Counter-Terrorist; alias Tteam teamterrorist"
      alias teamterrorist "exec Tconfig; echo TeamConfig set as Terrorist; alias Tteam teamcounterterrorist"
      //Each executes the Team-specific config, displays that fact to the console, then switches Tteam so the next time it's pressed, it'll do the other

      bind F10 Tteam//Binds F10 to T(toggle)team

      I think this is kind of nice to have, but the Team-specific bind toggle is really only going to be efficient if there's other things I'd like to be able to do differently depending upon which team I'm on.

      Comment

      Working...