Writing CFG Mods Tutorial 3 - Other Commands

Other Commands and Dvar Domains


So know you have the two most important commands down: set and bind, and you know a few useful dvars. Now let’s talk about some other useful commands and other domains for dvars.

Like I said before, player_sustainammo is a boolean dvar and has a domain of 0 or 1. I also used g_speed and g_gravity in the previous tutorial. Those are both integer dvars. The domain of g_gravity is any number 1 or greater. The domain of g_speed is any number. Some other dvars and their domains are:


Dvar: ui_playerpartycolor
domain: color in RGBa percents
Example value:  “0.3 0.3 1 1”

Dvar:  motd    
Domain:  any text
Example value:   “Visit CallofDuty.com”

Dvar:  r_colormap
Domain:   0 - 3
Example value:  “1”


Ui_playerpartycolor is the color of your gamertag as you see it in lobbies. It takes four integers into its value: red, green, blue, and alpha. Alpha is the visibility, 1 being completely visible, 0.5 being somewhat visible, and 0 being invisible. In most cases, colors are represented in red-green-blue values out of 255, but here they are done in percents. To find a color you want, you can use an online color picker, or a program like photoshop or paint.net. Find the RGB values of the color you want and divide each by 255. This will give you their percents. If you do something like set ui_playerpartycolor 1, the game will make the value 1 0 0 0. In other words, it was looking for four numbers and you only gave it one, so it made the rest 0. In this case, your gamertag would be invisible because the alpha is zero, but in other cases, the alpha might be ignored and the color would be red becuase the value you gave for red is 100% and the value for the other colors was 0.


Motd is the message of the day that you see in the bottom left corner of the screen in the game menus. Its value is any text, but, as with other dvars, it has a character limit of 255; it will only take the first 255 characters of its value if you try to set it to more.


R_colormap is a dvar that will replace the color maps in a game with pure black or white. That probably doesn't make any sense, but use it in-game and you'll see what it does. Its domain is 0-3, but it doesn't function like g_speed or g_gravity. When you change the value of g_speed, for example, you move faster or slower; its value controls the speed. With r_colormap, each value does something different. A value of 0 will change all the colormaps with black, 2 with gray, 3 with white, and 1 won't change them.


Now for some other commands:


command: toggle
usage: toggle <dvar> <values>
example: toggle r_colormap 0 1 2 3


command: setviewpos
usage: setviewpos <x y z yaw>
example: setviewpos 100 56 236 23 56


command: wait
usage: wait <time>
example: wait 100


command: snd_playlocal
usage: snd_playlocal <sound alias>
example: snd_playlocal mouse_over


command: setperk
usage: setperk <players name> <perk>
example: setperk walkerneo specialty_bulletaccuracy


command: give
usage: give <weapon name>
example: give zombie_m1carbine


command: setfromdvar
usage: setfromdvar <dvar> <dvar you're getting the value from>
example: setfromdvar motd name



Toggle is a lot like set, but you have multiple values. Each time you use the command, it will toggle between the values you gave it. If you do:


bind dpad_up "toggle g_speed 300 400 700"


Each time you press up on the dpad, it will toggle g_speed between the values you gave. If the value was 160, it will change it to the first value you specified, 300. If the value was 300 and you press up, it will go to 400, 400 to 700, 700 to 300, and so on. With dvars like r_colormap, you don't have to specifify the values you want to toggle, it will just toggle between the values in its domain. Toggle r_colormap will change it to 2 if it was 1, 3 if it was 2, and so on. If you put toggle r_colormap 0 3, then it will only toggle between 0 and 3. The same is true for booleans. This will not work for dvars like g_speed or g_gravity, however. If you just put toggle g_gravity, nothing would change.


Setviewpos sets the coordinates and yaw of a player. The coordinates are where you are relative to the origin, or the center of the map, and the yaw is the direction you are facing. The yaw is two numbers and the coordinates are three. Unlike with the color dvars, if you only put one number, it will not make the other two 0. You have to specify at least the x y z coordinates, but the yaw is optional. To find these numbers, use the command viewpos. On xbox, you don't have a console, but if you set the dvar con_minicon to 1, it will display the information printed to the console in the upper left hand corner.


Wait will pause the script for the amount of time specified. I believe the units are somewhere around tenths of a second. What this means is that while the script is waiting, it won't execute any other commands you give it. If did:

bind button_rshldr "wait 1000"
bind button_lshldr "noclip"


...and then pressed RB and then LB, the game would first wait 1000 (again, not sure about the exact units) and then execute noclip. If you press RB and then press LB repeatadly, wondering why you aren't going into noclip, after the script stops waiting, it will execute every command you entered while it was waiting. In other words, it will toggle noclip as many times as you pressed it. It's sort of like printing something over and over again because it lagged the first time but you were impatient...


Snd_playlocal is pretty simple. It will play a local sound file at your position. snd_playlocal mouse_over will play the sound file titled "mouse_over", which is the sound made when you hover over an option on PC. So far as I know, there is no easy way to find all the sound files. You can use FF viewer to see the sound files in the FFs and you can use a zipping program to open the IWDs and check the sound files, but there isn't a command like cmdlist or dvardump that will just list them all in the console. I have listed some of the usable sound files in resources.


Setperk is pretty self-explanatory. It will give a player a perk. You have to use the exact gamertag of the person you want to give the perk to however.


Unlike setperk, give doesn't need a player to be specified, it will just give the weapon to whoever used it. Instead of a weapon name, you can also use all or ammo. Give all will give you all the guns, and give ammo will give you all the ammo for all the guns. Based on this context, you might assume that give all gives you guns with no ammo, but that isn't the case; give all gives you all guns with full ammo.


Setfromdvar can be a very useful command and was used very briefly in Black Ops mods before they were patched again in Title Update 8. It's basically the same thing as the set command, but for the value we put a dvar and it will take the value of the dvar we give and set the other dvar to it. In the example I did setfromdvar motd name. The dvar we are setting is motd, or the message of the day, which is the text in the bottom left corner of the screen in the game menus. The dvar we are getting the value of is name, which is the name of the player. In my case, the name would walkerneo and since we are setting motd from name, the motd would become walkerneo.





Congrats! You finished another tutorial!!

Click here to move onto the next tutorial, Introduction to vstr.


Or, if you feel you deserve, take a break in the entertainment section.