Creating Looped Automatic Portals: Difference between revisions
LemonLeezard (talk | contribs) mNo edit summary |
LemonLeezard (talk | contribs) (Added images to the page.) |
||
Line 10: | Line 10: | ||
==Construction== | ==Construction== | ||
===Step 1: Portal Frame=== | ===Step 1: Portal Frame=== | ||
[[Image:File:AutoPortals Step1.JPG|thumb|right|300px|The layout of the auto portal frames.]] | |||
To start, select the [[Image: Hammer_entity.png | 30px]] entity tool, and create a [[prop_static]] for each portal you intend to have in your map. Set the model to <code>models/props/autoportal_frame/autoportal_frame.mdl</code> for each one. | To start, select the [[Image: Hammer_entity.png | 30px]] entity tool, and create a [[prop_static]] for each portal you intend to have in your map. Set the model to <code>models/props/autoportal_frame/autoportal_frame.mdl</code> for each one. | ||
Line 18: | Line 18: | ||
===Step 2: Creating the Portals=== | ===Step 2: Creating the Portals=== | ||
[[Image:File:AutoPortals Step2.JPG|thumb|right|300px|Example of how the [[prop_portal]] should be positioned.]] | |||
Next, create a [[prop_portal]] for each of your portals, one for your '''red portal''', and then any additional ones for your '''blue portals'''. For the sake of this tutorial, we will be creating 3 blue portals. | Next, create a [[prop_portal]] for each of your portals, one for your '''red portal''', and then any additional ones for your '''blue portals'''. For the sake of this tutorial, we will be creating 3 blue portals. | ||
These <code>prop_portal</code>s need to be positioned in the center of each portal frame, similar to the screenshot provided. They will also need to be rotated to be facing outward from the wall. | These <code>prop_portal</code>s need to be positioned in the center of each portal frame, similar to the screenshot provided. They will also need to be rotated to be facing outward from the wall. | ||
{{note| Rotating the <code>prop_portal</code> will make the portal look like it is in the same position in the Hammer Editor, you will have to rely on which direction the origin (yellow line in 2D view) is facing}} | {{note| Rotating the <code>prop_portal</code> will make the portal look like it is in the same position in the Hammer Editor, you will have to rely on which direction the origin (yellow line in 2D view) is facing.}} | ||
Name your red portal “<code>portal_red01</code>”, and name the three blue portals “<code>portal_blue01</code>”, “<code>portal_blue02</code>”, and “<code>portal_blue03</code>”. | Name your red portal “<code>portal_red01</code>”, and name the three blue portals “<code>portal_blue01</code>”, “<code>portal_blue02</code>”, and “<code>portal_blue03</code>”. | ||
Line 48: | Line 48: | ||
===Step 3: Creating the Logic Relays=== | ===Step 3: Creating the Logic Relays=== | ||
[[Image:File:AutoPortals Step3.JPG|thumb|right|300px|Diagram of how the [[logic_relays]] will work.]] | |||
In order to make our sequential auto portals work, we will be employing the use of several logic and math entities. The one we will begin with is [[logic_relay]]. | In order to make our sequential auto portals work, we will be employing the use of several logic and math entities. The one we will begin with is [[logic_relay]]. | ||
Line 87: | Line 87: | ||
===Step 4: Create the Logic_Case Entity=== | ===Step 4: Create the Logic_Case Entity=== | ||
[[Image:File:AutoPortals Step4.JPG|thumb|right|300px|The logic entities to be used.]] | |||
Now that we have our relays set up, we can move onto adding the remaining logic entities we’ll need to make this work. The entities in question are: | Now that we have our relays set up, we can move onto adding the remaining logic entities we’ll need to make this work. The entities in question are: | ||
Line 123: | Line 123: | ||
===Step 5: Create the Logic_Timer Entity=== | ===Step 5: Create the Logic_Timer Entity=== | ||
Next, we will make the ''logic_timer'' entity. Place one in your map, and give it the following parameters: | Next, we will make the ''logic_timer'' entity. Place one in your map, and give it the following parameters: | ||
Line 146: | Line 145: | ||
===Step 6: Create the Math_Counter Entity=== | ===Step 6: Create the Math_Counter Entity=== | ||
Finally, we add a ''math_counter'' entity, which will allow our setup cycle through the portals every time it has a value added to it (via the logic_timer). | Finally, we add a ''math_counter'' entity, which will allow our setup cycle through the portals every time it has a value added to it (via the logic_timer). | ||
Line 187: | Line 185: | ||
===Trigger the Auto-Portal Sequence=== | ===Trigger the Auto-Portal Sequence=== | ||
[[Image:File:AutoPortals Step7.JPG|thumb|right|300px|The [[trigger_once]] that is used to activate the red portal and logic_timer.]] | |||
Create a brush textured with <code>tools/toolstrigger</code>, and press {{key | Ctrl | T}} to turn it into a brush entity. Change this entity into a [[trigger_once]], and give it the following I/Os: | Create a brush textured with <code>tools/toolstrigger</code>, and press {{key | Ctrl | T}} to turn it into a brush entity. Change this entity into a [[trigger_once]], and give it the following I/Os: | ||
{| {{OutputsTable}} | {| {{OutputsTable}} | ||
| [[Image:Io11.png]] || | | [[Image:Io11.png]] || OnStartTouch || portal_red01 || SetActivatedState || 1 || 0.00 || No | ||
|- | |- | ||
| [[Image:Io11.png]] || | | [[Image:Io11.png]] || OnStartTouch || portals_timer || Enable || || 0.00 || No | ||
|} | |} | ||
Revision as of 18:15, 31 August 2021
Skill Level
This tutorial expects you to have this amount of knowledge within the topic to follow along smoothly. | |||||
---|---|---|---|---|---|
Novice | Familiar | Competent | Proficient | Expert |
This tutorial will show step-by-step instructions on how to create linked portals similar to the ones seen in Test Chamber 01, in which the blue portals are seen switching on and off in a specific order. Following along with this tutorial will require some knowledge of how to use logic and math entities.
Construction
Step 1: Portal Frame
To start, select the entity tool, and create a prop_static for each portal you intend to have in your map. Set the model to
models/props/autoportal_frame/autoportal_frame.mdl
for each one.
The models should be placed and arranged at the locations the portals themselves will be.
Step 2: Creating the Portals
Next, create a prop_portal for each of your portals, one for your red portal, and then any additional ones for your blue portals. For the sake of this tutorial, we will be creating 3 blue portals.
These prop_portal
s need to be positioned in the center of each portal frame, similar to the screenshot provided. They will also need to be rotated to be facing outward from the wall.

prop_portal
will make the portal look like it is in the same position in the Hammer Editor, you will have to rely on which direction the origin (yellow line in 2D view) is facing.Name your red portal “portal_red01
”, and name the three blue portals “portal_blue01
”, “portal_blue02
”, and “portal_blue03
”.
For the red portal, change its properties to the following settings:
Property Name | Value |
---|---|
Start Activated | Inactive |
Portal Number | 2 |
For the blue portals, change their properties to the following settings:
Property Name | Value |
---|---|
Start Activated | Inactive |
Portal Number | 1 |
Step 3: Creating the Logic Relays
In order to make our sequential auto portals work, we will be employing the use of several logic and math entities. The one we will begin with is logic_relay.
To start, we are going to want to create four logic_relay
entities for our blue portals:
- 2 relays for the first blue portal. The first relay will be used to initialize the portal opening/closing sequence, while the second relay will open the first portal after the last portal has fizzled.
- 1 relay for each of the remaining portals in the sequence.
For first portal’s initial relay, name it “relay_blue01_int
”, and give it the following I/O:
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
OnTrigger | portal_blue01 | SetActivatedState | 1 | 0.00 | No |
For the remaining relays, you will want to add an additional I/O to fizzle the previous blue portal as well. Name these relays “relay_blue02
”, “relay_blue03
”, and “relay_blue04
” respectively.
The I/Os for these should look like this:
relay_blue02
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
OnTrigger | portal_blue02 | SetActivatedState | 0.00 | No | |
![]() |
OnTrigger | portal_blue01 | Fizzle | 0.00 | No |
relay_blue03
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
OnTrigger | portal_blue03 | SetActivatedState | 0.00 | No | |
![]() |
OnTrigger | portal_blue02 | Fizzle | 0.00 | No |
relay_blue04
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
OnTrigger | portal_blue01 | SetActivatedState | 0.00 | No | |
![]() |
OnTrigger | portal_blue03 | Fizzle | 0.00 | No |
Step 4: Create the Logic_Case Entity
Now that we have our relays set up, we can move onto adding the remaining logic entities we’ll need to make this work. The entities in question are:
The first one we’ll create is the logic_case. This entity will be responsible for triggering the relays on each portal. Create the logic_case entity, and give it the following parameters:
Property Name | Value |
---|---|
Name | portals_case |
Case 01 | 1 |
Case 02 | 2 |
Case 03 | 3 |
Case 04 | 4 |
Next, you will need to give it the following I/Os:
Step 5: Create the Logic_Timer Entity
Next, we will make the logic_timer entity. Place one in your map, and give it the following parameters:
Property Name | Value |
---|---|
Name | portals_timer |
Start Disabled | Yes |
Use Random Time | No |
Refire Interval | 5 |
Then, give it the following I/O:
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
OnTimer | portals_counter | Add | 1 | 0.00 | No |
Step 6: Create the Math_Counter Entity
Finally, we add a math_counter entity, which will allow our setup cycle through the portals every time it has a value added to it (via the logic_timer).
Place one in your map, and give it the following parameters:
Property Name | Value |
---|---|
Name | portals_counter |
Start Disabled | No |
Initial Value | 0 |
Minimum Legal Value | 0 |
Maximum Legal Value | 5 |
The reason we set the maximum value to five is to allow a looping point in the portal opening/closing sequence.
- A value of 1 triggers the initial relay for the first blue portal.
- A value of 2 triggers the relay for the second blue portal.
- A value of 3 triggers the relay for the third blue portal.
- A value of 4 trigger the second relay for the first blue portal.
- Finally, value of 5 triggers a self-reset of the counter, with the rest value being set to 2.
To sum up, you will want to set the “Maximum Legal Value” to how many relays you have set up, +1 to act as a looping point. This sequence will be kept running thanks to our logic_timer entity.
Add the following I/Os to the math_counter entity:
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
OnHitMax | !self | SetValue | 2 | 0.00 | No |
![]() |
OutValue | portals_case | InValue | 0.00 | No |
Implementation
Assuming that you have your auto-portals in their places (and have their entities set up), you can now make a trigger the player will walk into to start the sequence.
Trigger the Auto-Portal Sequence
Create a brush textured with tools/toolstrigger
, and press Ctrl + T to turn it into a brush entity. Change this entity into a trigger_once, and give it the following I/Os:
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
![]() |
OnStartTouch | portal_red01 | SetActivatedState | 1 | 0.00 | No |
![]() |
OnStartTouch | portals_timer | Enable | 0.00 | No |
When the player walks into the trigger’s volume, it will activate the red portal first, then after 5 seconds, the blue portals will open and close in a looped sequence.