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

ent_fire

From Valve Developer Community
Jump to navigation Jump to search
English (en)Русский (ru)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

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

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