Func instance parms: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Category sort index)
No edit summary
Line 1: Line 1:
{{point ent|func_instance_parms|internal=1}}
[[File:Func instance parms.png|left]]


{{bug|[[Alien Swarm]] and [[Portal 2]] appear to be the only games that have properly implemented func_instance_parms.}}
{{point ent|func_instance_parms|internal=1|since=Left 4 Dead 2}} When placed inside an [[instance]], it handles conversion between $parameters and the properties of other entities in the instance.{{clr}}
{{intent}}


==Entity Description==
== KeyValues ==
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>.}}
{{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.

Revision as of 10:55, 28 June 2011

Func instance parms.png

Template:Point ent When placed inside an instance, it handles conversion between $parameters and the properties of other entities in the instance.

KeyValues

parm1 ([todo internal name (i)]) 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.

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