This article's documentation is for anything that uses the Source engine. Click here for more information.

Func instance: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (→‎KeyValues: clean up, replaced: {{ModernTodo| → {{todo|)
m (Updated old entity format to {{this is a}}. This action was perfomed by a bot.)
Line 1: Line 1:
{{lang|title=func_instance}}
<!-- When this page is updated to {{langsp}} or {{language subpage}} instead of {{lang}}, please move {{this is a}} to the base page, as it is automatically translated. -->{{lang}}
 
{{infotable
{{infotable
|func_instance
|func_instance
Line 9: Line 8:
}}
}}


{{entity|func_instance|type=e1}} 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.<br>
{{this is a|e1|name=func_instance}} 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.<br>
By default, instances are drawn in Hammer with an orange tint, though this can be disabled in <code>Instancing > View Instances</code>.<br>
By default, instances are drawn in Hammer with an orange tint, though this can be disabled in <code>Instancing > View Instances</code>.<br>
Instances allow you to edit the vmf of the instance and have every used instance on your main map be changed as well. But unfortunately many instances will lag hammer quite a lot.
Instances allow you to edit the vmf of the instance and have every used instance on your main map be changed as well. But unfortunately many instances will lag hammer quite a lot.
Line 37: Line 36:
* If map.vmf and the instance.vmf are in the same folder, the filename field would be <code>instance.vmf</code>
* If map.vmf and the instance.vmf are in the same folder, the filename field would be <code>instance.vmf</code>
* If the instance.vmf is in a subfolder of where the map.vmf is, the filename field would be <code>subfoldername/instance.vmf</code>
* If the instance.vmf is in a subfolder of where the map.vmf is, the filename field would be <code>subfoldername/instance.vmf</code>
* If the instance.vmf and your map.vmf are neither in the same folder, nor in a subfolder of eachother, (Like <code>maps/instances/instance.vmf</code> and <code>maps/project/map.vmf</code>) you can use <code>../</code> to "pop" a folder out, in order to enter a new one. As such: <code>../Instances/instance.vmf</code>}}}}
* If the instance.vmf and your map.vmf are neither in the same folder, nor in a subfolder of eachother, (Like <code>maps/instances/instance.vmf</code> and <code>maps/project/map.vmf</code>) you can use <code>../</code> to "pop" a folder out, in order to enter a new one. As such: <code>../Instances/instance.vmf</code>}}
{{KV|Fix Up Name|intn=propagate_fixup|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, <code>InstanceAutoX</code> or <code>AutoInstanceX</code> will be used, where X is a number that is incremented with each instance.
{{KV|Fix Up Name|intn=propagate_fixup|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, <code>InstanceAutoX</code> or <code>AutoInstanceX</code> will be used, where X is a number that is incremented with each instance.
{{note|Entity names that start with the <code>@</code> symbol e.g. '''@exit_door''' will not be changed by the instance name fix up. {{todo|only confirmed for [[Portal 2]]}}}}}}
{{note|Entity names that start with the <code>@</code> symbol e.g. '''@exit_door''' will not be changed by the instance name fix up. {{todo|only confirmed for [[Portal 2]]}}}}
{{KV|Entity Name Fix Up|intn=fixup_style|choices|How to apply the fix up name.}}
{{KV|Entity Name Fix Up|intn=fixup_style|choices|How to apply the fix up name.}}
:*0: Prefix (Default)
:*0: Prefix (Default)
Line 45: Line 44:
:*2: None
:*2: None
{{KV|Replace|intn=replace01|instance_variable| This is a replacement parameter. Any usage of <code>$variable</code> inside the instance will be replaced with <code>value</code>. Replace <code><string $variable> <string value></code>. '''Example''': $color 255 0 0.
{{KV|Replace|intn=replace01|instance_variable| This is a replacement parameter. Any usage of <code>$variable</code> inside the instance will be replaced with <code>value</code>. Replace <code><string $variable> <string value></code>. '''Example''': $color 255 0 0.
{{note|There are 10 ''Replace'' key-value pairs with the keys following ''replace'''''{number}''' for names: '''replace01''', '''replace02''', '''...''', '''replace10''' }}}}
{{note|There are 10 ''Replace'' key-value pairs with the keys following ''replace'''''{number}''' for names: '''replace01''', '''replace02''', '''...''', '''replace10''' }}


{{KV Angles}}
{{KV Angles}}

Revision as of 10:53, 4 January 2024

English (en)Español (es)Русский (ru)中文 (zh)Translate (Translate)
func_instance
Missing entity icon.png
TypeInternal Point entity
EngineSource Source
AvailabilityIn all games
 

func_instance is an e1 available in all Source Source games. 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.
Instances allow you to edit the vmf of the instance and have every used instance on your main map be changed as well. But unfortunately many instances will lag hammer quite a lot.

Warning.pngWarning:Self recursive instances (i.e. instances which include themselves) will crash Hammer.
Confirm:How about the compile tools?
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)

Template:ModernBug Template:ModernBug Template:ModernBug Template:ModernBug Template:ModernBug

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

{{KV|VMF Filename|intn=file|string|The VMF file to insert as an instance. Relative to the current map's location.

PlacementTip.pngExample:
  • If map.vmf and the instance.vmf are in the same folder, the filename field would be instance.vmf
  • If the instance.vmf is in a subfolder of where the map.vmf is, the filename field would be subfoldername/instance.vmf
  • If the instance.vmf and your map.vmf are neither in the same folder, nor in a subfolder of eachother, (Like maps/instances/instance.vmf and maps/project/map.vmf) you can use ../ to "pop" a folder out, in order to enter a new one. As such: ../Instances/instance.vmf

{{KV|Fix Up Name|intn=propagate_fixup|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 (fixup_style) <choices>
How to apply the fix up name.
  • 0: Prefix (Default)
  • 1: Postfix
  • 2: None

{{KV|Replace|intn=replace01|instance_variable| This is a replacement parameter. Any usage of $variable inside the instance will be replaced with value. Replace <string $variable> <string value>. Example: $color 255 0 0.

Note.pngNote:There are 10 Replace key-value pairs with the keys following replace{number} for names: replace01, replace02, ..., replace10


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