ent_fire

From Valve Developer Community
Jump to: navigation, search


The ent_fire 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. The easiest way to find out what inputs an entity handles is to use ent_fire's built in autocomplete. Type ent_fire <targetname> 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

  • ent_fire <classname or targetname> <input name> <optional parameter> <optional delay>
    • 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.
    • 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:NEVER use the kill input on !player— 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 in, 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