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

Func instance parms: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(19 intermediate revisions by 15 users not shown)
Line 1: Line 1:
{{point ent|func_instance_parms|internal=1}}
{{LanguageBar}}
 
{{this is a|logical entity|internal=1|name=func_instance_parms|sprite=1}} When placed inside an [[instance]], it handles conversion between $parameters and the properties of other entities in the instance.
{{bug|[[Alien Swarm]] and [[Portal 2]] appear to be the only games that have properly implemented func_instance_parms.}}
{{func point ent}}
{{intent}}
{{clr}}
 
== KeyValues ==
==Entity Description==
{{KV|parm1|to=parm10|intn=0|instance_parm|This is a parameter. It goes in the form of <code>$variable type [default value]</code>.}}
Place one copy of this entity inside of an instance. Whenever you add a $parameter for the instance, get the properties of this entity.  It will auto-populate it with the variables and allow you to indicate the variable type.
 
==KeyValues==
{{KV|parm1|to=parm10|instance_parm|This is a parameter. It goes in the form of <code>$variable type [default value]</code>.}}
::'''''$variable''''': The $name can be anything and then used as a KeyValue for an entity within the instance. For example, it can be $beamcolor. In turn, $beamcolor is used as the value for the color property (instead of the standard "255 255 255" value) of a prop_static entity, appropriately a metal crossbeam model.
::'''''$variable''''': The $name can be anything and then used as a KeyValue for an entity within the instance. For example, it can be $beamcolor. In turn, $beamcolor is used as the value for the color property (instead of the standard "255 255 255" value) of a prop_static entity, appropriately a metal crossbeam model.
::'''''type''''': It is a value type that is selected from a list. The value type for $beamcolor is '''color1'''.
::'''''type''''': It is a value type that is selected from a list. The value type for $beamcolor is '''color1'''.
Line 51: Line 47:
*vector
*vector
}}
}}
::'''''[default value]''''': The default value of the value type. In the case of value type '''color1''', the default value is 255 255 255.
::'''''[default value]''''': The default value of the value type. In the case of value type '''color1''', the default value is 255 255 255.
 
{{Note|Parameters seem to not be usable in I/O parameters.}}
{{Todo|Is there a way to work around the I/O parameters restriction?}}
{{warning| If using a targetname variable, Hammer will add the fix-up name to the variable wherever it's used, i.e. myinstance-$variable}}
==Usage==
==Usage==
[[Alien Swarm]] SDK has great examples of the use of func_instance_parms in instances. Some instances containing func_instance_parms are used in mapsrc/ASI-Jac1-LandingBay_01.vmf:  
[[Alien Swarm]] SDK has great examples of the use of func_instance_parms in instances. Some instances containing func_instance_parms are used in mapsrc/ASI-Jac1-LandingBay_01.vmf:  
Line 65: Line 64:
*[[func_instance]]
*[[func_instance]]
*[[func_instance_io_proxy]] - Entity that is used as a proxy for entity I/O 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.


[[Category:Alien Swarm Entities]]
[[Category:Alien Swarm Entities]]
[[Category:Portal 2 Entities]]
[[Category:Portal 2 Entities]]
[[Category:Instances|params]]

Latest revision as of 05:15, 14 May 2025

English (en)Translate (Translate)
Func instance parms.png

func_instance_parms is an internal logical entity available in all Source Source games. When placed inside an instance, it handles conversion between $parameters and the properties of other entities in the instance.

Warning.pngRisk of Confusion:This is a point entity despite the name starting with func_ (which is usually used for brush entities).

KeyValues

parm1 to parm10 <instance_parm>
This is a parameter. It goes in the form of $variable type [default value].
$variable: The $name can be anything and then used as a KeyValue for an entity within the instance. For example, it can be $beamcolor. In turn, $beamcolor is used as the value for the color property (instead of the standard "255 255 255" value) of a prop_static entity, appropriately a metal crossbeam model.
type: It is a value type that is selected from a list. The value type for $beamcolor is color1.
Note.pngNote:It is currently assumed that the type matches the keyvalue that it represents. This will require more testing in order to confirm that.
  • angle
  • angle_negative_pitch
  • axis
  • boolean
  • choices
  • color1
  • color255
  • decal
  • filterclass
  • flags
  • float
  • instance_file
  • instance_parm
  • instance_variable
  • integer
  • material
  • node_dest
  • node_id
  • npcclass
  • origin
  • particlesystem
  • pointentityclass
  • scene
  • script
  • scriptlist
  • side
  • sidelist
  • sound
  • sprite
  • string
  • string_instanced
  • studio
  • target_destination
  • target_name_or_class
  • target_source
  • vecline
  • vector
[default value]: The default value of the value type. In the case of value type color1, the default value is 255 255 255.
Note.pngNote:Parameters seem to not be usable in I/O parameters.
Todo: Is there a way to work around the I/O parameters restriction?
Warning.pngWarning: If using a targetname variable, Hammer will add the fix-up name to the variable wherever it's used, i.e. myinstance-$variable

Usage

Alien Swarm SDK has great examples of the use of func_instance_parms in instances. Some instances containing func_instance_parms are used in mapsrc/ASI-Jac1-LandingBay_01.vmf:

  • mapsrc/instances/railings_80square.vmf
  • mapsrc/instances/landingbay_door_unlocked_01.vmf
  • mapsrc/instances/spawners/floor_spawn_holdout01.vmf

One such case is railings_80square.vmf. It is a complex set of models that are placed repeatedly throughout the map with varying colors. func_instance_parms is added to the actual VMF/map file that contains the prefab (i.e. treated as an instance) and can "pass along" parameters to any func_instance that refers to it. In other words, each func_instance that refers to that VMF/map file containing the model set can have a different color set up.

See also