Func instance: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
 Warning:Recursive instances (instances which include themselves) will crash Hammer.
Warning:Recursive instances (instances which include themselves) will crash Hammer. Confirm:How about the compile tools?
 Confirm:How about the compile tools? 
 Note:Instances are disabled by default in pre-Left 4 Dead 2 games (except Team Fortress 2). To enable them, add a
Note:Instances are disabled by default in pre-Left 4 Dead 2 games (except Team Fortress 2). To enable them, add a 
 Note:VBSP will only transform entities in the FGD file it loads from the
Note:VBSP will only transform entities in the FGD file it loads from the 
 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:
Bug:
 Example:
Example:
 Note:Entity names that start with the
Note:Entity names that start with the 
 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 
		
	
| m (→KeyValues:  confirmed) |  (added example usages, mentioned Hammer++ doens't lag and added a preview image of what instances can be used for) | ||
| Line 8: | Line 8: | ||
| }} | }} | ||
| {{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 (although [[QPhysics]] may subtly break, such as making angled surfaces [[surf|non-surfable]]).<br> | {{this is a|e1|name=func_instance}}<br> | ||
| 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 (although [[QPhysics]] may subtly break, such as making angled surfaces [[surf|non-surfable]]).<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. [[Hammer++]] does not suffer from this lag | ||
| '''Example uses:''' | |||
| * An elaborate window setup with breakable glass, window prop, clip brushes, areaportal_window and its window brush, then using it all over a house. | |||
| * A camper trailer which has brushwork and props inside, which then gets placed at weird angles that would make areaportal creating difficult. | |||
| * Vehicles with a random color assignment, sprinkled over the map. | |||
| [[File:Func instance example.jpg|500px|thumb|right|A picture showing a window instance used multiple times on a house.]] | |||
| {{warning|Recursive instances (instances which include themselves) will crash Hammer.{{modernConfirm|How about the compile tools?}} }} | {{warning|Recursive instances (instances which include themselves) will crash Hammer.{{modernConfirm|How about the compile tools?}} }} | ||
Revision as of 08:15, 11 May 2024
| func_instance | |
|---|---|
|  | |
| Type | Internal Point entity | 
| Engine |  Source | 
| Availability | In all games | 
func_instance  is an   e1  available in all  Source games.
 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 (although QPhysics may subtly break, such as making angled surfaces non-surfable).
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. Hammer++ does not suffer from this lag
Example uses:
- An elaborate window setup with breakable glass, window prop, clip brushes, areaportal_window and its window brush, then using it all over a house.
- A camper trailer which has brushwork and props inside, which then gets placed at weird angles that would make areaportal creating difficult.
- Vehicles with a random color assignment, sprinkled over the map.
 Warning:Recursive instances (instances which include themselves) will crash Hammer.
Warning:Recursive instances (instances which include themselves) will crash Hammer. Confirm:How about the compile tools?
 Confirm:How about the compile tools? Note:Instances are disabled by default in pre-Left 4 Dead 2 games (except Team Fortress 2). To enable them, add a
Note: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:VBSP will only transform entities in the FGD file it loads from the
Note: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: 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:
Bug:
- In  Alien Swarm, nested instances with relative file names don't work correctly, because they are handled differently in Hammer and VBSP. [confirm] (Maybe because of incorrectly set up gameinfo.txt) Alien Swarm, nested instances with relative file names don't work correctly, because they are handled differently in Hammer and VBSP. [confirm] (Maybe because of incorrectly set up gameinfo.txt)
- light_spot will behave unpredictably when part of an instance that alters the light's pitch. This is solved by collapsing the instance or using the light's "Entity to point at" keyvalue.
- Will not work correctly in the Source 2009. It is recommended you use a Prefab instead.
- func_viscluster does not function when placed inside of an instance.
- 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
- Define a Fix Up Name.
- Define a value for the input or output you want to use (if there is one).
- 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 (file) <string>
- The VMF file to insert as an instance. Relative to the current map's location.
 Example:
Example:
- 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.vmfandmaps/project/map.vmf) you can use../to jump up a directory, in order to enter a new one. As such:../Instances/instance.vmf
- Fix Up Name (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, InstanceAutoXorAutoInstanceXwill be used, where X is a number that is incremented with each instance.
 Note:Entity names that start with the
Note:Entity names that start with the @ symbol e.g. @exit_door will not be changed by the instance name fix up. - Entity Name Fix Up (fixup_style) <choices>
- How to apply the fix up name.
- 0: Prefix (Default)
- 1: Postfix
- 2: None
 
- Replace (replace01) <instance_variable>
- This is a replacement parameter. Any usage of $variableinside the instance will be replaced withvalue. Replace<string $variable> <string value>. 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 
- 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
- func_instance_parms - Entity to control parameters within instances.
- func_instance_io_proxy - Entity that is used as a proxy for entity I/O within instances.
- func_instance_origin - Helper entity that defines the center point of an instance.
- L4D2 Level Design/VMF Instances - A tutorial on how to use this entity in Left 4 Dead 2.



























