Func instance: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(added icon, added gmod (checked in hammer editor of gmod))
(Remove description header and update information about older branches)
Line 1: Line 1:
{{point ent|func_instance|internal=1|since=Left 4 Dead 2}}  
{{point ent|func_instance|internal=1}} It inserts an [[instance]] of another VMF file into the current one. You can translate and rotate the instance without breaking anything or creating an off-grid editing nightmare. By default, instances are drawn in Hammer with an orange tint, though this can be disabled in <code>Instancing > View Instances</code>.
{{note|  This entity is now also available in {{game link|Team Fortress 2}} and {{game link|Garry's Mod}}. }}


==Entity description==
{{warning|Self recursive instances (i.e. instances which include themselves) will crash Hammer.}}
It inserts an [[instance]] of another VMF file into the current one. You can translate and rotate the instance without breaking anything or creating an off-grid editing nightmare. By default, instances are drawn in Hammer with an orange tint.


{{warning|Self recursive instances (i.e. instances which includes themselves) will crash Hammer.}}
{{note|Instances are disabled by default in pre-[[Left 4 Dead 2]] games (except Team Fortress 2). To enable them, add a <code>GameData</code> key to [[gameinfo.txt]], pointing to the game's FGD file.}}
{{note|VBSP will only transform entities in the [[FGD]] file it loads from the <code>GameData</code> key. If any custom entities are being misplaced, this is the most likely cause.}}


{{note|VBSP will only transform entities in the [[FGD]] it loads from [[gameinfo.txt]]'s <code>GameData</code> key. If your custom entities are being misplaced, this is the most likely cause.}}
{{tip|Instances can be used with pre-L4D2 games by collapsing them before each compile.}}
{{tip| [[gameinfo.txt]] has an InstancePath parameter that defines where instances are stored. If you try to reference files that aren't in this folder, you will have to manually type in the filename of your instance's .vmf (file path is relative to the parent .vmf)}}
{{tip| [[gameinfo.txt]] has an InstancePath parameter that defines where instances are stored. If you try to reference files that aren't in this folder, you will have to manually type in the filename of your instance's .vmf (file path is relative to the parent .vmf)}}


{{bug|{{as}} Nested instances with relative file names don't work correctly in Alien Swarm, because they are handled differently in Hammer and VBSP. (verify? may be because of incorrectly set up gameinfo.txt)}}
{{bug|{{as}} Nested instances with relative file names don't work correctly in Alien Swarm, because they are handled differently in Hammer and VBSP. (verify? may be because of incorrectly set up gameinfo.txt)}}
{{bug| [[light_spot]] does not appear to adjust its pitch value when it is part of a rotated instance.}}
{{bug| [[light_spot]] does not properly adjust its pitch value when it is part of a rotated instance. A target entity should be used instead.}}
{{bug|{{as}} The func_instance does not work correctly in the Source 2009 Engine Branch. It is recommended you use a [[Prefab]] instead.}}
{{bug|{{as}} The func_instance does not work correctly in the Source 2009 Engine Branch. It is recommended you use a [[Prefab]] instead.}}
{{bug| [[func_viscluster]] does not function when placed inside of an instance.}}
{{bug| [[func_viscluster]] does not function when placed inside of an instance.}}

Revision as of 13:22, 11 April 2020

Template:Point ent It inserts an instance of another VMF file into the current one. You can translate and rotate the instance without breaking anything or creating an off-grid editing nightmare. By default, instances are drawn in Hammer with an orange tint, though this can be disabled in Instancing > View Instances.

Warning.pngWarning:Self recursive instances (i.e. instances which include themselves) will crash Hammer.
Note.pngNote:Instances are disabled by default in pre-Left 4 Dead 2 games (except Team Fortress 2). To enable them, add a GameData key to gameinfo.txt, pointing to the game's FGD file.
Note.pngNote:VBSP will only transform entities in the FGD file it loads from the GameData key. If any custom entities are being misplaced, this is the most likely cause.
Tip.pngTip: gameinfo.txt has an InstancePath parameter that defines where instances are stored. If you try to reference files that aren't in this folder, you will have to manually type in the filename of your instance's .vmf (file path is relative to the parent .vmf)
Icon-Bug.pngBug:Alien Swarm Nested instances with relative file names don't work correctly in Alien Swarm, because they are handled differently in Hammer and VBSP. (verify? may be because of incorrectly set up gameinfo.txt)  [todo tested in ?]
Icon-Bug.pngBug: light_spot does not properly adjust its pitch value when it is part of a rotated instance. A target entity should be used instead.  [todo tested in ?]
Icon-Bug.pngBug:Alien Swarm The func_instance does not work correctly in the Source 2009 Engine Branch. It is recommended you use a Prefab instead.  [todo tested in ?]
Icon-Bug.pngBug: func_viscluster does not function when placed inside of an instance.  [todo tested in ?]
Icon-Bug.pngBug:VBSP will crash with no error if an instance pushes it over the brush limit (i.e. a situation where hiding all instances would keep the map under the brush limit). Compiling with -verbose will reveal the specific instance causing VBSP to fail.  [todo tested in ?]

Input through an instance

  1. Define a Fix Up Name.
  2. Define a value for the input or output you want to use (if there is one).
  3. Send an input to the targetname "fixupname-value", e.g. MyInstance-Start. Hammer's UI won't recognise the name, but don't worry.

KeyValues

VMF Filename <string>
The VMF file to insert as an instance.
Fix Up Name <string>
Essentially the name of the instance. All entities within it will have this string added to them based upon the fix up style. If no name is provided, InstanceAutoX or AutoInstanceX will be used, where X is a number that is incremented with each instance.
Note.pngNote:Entity names that start with the @ symbol e.g. @exit_door will not be changed by the instance name fix up.
Todo: only confirmed for Portal 2
Entity Name Fix Up <choices>
How to apply the fix up name.
  • Prefix (Default)
  • Postfix
  • None
Replace <string $variable> <string value>
This is a replacement parameter. Any usage of $variable inside the instance will be replaced with value.
Example: $color 255 0 0
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.

See also