player_keycatcher

XashXT

player_keycatcher

This entity is the logical extension of the functionality of trigger_impulse. Captures player keypresses for activating events in the map.

Options

m_iszKeyToCatch Name of the key to listen for. A single player_keycatcher can listen for only a single (arbitrary) key.
m_iszKeyPressed Target to activate once when the player presses the specified key.
m_iszKeyHoldDown Target to activate at every frame as long as the player holds the specified key.
m_iszKeyReleased Target to activate once when the player releases the specified key.
master Master that blocks the entity. A blocked player_keycatcher does not activate its targets.

Usage Details

  • A map can have no more than 64 instances of the entity.
  • You can have multiple player_keycatcher entities listening for the same key. Their state can be tracked (STATE_ON means the key is pressed, STATE_OFF means it is released).
  • The following table lists the virtual keys:
    attack Primary attack
    jump Jump
    duck Duck/Crouch
    forward Move forward
    back Move backwards
    use Use/Activate
    left Turn left
    right Turn right
    moveleft Move left
    moveright Move right
    attack2 Secondary attack
    run Run
    reload Reload
    alt1 Unassigned key; to bind it, use the following command: bind <key to listen for> +alt1
    score Unassigned key (Xash mod-specific); to bind it, use the following command: bind <key to listen for> +score
  • It doesn't matter where in the map a player_keycatcher is located.
  • In multiplayer, use the entity with caution, because it watches keypresses by all players on the server.
  • The entity does not work if the player is frozen by a trigger_playerfreeze or by the Freeze Player flag in a trigger_camera, because keypresses are bypassed by the engine in these cases, and there is no way to capture them.