Useful console commands for mappers.

Avatar
sicklebrick
876 Posts
Posted Jun 04, 2012
I'm really good at forgetting console commands, so sometimes I go through a lot of unnecessary work to avoid sifting through the endless lists of Portal cheats for the right one. With that in mind I decided to throw together a wee list of the ones I found most useful. By the time I was done commenting, it looked like a guide. If anyone would like to contribute something, please do. Hope it helps!

** Entity Dumping\Information

cl_showpos 1 --Shows current name, position, angle and velocity

cl_showents -Displys a list of entities (class and index only)
cl_showfps 1 --Shows current fps and map (BSP) path+name
report_entities --Lists current entities, including edicts

ent_info <classname> --Lists input\output for a given class.

impulse 106 --Displays the entity name, class and model that you're looking at.
ent_dump <entity name>OR<index>OR<class> --As above but lists values and non-fgd IO

differences --Dumps IO, debug and changes to the console and overlays to the screen as they happen.
ent_messages_draw 1 --Draws a little box with IO messages at entities' origin.

find_ent fudge --Finds entity named fudge, and dumps its entity ID (index).

cl_dumpplayer 1 --Dumps a lot of the player's internal variables. Mostly stuff you have no access to.

//Require "Developer 1", shows point entities and hammer models if possible.
ent_bbox <objectname> -- Shows an axis aligned bounding box around the target.
cl_ent_bbox -- Shows the bounding box around !picker.

** Mats \ Drawing:

mat_fullbright 1 --Uses fullbright lighting, i.e. with no shadows\shading\lightsources.
buildcubemaps --rebuilds the current .bsp's cubemaps and saves to the map, must be in the latest dlc\maps folder.
cl_drawmaterial "logo/logo" --draws the "/materials/logo/logo.vmt" materials over the screen.
mat_drawTexture --Same thing really.

reload_materials 1 --Game will reload all materials at the next map load

mat_texture_list 1 - Brings up a window showing all used textures per frame. Hit the button at the top left to open the filtering options.

mat_texture_list_all_frames 2 - How many frames to sample textures from.
mat_texture_list_all 1 - Shows all textures in the above window

+mat_texture_list and -mat_texture_list are also available for binding.

impulse 107 --Displays the texture of the current brush.
mat_crosshair --Displays the texture of the current brush or displacement.

mat_show_histogram 1 -- Displays a lot of information re: how many pixels rendered, how many textures used in the current frame, etc. Use mat_show_histogram 2 for a more compact version.

r_simpleworldModel_drawbeyonddistance_fullscreen 2500 - Increases the distance you can see portals from without them going black or white (including world portals). You can of course automate this in your maps with a logic_auto for more draw distance off the bat.

give weapon_cubemap --Gives a cubemap test weapon.
use weapon_cubemap --Switch to it.
use weapon_portalgun --Switch back.

// You will need to copy the following files from an older source game for this to work:
// Use gcfscape or vpk.exe in the \bin\ folder.
// https://developer.valvesoftware.com/wiki/Weapon_cubemap )

-- \materials\models\shadertest\envball_
-- \materials\models\shadertest\shieldnoise0_normal.vtf
-- \models\shadertets\envballs.
--May have to copy and rename envballs.dx80.vtx to envballs.dx90.vtx
-- \scripts\weapon_cubemap.txt

** Player Control:

+use then -use --Simulate the player pressing E
sv_gravity 300 --Halves the gravity. Accepts negative values also.
sv_player_collide_with laser 0 --Disable laser collisions

cl_holdrotation --Use right mouse button (or secondary fire) to lock rotation while holding an object.

impulse 100 --Enables the flashlight from HL2, etc.

host_timescale 0.5 --Halves the speed of the game.

noclip --Go through walls and stuff.
god --Blasphemy, false idols, burning bushes and all that...
notarget --Turrets won't bother you

** Physics:

vcollide_wireframe 1 - Draws vPhysics collision mesh for all models. (Excluding func_physbox)
phys_showactive 1 --Draws a bounding box around currently active physics objects. Uusefull for debugging laggy situations, or func_brush collisions, etc.
physics_debug_entity --Prints physics penetration debug messages and so forth.

** Portals:

give_portalgun -unknown
upgrade_portalgun
upgrade_potatogun
give weapon_portalgun or ent_create weapon_portalgun are also valid.

sv_allow_mobile_portals 1 --Portals can be placed on moving surfaces (not world portals)
sv_allow_mobile_portal_teleportation 1 --And now you can go through them

change_portalgun_linkage_id <0-3> --Allows you to use upto 4 sets of different portals

sv_portal_placement_never_fail 1 --Place portals anywhere you please
sv_portal_placement_never_bump 1 --No portal bumping.
sv_player_funnel_into_portals 0 --Player nudged towards portals whilst airbourne. E.g. falling.
sv_props_funnel_into_portals 0 --As above.

r_simpleworldmodel_drawforrecursionlevel_fullscreen -1 --No limit on portal draw distance (On all graphics settings including window mode). Suggested use OnMapSpawn.

** Sound:

snd_rebuildaudiocache --Required when adding custom sounds
snd_updateaudiocache --Kinda similar.

** Other:

status --Dumps the player's details. (IP, map, pos, steam ID, steam nick, etc)

cvarlist --Displays a list of cVars. Hurrah!
cvarlist A --Lists all cvars beginning with a
find sound --Lists all commands containing the word "sound"

condump --Dumps the current console contents to a txt file.
con_log fudge.txt --Writes the console to fudge.txt as it updates, untill you close portal.
developer <0-4> --Sets the debug output level. 0= none.
echo fudge --Prints the word "fudge" to the console. Useful for debugging hammer IO.
//Remember not to put "QUOTES" into the hammer IO though.

net_graph <1-6> -- Overlays your current FPS, ping, traffic, etc.

gameinstructor_enable 0 --Shuts wheatley up, turns off hints.

ent_fire * open --Opens most doors and things without fuss.

exit --Exits nice n quickly.

** Coop:

ss_map <mapname> --Loads a coop map, allowing you to play as both parties.
changelevel <mapname> --Both players transition to new map.

ss_enable 1 --Enable splitscreen, not super necessary
ss_force_primary_fullscreen 1 --Player 1 fullscreen
ss_splitmode 0 --Auto setting
ss_splitmode 1 --Horizontal Split
ss_splitmode 2 --Vertical Split

cmd2 <command> --Runs the command as player 2

BindToggle "z" "in_forceuser" --Switches between controlling player 1 and 2 when you hit Z

ent_fire blue <command>
ent_fire red <command> The player entity names in coop
ent_fire !player_blue <command>
ent_fire !player_orange <command> As above, but independent of "targetname" changed via addoutput, etc.

Note:
To play a coop map solo, you can simply use:
map mp_coop_whatever sp** - The 'sp**' part forces single player. mode

Or: rename the map from mp_coop_mapname to sp_mapname.

** Entity Creation:

give weapon_portalgun or --Creates the wood_crate model with physics. Doesn't have to be in quotes, and doesn't have to be precached. Also doesn't count as precaching.
prop_dynamic_create path/model.mdl --Creates a non physics object, the game will let you know which to use.

//Some predefined ones
ent_create_paint_bomb_erase
ent_create_paint_bomb_jump
ent_create_paint_bomb_portal
ent_create_paint_bomb_speed
ent_create_portal_compantion_cube
ent_create_portal_reflector_cube
ent_create_portal_weighted_antique
ent_create_portal_weighted_cube
ent_create_portal_weighted_sphere

//By entity class.

npc_create npc_portal_turret_floor --Creates a functional turret (ent_create npc_portal_turret_floor also works)
ent_create prop_monster_box --Creates a monster box

//Uhm..

fire_rocket_projectile --Fires a rocket. From you!
fire_energy_ball --Our old friend from Portal 1 , without textures but still deadly.

//Other

create_flashlight --Creates a static flashlight light pointing at whatever you were.

**Useful ent_fires.

These are generic fires which can be used on almost all point entities.
As stated at the top, class specific IO can be found in all manner of places.

--In these examples, "!picker" is a shortcut to the entity you're currently pointing at.
--Wherever used, it can be replaced with:
-- The class name --e.g. all objects of type prop_physics
-- The object name -e.g. if your cube is called "benny" you can kill benny by name
-- A partial class match --e.g. prop_ will target all prop_physics, prop_dynamic, etc
-- A partial name match --e.g. wheel_
will target objects named "wheel_1", "wheel_2" etc.
--
--
--Other shortcut entities:
-- !player --Current player
-- red --Coop orange bot
-- blue --Coop blue bot
-- !picker --Whatever the player is aiming at
-- !self --When an object is creating an IO event, !self will always point to itsself
-- !activator --The object that caused the event. E.g. if a cube hits a trigger, !activator will be that cube.
-- !caller --The last entity to fire an IO event. E.g. the one making the call.

ent_fire <name> <function> <parameters> --Included for the sake of completeness.
ent_fire !picker addoutput "targetname <name>" --Sets the objects' name to <name>

ent_fire !picker addoutput "origin 0 0 0" ** - Moves the !picker to 0 0 0
ent_fire !picker addoutput "angles 0 0 0" ** -Changes Pitch Yaw and Roll of !picker

ent_teleport <objectname> --Moves the object to wherever you're pointing
ent_teleport !player --Moves the player to wherever you point.
ent_teleport 1 --Teleports player one to wherever you point. ("ent_teleport blue" also).
ent_teleport 2 --Teleports player two to wherever you point. ("ent_teleport red" also).

ent_fire !picker disablemotion -Disables\enables all physical movement.
ent_fire !picker enablemotion -Useful for holding a cube while playing with lasers, etc.

ent_fire !picker setparent <anotherobjectname> --Object becomes attached to parent. All physics disabled.
ent_fire !picker clearparent --Clears parent object, physics return to normal.

ent_fire !picker skin <0,1,2,3,etc> --Changes to second, third, fourth skin (where available).
ent_fire !picker ignite --Fire!
ent_fire !picker dissolve --Dissolves the object (where possible)
ent_fire !picker kill --Kills (removes) object
or ent_fire prop* kill --removes all prop_physics , prop_dynamic, etc.
or ent_fire wheel* kill -- removes all entities whose names start with wheel.

ent_fire !Picker addoutput "OnPhysGunPickup !self,addoutput,targetname carryCube" -rename the object to carryCube when lifted
ent_fire !picker addoutput "OnPhysGunDrop !self,addoutput,targetname cube,2" -rename the object back to cube 2 seconds after dropping
//Find other event names using the dump commands or in hammer's entity help. Or by reading the FGD files.

ent_fire !picker addoutput "spawnflags 255" --allows many things to be lifted, but can mess with other flags. Use sparingly.
ent_fire !picker addoutput "rendercolor 255 0 0" -makes the !picker red ( R,G,B 0-255)

ent_cancelpendingfires --Cancel all pending IO (i.e. anything with a delay that hasn't fired yet)
ent_pause --Disables all IO on the object.

ent_fire <entity name> setplayerspeed <speed> //Alter the speed of faith plates that use speed:
ent_fire <entity name> setphysics speed <speed>

//Many fires have an alternate console command, such as:

ent_remove <classname> --Same as ent_fire <classname\name> kill
ent_setname <name> --Same as ent_fire !picker addoutput "targetname <name>"
ent_rotate <x> --Rotates (yaws) the object <x> degrees.
ent_remove <class/name> --Same as ent_fire <class/name> kill
ent_setpos 0 0 0 --Same as ent_fire !picker addoutput "origin 0 0 0"
ent_setparent...
ent_clearparent...

** Scripting

ent_fire !picker runscriptfile bubble.nut --Reloads and runs the script file "bubble.nut" in the scripts/vscripts directory on the target object. Doesn't need quotes.
ent_fire !picker runscriptcode "gnome()" --Runs a function called gnome on the !picker's current script. Needs quotes. Can't pass strings in, unless from a script by escaping with "a \"b\" c".
ent_scriptdump --Dumps variables and stats related to scripts on !picker.

exec fudge.txt - Loads and runs a plaintext file in the cfg folder. File extentions work.

// Write a list of console commands in the file, then run it, and the game will process them one after the other.
// Can be set up with a key bind, letting you use quotations. For example:
ent_fire !Picker addoutput "OnPhysGunPickup !self,addoutput,targetname carryCube"
// Cannot be used in a bind, as it would have to place quotes inside quotes.
bind "z" "ent_fire !Picker addoutput "OnPhysGunPickup !self,addoutput,targetname carryCube""
//The game hates that, and using quotes in hammer IO will break the VMF. Instead, place
ent_fire !Picker addoutput "OnPhysGunPickup !self,addoutput,targetname carryCube"
//into say ..\portal 2\portal2\cfg\thunderbunnies.cfg then do:
bind "z" "exec thunderbunnies.cfg"
//Hit z to run your thunderbunnies. Not technically scripting, but it's handy automation!

** Puzzlemaker commands:

//Only useful one I've found:
puzzlemaker_export <mapname> -- Exports PTI map to VMF at <steam>\steamapps\common\portal 2\sdk_content\maps\

** Debug\View Options

thirdperson --Sets the camera into thirdperson
firstperson --Puts it back
thirdpersonshoulder --Above chell's right shoulder

//Showing extra bits & pieces
r_drawclipbrushes 1 --Draw player clip brushes as wireframes over BSP.
r_drawworld 0 --Turns off BSP elements, showing only entities
mat_wireframe 1 --Wireframe display over BSP.
vcollide_wireframe 1 - Draws vPhysics collision mesh for all models. (Excluding func_physbox)
showtriggers_toggle Trigger volumes are drawn as boxes with the applied texture.
//Nore: showtriggers <0-1> Appears not to work, use the toggle instead.

//Hiding bits & pieces
r_drawviewmodel 0 --Turns off chell's hands\gun etc
impulse 200 --Holsters the weapon - or in the case of Portal 2, hides the portal gun. (Still works)
r_drawvgui 0 --Turns off the vGUI including console use a bindtoggle to re-enable
cl_fov 120 --Sets the field of view to 120 degrees (default 90)
cl_drawHUD 0 --Turns off the HUD (safer than the above, good for screenies)
crosshair 0 --Turns off the crosshairs (with or without portalgun).

** Recording demos and exporting using the game:

// Recording demos creates a much smaller file than any video would.
// Instead of dumping frames, it loads the map and plays back everything
// as you played it, by moving all of the entities and such as it happened
// when you played. Thus, it runs as fast as you playing. Anyone playing
// the demo needs a copy of the map, and if there's custom content, that
// too (either as loose files or packed into the .BSP with pakrat).
// On the plus side- no lag while recording, and you can change
// settings\resolution before dumping it to video. By changing the
// timescale and so forth, you can get super clean slow motion replays,
// or sweeping camera shots of your map.

//GUI Windows.
demoui - The standard demo playback window you get by hitting Shift+F2.
demoui2 - An additional time slider. Note: Using this causes the map to be reloaded.

_record fudge --Records your demo, saves it to fudge.dem in the ..\portal 2\portal2 folder
stop --stops recording

playdemo fudge --Plays the demo back.
stopdemo --Stops the demo

host_timescale 0.5 --The game runs at half speed, this applies to demo playback, as does any other visual effects you've altered, including debug overlays and so forth.

//Converting
host_framerate 30 //limit framerate
startmovie myfudgemovie //This tells the engine we're about to start recording a demo called fudge. It won't start yet though.
playdemo fudge //loads up the demo you recorded, and as it plays, dumps the frames to myfudgemovie<x>.tga images and myfudgemovie.wav file in your ..\portal 2\portal2 folder.
endmovie --stops the recording

//Dilema:
// There is limited support for recording straight to avi by typing:
startmovie fudge avi //avi at the end with no "."
// This however is limited to 2gb filesizes and appears to be completely
// broken in portal 2. On the other hand, recording to tga and .wav uses
// about 3.7mb per frame at 1440 res.
// So if space is an issue, record your demo, then fraps that any lag
// caused by fraps can't interfere with your playing. (The demo adjusts for differences).
// ...plus there's no need to record failed attempts.
// More info here: https://developer.valvesoftware.com/wik ... ding_Tools

** Launch options

/// To launch the game in a window, with no startup video:
//Create a shortcut to the following:
"C:\program files\steam\steamapps\common\portal 2\portal2.exe" -window -novid

//Or set your launch options for portal 2 in steam to:
-window -novid

(-windowed and -novideo work also)

-dev --Same as using the 'developer' command.
+map mapname --Launch this map automatically upon load. Like double clicking a .bsp file in explorer.

If you'd like to explore a little more, there are a few things you can play with
-- Run "help <commandname>" to display command help (if any).
-- Check the info\dumping functions below.
-- Read the .FGD files in the portal 2\bin\ directory. They should list most (but not all) entity inputs and outputs. (Open with notepad)
-- Check out the Help button in hammer's entity properties window. That basically reads the FGDs.
-- http://developer.valve.com --Tons of information
-- Or just start typing one of the commands and check the autocomplete for similar commands.
-- Ask someone.

Thanks
Cheers to Skotty, HMW, BEARD!, ChickenMobile, RubishUsername and MasterLagger! for some nice additions!

Advertisement
Registered users don't see ads! Register now!
Avatar
ChickenMobile
2,460 Posts
Posted Jun 04, 2012
Replied 13 minutes later
Verry useful. Am bookmarking.
Avatar
Paradoxic R3mix
87 Posts
Posted Jun 04, 2012
Replied 1 hour later
Nice job Sicklebrick! I've been looking forever for a list as detailed as this one. Like Chickenmobile, i'm totally bookmarking.
Avatar
Jade2k8
25 Posts
Posted Jun 04, 2012
Replied 4 hours later
Nice! I was looking for something more handy than Valve's command list
Avatar
josepezdj
2,386 Posts
Posted Jun 04, 2012
Replied 24 minutes later
Amazing complilation mate! Thanks a ton!

Sticked!

Avatar
Lpfreaky90
2,842 Posts
Posted Jun 04, 2012
Replied 5 minutes later
awesome!

wait a minute... ... could you cheat "pinging" in singleplayer by using !pointer?
Time to test

Avatar
ChickenMobile
2,460 Posts
Posted Jun 04, 2012
Replied 1 minutes later

lpfreaky90 wrote:
awesome!

wait a minute... ... could you cheat "pinging" in singleplayer by using !pointer?
Time to test

You mean !picker? It only works on entities though.

Avatar
Lpfreaky90
2,842 Posts
Posted Jun 04, 2012
Replied 1 minute later

chickenmobile wrote:
lpfreaky90 wrote:

awesome!

wait a minute... ... could you cheat "pinging" in singleplayer by using !pointer?
Time to test

You mean !picker? It only works on entities though.

Yes and bummer

Avatar
sicklebrick
876 Posts
Posted Jun 04, 2012
Replied 7 hours later
Glad it's useful

lpfreaky90 wrote:
chickenmobile wrote:

lpfreaky90 wrote:

awesome!

wait a minute... ... could you cheat "pinging" in singleplayer by using !pointer?
Time to test

You mean !picker? It only works on entities though.

Yes and bummer

+mouse_menu_playtest should fire a variation on the pinger tool in SP, but it only seems to work in beta. I tried fiddling with something along the lines of global_set can_use_ping_tool_blue 1 and stuff, but it doesn't seem to work. Would be nice to have the ping tool for some fun in SP though

Avatar
Vordwann
767 Posts
Posted Jun 04, 2012
Replied 51 minutes later
What console command controls depth of view blurring?
Avatar
sicklebrick
876 Posts
Posted Jun 04, 2012
Replied 9 minutes later

Vordwann wrote:
What console command controls depth of view blurring?

] find dof
"mat_dof_enabled" = "1" client                                                  
"mat_dof_far_blur_depth" = "1000.0" client                                      
"mat_dof_far_blur_radius" = "5.0" client                                        
"mat_dof_far_focus_depth" = "250.0" client                                      
"mat_dof_max_blur_radius" = "10"                                                
"mat_dof_near_blur_depth" = "20.0" client                                       
"mat_dof_near_blur_radius" = "10.0" client                                      
"mat_dof_near_focus_depth" = "100.0" client                                     
"mat_dof_override" = "0" client                                                 
"mat_dof_quality" = "0" 

mat_dof_quality" = "0"                                                         
] find depth
...
"mat_debugdepth" = "0"                                                          
"mat_debugdepthmode" = "0"                                                      
"mat_debugdepthval" = "128.0f"                                                  
"mat_debugdepthvalmax" = "256.0f"                                               
"mat_depth_blur_focal_distance_override" = "-1.0"                               
"mat_depth_blur_strength_override" = "-1.0"   
...


That any use? I have my graphics set to fairly basic, so I've never noticed the DOF blur

Avatar
HMW
806 Posts
Posted Jun 04, 2012
Replied 2 hours later
Very useful! bookmarking!

I have a few suggestions:

vcollide_wireframe 1: shows collision meshes for all vphysics-enabled models
showtriggers_toggle: makes triggers visible

r_simpleworldmodel_drawforrecursionlevel_fullscreen -1: removes drawing distance restrictions on (world) portals for all video settings. (Best served by trigger_auto->OnMapSpawn with "remove on fire" disabled.)

Avatar
Brainstone
401 Posts
Posted Jun 04, 2012
Replied 41 minutes later
I am missing the console command that let's you see the visleaves. Forgot its name though.
Avatar
BEARD!
169 Posts
Posted Jun 04, 2012
Replied 15 minutes later

Brainstone wrote:
I am missing the console command that let's you see the visleaves. Forgot its name though.

mat_leafvis? [Wouldn't it be easier to load the portal file in Hammer?]

Avatar
sicklebrick
876 Posts
Posted Jun 04, 2012
Replied 16 minutes later

@Brainstone:
BEARD! (awesome name ) beat me to it, but I've included that command anyway with the various options. (mat_leafvis 1, mat_leafvis 3). Never knew about that one till you asked

https://developer.valvesoftware.com/wiki/Visleaf

@HMW:
All three of those look super handy! vcollide_wireframe especially when looking for map 'sploits

Adding those now!

Avatar
BEARD!
169 Posts
Posted Jun 04, 2012
Replied 45 minutes later
A thought just occurred to me: did you include the command to show faith plate (trigger_catapult) trajectoies? I can never remember that one myself! EDIT: A quick google suggests that it's ent_bbox trigger_catapult
Avatar
RubbishyUsername
167 Posts
Posted Jun 05, 2012
Replied 19 hours later
Well mappers always want to take fancy screenshots of their levels, right? So surely crosshair 0 and r_drawviewmodel 0 are musts?
Avatar
portal2tenacious
393 Posts
Posted Jun 05, 2012
Replied 30 minutes later
Kill?
Avatar
CamBen
973 Posts
Posted Jun 05, 2012
Replied 2 hours later

portal2tenacious wrote:
Kill?

kill.

anyway, I want to teleport my buddy in coop into a goo pit . already got it planned:

ent_teleport red, and point it at the ceiling over goo.

Advertisement
Registered users don't see ads! Register now!
Avatar
sicklebrick
876 Posts
Posted Jun 05, 2012
Replied 55 minutes later
@BEARD!
Cheers, that looks really handy too ^^

@RubbishyUsername
Cheers, already had r_drawviewmodel, but with the wrong value.
Didn't know the crosshairs one though

@portal2tenacious & CamBen
Kill & Ent_Teleport are pretty well covered, but I'll add a wee bit extra. Ty.