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
mNo edit summary
(Removed triple indenting. Finding existing inputs works even better with ent_info <classname>. Made examples stand out more.)
Line 1: Line 1:
{{lang|ent_fire}}{{this is a|c1|name=ent_fire}}
{{lang|ent_fire}}
{{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>.


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.
{{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.}}
{{bug|The delay parameter only accepts whole numbers. Anything past a decimal point will be ignored.}}


==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 "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.
*:{{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 "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 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 "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}} command.
***<code>ent_fire bob_the_soldier SetHealth 5</code>
:{{warning|NEVER use the <code>kill</code> input on <code>!player</code> &ndash; the player entities or worldspawn, this 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]] "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.
***: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 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|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.}}
***: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 ModelIndex <integer></code>
***: In a multiplayer game with cheats on, will change all players' player models to a precached model.
***:{{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.}}


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

Revision as of 14:22, 16 February 2024

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>.

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.

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.
Icon-Bug.pngBug:The delay parameter only accepts whole numbers. Anything past a decimal point will be ignored.  [todo tested in ?]

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:NEVER use the kill input on !player – the player entities or worldspawn, this 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.

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 ModelIndex <integer>

In a multiplayer game with cheats on, will change all players' player models to a precached model.
Warning.pngWarning: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.

See also