Generic Keyvalues, Inputs and Outputs/Inputs
Jump to navigation
Jump to search
Inputs
- AddOutput <string >
- Assigns a new keyvalue/output on this entity. For keyvalues, some rely on extra necessary code to be ran and won't work if its simply just changed through this input.
Format:<key> <value>
Format:<output name> <target>:<input name>:<parameter>:<delay>:<max times to fire, -1 means infinite>
- Kill
- Removes this entity and any entities parented to it from the world.
- FireUser1 to FireUser4 <string >
- Fires the respective
OnUser
outputs; see User Inputs and Outputs. Warning:Can take string parameter and doesn't do anything with it. This can cause an issue if this input is fired from outputs that can send a value. Make sure to specify dummy string in such cases other-wise the output will use its value as parameter causing the input to fail with "bad input/output link" error in console.
- SetDamageFilter <targetname >
- Sets a filter for this entity for when it receives damage.
Parenting
- SetParent <string >
- Move with this entity. See Entity Hierarchy (parenting).
- SetParentAttachment <string >
- Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
- SetParentAttachmentMaintainOffset <string >
- As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
- ClearParent
- Removes this entity from the movement hierarchy, leaving it free to move independently.
- KillHierarchy
- Functions the same as
Kill
, although this entity and any entities parented to it are killed on the same frame, being marginally faster thanKill
input.
VScript
- RunScriptFile <script > (in all games since
) (also in
)
- Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
- RunScriptCode <string > (in all games since
) (also in
)
- Execute a string of VScript source code in the scope of the entity receiving the input. Variables
activator
,caller
,self
are available when the script is run (same applies to RunScriptFile). Warning:Using the quote symbol
"
in any text field of a Hammer Object Properties Dialog will lead to VMF corruption, fixable only by editing the VMF directly with a text editor and removing the added quote symbol.Tip:In
backticks ` are converted to " when the input is processed. If a string is needed in other games then
foreach
can be used likeforeach(k,v in {the_string_I_need=0}) printl(k)
, but that looks confusing and only strings that are also valid identifiers can be created this way so it's preferable to use RunScriptFile or Entity Scripts instead. Mind that using quotes itself within IO events is not an issue, so usingEntFire
or adding outputs via script can be done by escaping the quotes\"
. Hammer does not provide a way to escape them. Example:EntFire("target", "RunScriptCode", "printl(\"I am: \" + self + \" !\")")
.Bug:Trying to use
activator
orcaller
by running this input on an entity that doesn't yet have a script scope will cause error as those variables are only populated when script scope exists. Calling the input second time will have them because the first call did create the script scope. This is fixed inTeam Fortress 2 branch.
- CallScriptFunction <string > (in all games since
) (also in
) !FGD
- Calls a VScript function defined in the scope of the receiving entity.
- TerminateScriptScope (only in
) !FGD
- Destroys the script scope of the receiving entity.
Context
- AddContext <string >
- Adds to the entity's list of response contexts. See Context.
- ClearContext
- Removes all contexts from this entity's list.
Warning:Should not be used outside of debugging purposes if vscript modding is available as one never knows what they might be deleting especially on player entities. There are often vscript mods that store information as contexts for various purposes.
- RemoveContext <string >
- Remove a context from this entity's list. The name should match the key of an existing context.
Rendering
RenderFields:
- Alpha <integer 0–255>
- Sets the entity's transparency to a number from 0 (invisible) to 255 (fully visible). Requires the entity to have its
rendermode
set to a number other than0
.
- Color <color255 >
- Sets an RGB color for the entity.
Shadow:
- DisableShadow
- Turn dynamic shadows off for this entity. Identical to applying EF_NOSHADOW.
- EnableShadow
- Turn dynamic shadows on for this entity.
- DisableReceivingFlashlight (in all games since
)
- This object will not receive light or shadows from projected textures.
- EnableReceivingFlashlight (in all games since
)
- This object may receive light or shadows from projected textures.