Portal 2

Portal 2

49 ratings
Console Commands
By Beckeroo
This guide holds many of Portal 2's console commands. Originally designed for myself, but I may add any commands if you ask for them.
6
2
2
   
Award
Favorite
Favorited
Unfavorite
Getting Started
To open the console:
  1. Open settings.
  2. Open Keyboard/Mouse
  3. Toggle 'Allow Developer Console`
  4. Press `

Most of the commands will require you to put this command in before to work:
sv_cheats 1
General Commands
Spawn list

Companion Cube: ent_create_portal_companion_cube

Cube: ent_create_portal_weighted_cube

Reflector Cube: ent_create_portal_reflector_cube

Old Cube: ent_create_portal_weighted_antique

Edgeless Safety Cube: ent_create_portal_weighted_sphere

Turret: npc_create npc_portal_turret_floor

Turret wife (Fat turret): prop_dynamic_create npcs/turret/turretwife

Frankenturret: ent_create prop_monster_box

Wheatley : ent_create npc_personality_core

UNUSED Wheatley GLaDOS: prop_dynamic_create npcs/glados/glados_wheatley

Wheatley GLaDOS: prop_dynamic_create npcs/glados/glados_wheatley_newbody

Wheatley GLaDOS boss: prop_dynamic_create npcs/glados/glados_wheatley_boss

GLaDOS: prop_dynamic_create npcs/glados/glados_animation

Water: ent_create_paint_bomb_erase

Repulsion Gel: ent_create_paint_bomb_jump

Propulsion Gel: ent_create_paint_bomb_speed

Conversion Gel: ent_create_paint_bomb_portal

Rocket: fire_rocket_projectile

Energy Pellet: fire_energy_ball

Door: give prop_testchamber_door

Laser: ent_create env_portal_laser (Always faces one way, use reflector cube)

Funnel Emitter (Does not include funnel): ent_create prop_tractor_beam

Camera Security Camera: ent_create npc_security_camera

Pedestal Button: ent_create prop_button

Error: ent_create prop_dynamic

User cheats

Kill yourself: kill

Kill your partner: kill <partner name>

Fly and have no collision: Noclip

Portals Can Be Placed Anywhere: sv_portal_placement_never_fail (0=off, 1=on)

change_portalgun_linkage_id <A number> // Changes the set of portals your portal gun shoots. Having 4 or more visible portals produces some cool glitches at the risk of crashing your game.

cl_leveloverview 1/2/3 // Shows a top-down 2d version of the map you are on, following the camera. 1 Is least zoomed out, 3 is most zoomed out.

Close game: quit

Environmental cheats

Rotate objects: ent_rotate (rotates by 1° by default. the amount of numbers you add at the end is how many degrees it rotates.)

Change Portal Size: portals_resizeall (width) (height) // (default is 33 55)

Change Gravity: sv_gravity // Default = 600

Change Game Speed: host_timescale // Default = 1

Change Frankenturret Velocity: sv_monster_turret_velocity // Default = 100

Remove Objects (can crash game if not deleting certain objects): ent_remove

Shake // Shakes your screen.

Enter a certain map: Map <map name> // For when you are in the menu, names of maps here https://wiki.sourceruns.org/wiki/Portal_2_Maps

Change the map you are in: Changelevel <map name> // Names of maps here https://wiki.sourceruns.org/wiki/Portal_2_Maps

mat_wireframe 1 // Shows a wireframe of every model in the map.

mat_leafvis 1 // Shows the visleaf you are standing in with a blue box.

r_drawclipbrushes 1 / 2 // Draws clip brushes. 1 Draws the outline of them, 2 draws them fully solid.

vcollide_wireframe 1 // Draws all model hitboxes.
ent_fire
*DISCLAIMER*
This section of the guide is for people who know how to use the console well. I'm giving this command it's own section because of it's complexity and vast potential.

ent_fire
This command can do a lot. If you have a basic understanding of the I/O system in Hammer, you should be able to master this fairly quickly. ent_fire is merely a crushed down version of Hammer's I/O system. If you know how to use the I/O system, you should be able to just learn how this works by playing with it in the console. But for all of you who don't use Hammer, I made this section for a reason.

What can it do?

ent_fire can send outputs to entities the same way entities can send outputs in Hammer. The format is as simple as:

ent_fire <target entity> <action> <value> <delay>

So, if you had a cube named cube1, and you wanted to change the colour of it to red 5 seconds after firing the command, you would enter:

ent_fire cube1 color "255 0 0" 5

Let me break down this quickly,

ent_fire - The command itself.
cube1 - The name of the target enity.
color - The action.
"255 0 0" - The colour to change it to.*
5 - The delay

* Colour in source uses the regular RGB system. The quote marks are only needed if the target entity or value has spaces in them. They are not needed if the value has no spaces.

The main problem here, is that if you don't have a good idea of the I/O system, it will be hard to geta grasp of this command. I'll come back to this section soon, but if you want to learn more about this powerful command in the meantime, I recommend learning Hammer.
Binds
I'm gonna be talking about binds for a while, so here you go!

Bind a command to a key: bind <key> <command> Example: bind n noclip
Have a space in the bind? Do this: bind <key> "<command>" Example: bind 1 "ent_fire !picker skin 1"

Binding is pressing a button to run the command. So you won't need to use bindtoggle to use showtriggers_toggle because that toggles when you enter it.

Have a bind like sv_cheats 1? Use this command:
bindtoggle <key> <command> Example: bindtoggle u sv_cheats
This will work like the last one with the spaces, though I can't think of any bindtoggle commands with spaces.
Ask To Receive
I'm not really updating this guide unless anybody wants anything specific. There are plenty of guides like this out there, this one is mainly personal reference for me.
61 Comments
<color=cyan>Strata</color> 27 Jul @ 2:02pm 
add how to use the "wait" command
Beckeroo  [author] 10 Jul @ 12:41pm 
@harry.wright.hazza can you please elaborate?
harry.wright.hazza 9 Jul @ 6:49pm 
can we like get a gide on all atlas and pbody cosmedics?:sans:
Beckeroo  [author] 31 Jan @ 2:45pm 
@Awesomee12345

Depends on what you mean by "disappeared".

give_portalgun (run upgrade_portalgun afterwards if you want the dual gun) will work if you don't have the gun at all.

r_drawviewmodel 1 may make it visible if it's only invisible.

if r_drawviewmodel 1 doesn't work, try impulse 200
Awesomee12345 31 Jan @ 2:07pm 
how do i show the portal gun after it disappeared?
Beckeroo  [author] 6 Aug, 2024 @ 6:05pm 
@kinigittjr use 'sv_cheats 1' first.
kinigittjr 6 Aug, 2024 @ 4:58pm 
Noclip not working
Beckeroo  [author] 25 Jul, 2023 @ 8:10am 
Oh, @Guy was taken, P2CE has all Half-Life 2 assets, so NPCs, weapons, etc.
Beckeroo  [author] 13 May, 2023 @ 6:58am 
@Walter pinkwhite Not without mods. In Portal 1, you could create HL2 entities because P1 was just an updated version of HL2. P2 isn't built off of any previous Source games. So any entities from games that aren't P2, won't exist in P2.
76561198414959549 13 May, 2023 @ 6:44am 
Can you create npcs from half life 2 like portal or?