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:
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:
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.
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"
alias w3 "wait; wait; wait"
alias +plant "slot5; +duck; w3; +attack; cover me"
alias -plant "-attack; w3; -duck; lastinv"
bind [Key] "+plant"
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"
//Crosshair Script
bind mouse1 "+attack; adjust_crosshair"
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.
Comment