Please or Register to create posts and topics.

Useful console commands for mappers.

Page 1 of 6Next

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 DumpingInformation

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 inputoutput 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 shadowsshadinglightsources.
buildcubemaps --rebuilds the current .bsp's cubemaps and saves to the map, must be in the latest dlcmaps 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 )

-- materialsmodelsshadertestenvball_*
-- materialsmodelsshadertestshieldnoise0_normal.vtf
-- modelsshadertetsenvballs.* --May have to copy and rename envballs.dx80.vtx to envballs.dx90.vtx
-- scriptsweapon_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 -Disablesenables 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 <classnamename> 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 2portal2cfgthunderbunnies.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>steamappscommonportal 2sdk_contentmaps

******** DebugView 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 handsgun 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
// settingsresolution 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 2portal2 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 2portal2 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 filessteamsteamappscommonportal 2portal2.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 infodumping functions below.
-- Read the .FGD files in the portal 2bin 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!

Verry useful. Am bookmarking.

?????????????????????????????TWP Releases | My Workshop

Nice job Sicklebrick! :thumbup: I've been looking forever for a list as detailed as this one. Like Chickenmobile, i'm totally bookmarking.

Code: Select all<msleeper>: i'm a fat male who gets bored at sporting events

Nice! I was looking for something more handy than Valve's command list

Amazing complilation mate! Thanks a ton! :thumbup:

Sticked!

ImageImageImageImageImageuseful tools and stuff here on TWP :thumbup:
[spoiler]ImageImageImageImageImage[/spoiler]

:thumbup: awesome!

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

lpfreaky90 wrote:
:thumbup: awesome!

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

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

?????????????????????????????TWP Releases | My Workshop
chickenmobile wrote:
lpfreaky90 wrote:
:thumbup: awesome!

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

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

Yes and bummer :thumbdown:

Glad it's useful :)

lpfreaky90 wrote:
chickenmobile wrote:
lpfreaky90 wrote:
:thumbup: awesome!

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

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

Yes and bummer :thumbdown:

+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 :)

What console command controls depth of view blurring?

My Maps:
[spoiler][SP] Alternate[/spoiler]
Page 1 of 6Next