Func instance: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (categorizing, the lack of sort index is intentional)
(custom entities and instances)
Line 1: Line 1:
{{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.
{{point ent|func_instance|internal=1|since=Left 4 Dead 2}} 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.


By default, instances are drawn with an orange tint.
{{warning|Recursive instances (i.e. instances which includes themselves) will crash Hammer.}}


{{note|Instances will only compile correctly in Left 4 Dead 2 or later. If you would like to use instances in TF2 or HL2 you can work around this by saving your vmf as a clone, and collapsing the instances in that clone vmf.}}
{{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.}}


{{intent}}
{{tip|Instances can be used with pre-L4D2 games by collapsing them before each compile.}}


{{warning|Loading instances recursively (e.g. an instance of itself in the same instance) will crash Hammer!}}
{{bug|{{as}} Nested instances with relative file names don't work correctly in Alien Swarm, because they are handled differently in Hammer and VBSP.}}
 
{{bug|Nested instances with relative file names don't work correctly in Alien Swarm, because they are handled differently in Hammer and VBSP.}}


== Input through an instance ==
== Input through an instance ==

Revision as of 06:18, 4 August 2011

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.

Warning.pngWarning:Recursive instances (i.e. instances which includes themselves) will crash Hammer.
Note.pngNote:VBSP will only transform entities in the FGD it loads from gameinfo.txt's GameData key. If your custom entities are being misplaced, this is the most likely cause.
Tip.pngTip:Instances can be used with pre-L4D2 games by collapsing them before each compile.
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.  [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