Creating a rotating portalgun
In this tutorial we will be creating a portal gun pedestal which automatically rotates and fires portals in four directions.
Models
You will need two prop_dynamic entities, one for each of the following world models:
models/props/pedestal_base_reference.mdl
. Name itpedestal_bottom_model
and set its "Disable Shadows" keyvalue to Yes. Place it on the ground where you want the pedestal to be, with the small doors just below the ground.models/props/pedestal_center_reference.mdl
. Name itpedestal_top_model
. Place it right abovepedestal_bottom_model
as shown in the image below.
Brushes
Create two brushes, both textured with the tools/nodraw
texture. These will be tied to entities later on.
- 32 x 32, height 4, centered above the pedestal.
- 4 x 32, height 56, placed next to the pedestal.
Entities
Doors
Select the 32x32 brush and tie it to a func_door_rotating
entity with the following properties:
Property Name Value Name pedestal_rotating_door Delay Before Reset -1 Spawn Position Closed Speed 30 Distance 90
Check the Passable
flag.
Tie the second brush to a func_door
set to these properties:
Property Name Value Name pedestal_retracting_door Speed 20 Stop Sound Doors.FullOpen9 Move direction: 90 0 0 Delay Before Reset -1 Lip 1
Check the Passable
flag on this as well.
Portal Gun
Create a weapon_portalgun
and name it pedestal_gun
. Move it exactly on top of pedestal_top_model
. The portalgun should face left when you’re looking at the pedestal from the front (the side with the blue arrow display), like the one shown in the first picture at the top of this page. You may wish to disable the "Can Fire Portal 1" or "Can Fire Portal 2" keyvalues to give the player a single-color portal gun.
Sounds
Create three ambient_generic
entities. Set the following properties on each one:
- Name the first
pedestal_sound_rotate
, set its sound name toPortalgun.pedestal_rotate
and the Source Entity topedestal_top_model
. - Name the second
pedestal_sound_charge
, set its sound name toWeapon_CombineGuard.Special1
and the Source Entity topedestal_gun
. - Name the third
pedestal_sound_open
, set its sound name toButtons.snd22
and the Source Entity topedestal_top_model
.
Entity outputs
Add the following outputs to pedestal_rotating_door
:
To make the pedestal instead fire orange portals, replace ChargePortal1
with ChargePortal2
and FirePortal1
with FirePortal2
.
Add the following output to pedestal_retracting_door
:
Add the following outputs to pedestal_gun
:
Parenting and creating the hole
Now just parent pedestal_gun
to pedestal_top_model
, and that to pedestal_rotating_door
. Since the pedestal retracts into the floor, you will need to make a cylindrical hole on the floor beneath pedestal_bottom_model
, like the one shown in the image to the right.
Fixes involving the rotating portalgun
You will need to have an entity that triggers an Open
input in pedestal_rotating_door
, otherwise it won't do anything.
For example, in my map, I have a trigger entity surrounding the player so that as soon as the player spawns in, the Open input is triggered on pedestal_rotating_door
. You can also use a button, if you so please.
Optional features
Portal frames
You may want to create a portal frame on each wall the portals are going to be fired at. To do this, create a prop_static entity with the model models/props/autoportal_frame/autoportal_frame.mdl
, move it to the wall you wish to place it at, and rotate it until it is parallel to the wall.
Pedestal opening animation
You may also want to make the pedestal open when the player gets near it. To do this, create a 192 x 192, 128 high brush with the tools/toolstrigger
centered on the pedestal. Tie it to a trigger_once entity with the following outputs:
If you do not do this, you may wish to remove pedestal_sound_open
and the output to close the pedestal on pedestal_gun
.
See also
- Portal Level Creation/onlyinclude>