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

Ent fire: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (→‎Usage: Fixed bug/warning not being part of the bullet points, missing closing tag)
(*should be impossible)
 
(24 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{lang|ent_fire|title=<code>ent_fire</code>}}
{{LanguageBar}}
{{This is a|console command|name=ent_fire}}
It is a debugging tool to fire [[Inputs and Outputs|inputs]] on entities. It's an essential tool for both programmers and mapmakers, allowing them to easily debug problems in a map's entity logic.


The<code>ent_fire</code>console command is a debugging tool that fires inputs on entities. It's an essential tool for both programmers and mapmakers, allowing them to easily debug problems in a map's entity logic.
Different entities can handle different inputs. Entities will ignore inputs that they don't know how to handle. To find out what inputs an entity handles it is most reliable to type {{code|[[ent_info]] <classname>}} in the console, which gives you a list of all the inputs (and outputs) known to the entity it found matching the <tt><classname></tt>.
{{warning|In multiplayer, client can't use ent_fire, only the server or listenserverhost can use ent_fire}}
{{note|in {{tf2}} and potentially other games, ent_fire will not work if executed from server console. use the {{code|script EntFire(...)}} command instead.  <br>
{{example|{{code|script EntFire("player", "SetHealth", "1", 5.0)}}}}}}


Different entities can handle different inputs. The easiest way to find out what inputs an entity handles is to use <code>ent_fire's</code> built in autocomplete. Type <code>ent_fire <targetname></code> in the console, and the autocomplete system will give you a list of all the inputs known to the entity it found matching the <targetname>. If that doesn't work, the other easy way is to load up Hammer and place an entity of the same type, and look at the help for that entity. Entities will ignore inputs that they don't know how to handle.
==Usage==
{{pre|ent_fire <classname_or_targetname_or_wildcard> <input_name> <optional_parameter> <optional_delay>}}
This would fire the specified input on all entities with a matching classname or targetname. The input will contain the overriden parameter if it was specified. The input will be fired immediately, unless the delay was specified, in which case it is sent after that number of seconds. If no input is specified, Use input will be fired.
{{tip|The game will auto-complete both existing targetnames or inputs when typing {{code|ent_fire}} or {{code|ent_fire <targetname>}} followed by a space in the console, respectively.}}
{{wildcardnote|ent_fire zapperpod*_train kill|kill|entity|zapperpod}}
{{bug|hidetested=1|The delay parameter only accepts whole numbers. Anything past a decimal point will be ignored.
{{workaround|In [[VScript]] supported titles use {{code|script EntFire}} as mentioned above.  For older titles, use [[AddOutput]] to add OnUser1-4 outputs setting the delays there (potentially max refires to 1 so it clears itself afterwards) and then fire FireUser1-4. Example:
<pre>ent_fire headcrab AddOutput "OnUser1 !self:Unburrow::0:1"
ent_fire headcrab AddOutput "OnUser1 !self:SetHealth:0:0.1:1"
ent_fire headcrab FireUser1
</pre>}}
}}


==Usage==
=== Examples ===
* <code>ent_fire <classname or targetname> <input name> <optional parameter> <optional delay></code>
{{code|ent_fire relay_start_assault Trigger}}
** This would fire the specified input on all entities with a matching classname or targetname. The input will be contain the overriden parameter if it was specified. The input will be fired immediately, unless the delay was specified, in which case that amount of time will be passed before it is sent.
:This would find all entities with classnames or targetnames of <tt>relay_start_assault</tt>, and call their <tt>Trigger</tt> input. Assuming that <tt>relay_start_assault</tt> is a [[logic_relay]], this would cause it to trigger and fire all its outputs. Very useful for debugging a part of a large chunk of entity logic in a map.
*:{{bug|The delay parameter only accepts whole numbers. Anything past a decimal point will be ignored.}}
{{code|ent_fire bob_the_soldier SetHealth 5}}
** Examples:
:This would find all entities with classnames or targetnames of <tt>bob_the_soldier</tt>, and call their <tt>SetHealth</tt> input, with a parameter of <tt>5</tt>. Basically, the NPC named <tt>bob_the_soldier</tt> would have his health set to 5.
***<code>ent_fire relay_start_assault Trigger</code>
{{code|ent_fire [[!picker]] Kill}}
***:This would find all entities with classnames or targetnames of "relay_start_assault", and call their "Trigger" input. Assuming that "relay_start_assault" is a [[logic_relay]], this would cause it to trigger and fire all its outputs. Very useful for debugging a part of a large chunk of entity logic in a map.
:This would find the entity currently under the crosshair, and call the <tt>Kill</tt> input. The <tt>!picker</tt> targetname is a [[Targetname|special targetname]] that finds the entity under the crosshair. The <tt>Kill</tt> input is known to all entities, and basically tells the entity to immediately remove itself. An alternative to this is the {{code|[[impulse]] 203}} command.
***<code>ent_fire bob_the_soldier SetHealth 5</code>
:{{warning|Using the <tt>kill</tt> input on <tt>!player</tt>, player entities or [[worldspawn]], will crash the game.}}
***:This would find all entities with classnames or targetnames of "bob_the_soldier", and call their "SetHealth" input, with a parameter of "5". Basically, the NPC named "bob_the_soldier" would have his health set to 5.
{{code|ent_fire counter_combat_* Add 1}}
***<code>ent_fire !picker Kill</code>
:This would find all entities with classname or targetname matching the [[Targetname|wildcard]] <tt>counter_combat_*</tt>, and fire their <tt>Add</tt> input with a parameter of <tt>1</tt>. Assuming all the entities found are [[math_counter|math_counters]], this will add 1 to their current counter values. Other entities that don't have an input named <tt>Add</tt> will ignore this action.
***:This would find the entity currently under the crosshair, and call the "Kill" input. The "!picker" targetname is a [[Targetname|special targetname]] that finds the entity under the crosshair. The "Kill" input is known to all entities, and basically tells the entity to immediately remove itself. An alternative to this is the <code>impulse 203</code> command.
{{code|ent_fire npc_barney Ignite}}
***:{{warning|NEVER use the <code>kill</code> input on <code>!player</code>&mdash; the player or worldspawn entities, this will crash the game!}}
:This would find all entities with a matching classname or targetname and ignite them.
***<code>ent_fire counter_combat_* Add 1</code>
{{code|ent_fire [[player]] Ignite}}
***:This would find all entities with classname or targetname matching the [[Targetname|wildcard]] "counter_combat_*", and fire their "Add" input with a parameter of "1". Assuming all the entities found are [[math_counter|math_counters]], this will add 1 to their current counter values.
:In a multiplayer game with cheats on, lights all players on fire.
***<code>ent_fire npc_barney Ignite</code>
{{code|ent_fire player IgniteLifeTime 5}}
***:This would find all entities with a matching classname or targetname and ignite them.
:In a multiplayer game with cheats on, lights all players on fire for a time, in seconds. This will light all players on fire for 5 seconds.
***<code>ent_fire player Ignite</code>
{{code|ent_fire player AddOutput "modelindex <integer>"}}
***:In a multiplayer game with cheats on, lights all players on fire.
: In a multiplayer game with cheats on, will change all players' player models to a precached model.
***<code>ent_fire player IgniteLifeTime 5 </code>
:{{warning|Using modelindex that is invalid in the map's model precache will crash all connected players.}}
***:In a multiplayer game with cheats on, lights all players on fire for a time, in seconds. This will light all players on fire for 5 seconds.
{{code|ent_fire player setmodelscale 10}}
***<code>ent_fire player ModelIndex <integer></code>
: Increase player size, making them look like a giant.
***: In a multiplayer game with cheats on, will change all players' player models to a precached model.
{{code|ent_fire player setmodelscale 0.2}}
***:{{warning|NEVER use the ModelIndex input to change a player to a model that is invalid in the map's model precache. This will crash all connected players.}}
: Decrease player size, making them look tiny.
{{code|ent_fire box addoutput "targetname crate"}}
: Change entity's target name from 'box' to 'crate'.


==See also==
==See also==

Latest revision as of 13:37, 12 May 2025

English (en)Русский (ru)中文 (zh)Translate (Translate)

ent_fire is a console command available in all Source Source games. It is a debugging tool to fire inputs on entities. It's an essential tool for both programmers and mapmakers, allowing them to easily debug problems in a map's entity logic.

Different entities can handle different inputs. Entities will ignore inputs that they don't know how to handle. To find out what inputs an entity handles it is most reliable to type ent_info <classname> in the console, which gives you a list of all the inputs (and outputs) known to the entity it found matching the <classname>.

Warning.pngWarning:In multiplayer, client can't use ent_fire, only the server or listenserverhost can use ent_fire
Note.pngNote:in Team Fortress 2 and potentially other games, ent_fire will not work if executed from server console. use the script EntFire(...) command instead.
PlacementTip.pngExample:script EntFire("player", "SetHealth", "1", 5.0)

Usage

ent_fire <classname_or_targetname_or_wildcard> <input_name> <optional_parameter> <optional_delay>

This would fire the specified input on all entities with a matching classname or targetname. The input will contain the overriden parameter if it was specified. The input will be fired immediately, unless the delay was specified, in which case it is sent after that number of seconds. If no input is specified, Use input will be fired.

Tip.pngTip:The game will auto-complete both existing targetnames or inputs when typing ent_fire or ent_fire <targetname> followed by a space in the console, respectively.
Note.pngNote:The targetname/classname parameter supports wildcard but anything after the wildcard is ignored. For example, ent_fire zapperpod*_train kill will kill any entity whose targetname/classname starts with zapperpod no matter what text follows after wildcard.
Icon-Bug.pngBug:The delay parameter only accepts whole numbers. Anything past a decimal point will be ignored.
PlacementTip.pngWorkaround:In VScript supported titles use script EntFire as mentioned above. For older titles, use AddOutput to add OnUser1-4 outputs setting the delays there (potentially max refires to 1 so it clears itself afterwards) and then fire FireUser1-4. Example:
ent_fire headcrab AddOutput "OnUser1 !self:Unburrow::0:1"
ent_fire headcrab AddOutput "OnUser1 !self:SetHealth:0:0.1:1"
ent_fire headcrab FireUser1

Examples

ent_fire relay_start_assault Trigger

This would find all entities with classnames or targetnames of relay_start_assault, and call their Trigger input. Assuming that relay_start_assault is a logic_relay, this would cause it to trigger and fire all its outputs. Very useful for debugging a part of a large chunk of entity logic in a map.

ent_fire bob_the_soldier SetHealth 5

This would find all entities with classnames or targetnames of bob_the_soldier, and call their SetHealth input, with a parameter of 5. Basically, the NPC named bob_the_soldier would have his health set to 5.

ent_fire !picker Kill

This would find the entity currently under the crosshair, and call the Kill input. The !picker targetname is a special targetname that finds the entity under the crosshair. The Kill input is known to all entities, and basically tells the entity to immediately remove itself. An alternative to this is the impulse 203 command.
Warning.pngWarning:Using the kill input on !player, player entities or worldspawn, will crash the game.

ent_fire counter_combat_* Add 1

This would find all entities with classname or targetname matching the wildcard counter_combat_*, and fire their Add input with a parameter of 1. Assuming all the entities found are math_counters, this will add 1 to their current counter values. Other entities that don't have an input named Add will ignore this action.

ent_fire npc_barney Ignite

This would find all entities with a matching classname or targetname and ignite them.

ent_fire player Ignite

In a multiplayer game with cheats on, lights all players on fire.

ent_fire player IgniteLifeTime 5

In a multiplayer game with cheats on, lights all players on fire for a time, in seconds. This will light all players on fire for 5 seconds.

ent_fire player AddOutput "modelindex <integer>"

In a multiplayer game with cheats on, will change all players' player models to a precached model.
Warning.pngWarning:Using modelindex that is invalid in the map's model precache will crash all connected players.

ent_fire player setmodelscale 10

Increase player size, making them look like a giant.

ent_fire player setmodelscale 0.2

Decrease player size, making them look tiny.

ent_fire box addoutput "targetname crate"

Change entity's target name from 'box' to 'crate'.

See also