After seeing Half-Life 2 being played with the Portal Gun by importing the maps into Portal's map folder, I wanted to do it myself. I got the maps to work properly, but when I use "impulse 101" to get the Portal Gun and HL2 weapons, I'm unable to switch weapons by using the 1, 2, 3, 4, etc. buttons, except for the weapon categories that have the shotgun or grenade/RPG/Bugbait in them. If I want to use weapons like the Portal Gun, Gravity Gun, or the crowbar, I have to use console commands. Is there a way to get weapon switching to work?
1-0 do work in Portal, however, they're not bound to anything, so pressing them does nothing. The commands still exist, though, so they can be bound to the proper keys.
Note that this only works in the original Portal, as Portal 2 lacks the programming for all of Half-Life 2's entities.
First, make sure your developer's console is enabled. Press the key to open it (usually `), and type these commands:
This enables cheats, which we'll need for some of the following commands.
This gives you all the weapons and the suit.
This gives you only the portal gun, if you want to acquire all the other weapons on your own.
The portal gun only fires blue portals after you use
give. This will allow you to fire both portals.
bind 1 "slot1"
Binds the 1 key to
slot1, the command that activates the 1st slot (crowbar, etc.) Continue with
bind 2 "slot2", etc. until you reach 9, although it should only need 1-6 (since the other slots aren't used.)
If you do use
impulse 101, keep in mind you won't be able to pick up the suit, as you already have it.
If you didn't use it, then you should be able to pick it up normally. If for some reason you can't, type:
and you should have it afterwards.
These let you use HL2's special commands in Portal:
bind g "phys_swap"
This allows you to swap from your weapon to the grav-gun, or vice-versa.
bind q "lastinv"
Swap between the weapon you're holding and the last one you held.
bind c "impulse 50"
This allows you to call/deploy your squad.
bind z "+zoom"
Allows you to use the suit's zoom feature.
(These can be set through Portal's settings menu.)
bind F6 "save_quick"
This allows you to save without by pressing F6.
bind F9 "load_quick"
Likewise, quick-loads your last quick-save.
This loads the first level of the game.
(These are if you want to take videos or pictures. If you don't want to, skip over this part.)
bind F5 "jpeg"
A screenshot, usually auto-bound. Just in case you want to take awesome HL2-portalgun pictures.
Records a demo file (Source's videos) called 'foo'.
Stops a demo file that's recording.
Demo UI, to watch demos.