Prop portal: Difference between revisions
Jump to navigation
Jump to search
Note:In order for a prop_portal to link up to the player's portal gun, the portal pair ID must be set to 0.
Warning:Removing one through methods such as
Warning:When a portal is active but not linked, activating another portal of the same pair ID and color will cause the portal that was activated first to switch its color. This can be avoided by deactivating the first portal before the second one is activated.
Warning:In Portal 2, bad placement of a prop_portal will cause the location of the portal to revert to the map's origin. The rules are as follows:
Note:This entity ignores conversion gel, and will fail to place even if the material has conversion gel and doesn't accept portal placements.
TheLazyPanda (talk | contribs) m (Placement Rules) |
Mycatismycat (talk | contribs) (add extra detail) |
||
(42 intermediate revisions by 26 users not shown) | |||
Line 1: | Line 1: | ||
{{portal | {{LanguageBar}} | ||
{{CD|CProp_Portal|file1=portal/prop_portal.cpp|base=CBaseAnimating|base2=CPortalSimulatorEventCallbacks}} | |||
{{this is a|model entity|name=prop_portal|series=Portal}} | |||
==Entity description== | ==Entity description== | ||
The entity that represents a portal, exactly like one fired from a {{ent|weapon_portalgun}}. | |||
{{Warning| | {{note|In order for a prop_portal to link up to the player's portal gun, the portal pair ID must be set to 0.}} | ||
{{warning|Removing one through methods such as <code>Kill</code> may crash the game. Instead, use <code>Fizzle</code> or <code>SetActivatedState 0</code> to remove portals. | |||
:{{note|The distinction is that <code>Fizzle</code> plays a sound effect and removes the portal, while <code>SetActivatedState 0</code> silently closes the portal but does not remove it. However, if another portal with the same pair ID and color becomes active, the inactive portal will be removed. | |||
::{{tip|This is useful for silently clearing out fixed portals before activating other fixed portals in the same map.}} | |||
}}}} | |||
{{warning|When a portal is active but not linked, activating another portal of the same pair ID and color will cause the portal that was activated first to switch its color. This can be avoided by deactivating the first portal before the second one is activated.}} | |||
===Placement Rules for Portal 2=== | |||
{{Warning|In [[Portal 2]], bad placement of a prop_portal will cause the location of the portal to revert to the map's origin. The rules are as follows:}} | |||
*Must not start active. | |||
*Must have its pitch, yaw and roll facing the exact same direction of the surface it's placed on. Use the yellow line in the 2D view and the blue line (Z-axis) in the 3D view as guides to help with this. | |||
*Must be 0-8 units from the surface the portal is to be placed on. | |||
*The center of the entity must be at least 57 units away from any adjacent surfaces on the top and bottom, and at least 32 units away from any adjacent surfaces on the sides. | |||
*The surface must be of a material which accepts portal placements unless {{code|sv_portal_placement_never_fail}} is set to 1 (i.e. must not have {{code|%noportal 1}}). | |||
{{note|This entity ignores conversion gel, and will fail to place even if the material has conversion gel and doesn't accept portal placements.}} | |||
==Keyvalues== | ==Keyvalues== | ||
{{KV| | {{KV|Start Activated|boolean|intn=Activated|Is this portal activated at start?{{bug|{{portal2}} This will cause the portal to appear at the world origin. To work around this, use a [[logic_auto]].}}{{bug|{{portal}} This will cause the player to be unable to walk out of this portal from its linked partner, requiring them to jump to pass through.}}}} | ||
{{KV| | {{KV|Portal Number|choices|intn=PortalTwo|Is this portal a blue portal or orange portal?}} | ||
{{KV| | :* 0 : Portal 1 (blue) | ||
:* 1 : Portal 2 (orange) | |||
{{KV|Half-Width of the Portal.|intn=HalfWidth|float|since=P2}} | |||
:Half of this portal's width. Defaults to 32 when left at 0. | |||
{{KV|Half-Height of the Portal.|intn=HalfHeight|float|since=P2}} | |||
:Half of this portal's height. Defaults to 54 when left at 0. | |||
{{KV|Portal pair ID that it belongs to|intn=LinkageGroupID|integer|Portal pair ID. Must be a value between 0 and 255.}} | |||
{{KV Targetname}} | {{KV Targetname}} | ||
{{KV Angles}} | {{KV Angles}} | ||
==Inputs== | ==Inputs== | ||
{{ | {{I|SetName|param=string|Set the [[targetname]] of this portal. According to the FGD, naming portals is fun.}} | ||
{{ | {{I|SetActivatedState|Set this portal to be inactive or active.|param=boolean}} | ||
{{ | {{I|Fizzle|Fizzle and remove.}} | ||
{{ | {{I|NewLocation|Sets this portal's location and angles. This expects 6 floats with space delimiters, the format is 'x y z pitch yaw roll'|param=string}} | ||
{{ | {{I|Resize|Changes the size of the portals. Note that portals only function if they are the same size, and the coloured border remains the same size and proportions.|param=string|since=P2}} | ||
{{I | {{I|SetLinkageGroupID|param=int|since=P2}} | ||
==Outputs== | ==Outputs== | ||
{{ | {{O|OnPlacedSuccessfully|activator={{ent|weapon_portalgun}} that shot the portal|Fired when the portal spawns successfully.}} | ||
{{O|OnEntityTeleportFromMe|Fired when any entity is teleported from this portal to the linked partner.|since=P2}} | |||
{{O|OnPlayerTeleportFromMe|Fired when the player is teleported from this portal to the linked partner.|since=P2}} | |||
{{O|OnEntityTeleportToMe|Fired when any entity is teleported from this linked partner to the portal.|since=P2}} | |||
{{O|OnPlayerTeleportToMe|Fired when the player is teleported from this linked partner to the portal.|since=P2}} | |||
{{O Targetname}} | {{O Targetname}} | ||
==External links== | |||
[http://forums.thinking.withportals.com/downloads.php?view=detail&df_id=468 Example Map VMF] |
Latest revision as of 02:27, 23 July 2025
![]() |
---|
CProp_Portal |
![]() |
prop_portal
is a model entity available in Portal series.
Entity description
The entity that represents a portal, exactly like one fired from a weapon_portalgun.


Kill
may crash the game. Instead, use Fizzle
or SetActivatedState 0
to remove portals.
Note:The distinction is that
Fizzle
plays a sound effect and removes the portal, whileSetActivatedState 0
silently closes the portal but does not remove it. However, if another portal with the same pair ID and color becomes active, the inactive portal will be removed.Tip:This is useful for silently clearing out fixed portals before activating other fixed portals in the same map.

Placement Rules for Portal 2

- Must not start active.
- Must have its pitch, yaw and roll facing the exact same direction of the surface it's placed on. Use the yellow line in the 2D view and the blue line (Z-axis) in the 3D view as guides to help with this.
- Must be 0-8 units from the surface the portal is to be placed on.
- The center of the entity must be at least 57 units away from any adjacent surfaces on the top and bottom, and at least 32 units away from any adjacent surfaces on the sides.
- The surface must be of a material which accepts portal placements unless sv_portal_placement_never_fail is set to 1 (i.e. must not have %noportal 1).

Keyvalues
- Start Activated (Activated) <boolean>
- Is this portal activated at start?
Bug:
This will cause the portal to appear at the world origin. To work around this, use a logic_auto. [todo tested in ?]
Bug:
This will cause the player to be unable to walk out of this portal from its linked partner, requiring them to jump to pass through. [todo tested in ?]
- Portal Number (PortalTwo) <choices>
- Is this portal a blue portal or orange portal?
- 0 : Portal 1 (blue)
- 1 : Portal 2 (orange)
- Half-Width of the Portal. (HalfWidth) <float> (in all games since
)
- Half of this portal's width. Defaults to 32 when left at 0.
- Half-Height of the Portal. (HalfHeight) <float> (in all games since
)
- Half of this portal's height. Defaults to 54 when left at 0.
- Portal pair ID that it belongs to (LinkageGroupID) <integer>
- Portal pair ID. Must be a value between 0 and 255.
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g.
parentname
ortarget
).
Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
- Pitch Yaw Roll (Y Z X) (angles) <QAngle>
- This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.
Inputs
- SetName <string >
- Set the targetname of this portal. According to the FGD, naming portals is fun.
- SetActivatedState <boolean >
- Set this portal to be inactive or active.
- Fizzle
- Fizzle and remove.
- NewLocation <string >
- Sets this portal's location and angles. This expects 6 floats with space delimiters, the format is 'x y z pitch yaw roll'
- Resize <string > (in all games since
)
- Changes the size of the portals. Note that portals only function if they are the same size, and the coloured border remains the same size and proportions.
Outputs
- OnPlacedSuccessfully
- !activator = weapon_portalgun that shot the portal
!caller = this entity
Fired when the portal spawns successfully.
- OnEntityTeleportFromMe (in all games since
)
- Fired when any entity is teleported from this portal to the linked partner.
- OnPlayerTeleportFromMe (in all games since
)
- Fired when the player is teleported from this portal to the linked partner.
- OnEntityTeleportToMe (in all games since
)
- Fired when any entity is teleported from this linked partner to the portal.
- OnPlayerTeleportToMe (in all games since
)
- Fired when the player is teleported from this linked partner to the portal.