Targetname
Jump to navigation
Jump to search
An entity's name. Referred to simply as Name with SmartEdit enabled.
Caveats
- A targetname is not required for an entity to exist, but in almost all cases (see below) must be present for an entity to play a part in the I/O System.
- A targetname must be stored in the map's entity data block, so avoid naming entities that don't need a name (i.e. aren't ever referenced by another entity). The comment field in Hammer is useful for describing entities that don't need targetnames, and doesn't get saved into the .bsp entity data block.
- Targetnames do not need to be unique. As many entities as the mapper wants can share the same name, and they will all respond to the same inputs. Duplicated targetnames are displayed in bold font.
- Targetnames are also useful for categorising entities (area1_name, area2_name, etc.).
- Targetnames cannot contain
!
or*
characters (see below).
Notes
There are several extended features to name searches that are useful in a variety of situations. The most common use is to target an entity with an unknown name that is somehow involved in the current I/O chain. The extended features are:
- Wildcards
- Name searching supports trailing * wildcards only. So searching for area1* will match any targetnames that start with area1 (i.e. area1_portal and area1_door, but not area2_door).
- Keywords
- !player - the player. Only useful in singleplayer.
- !activator - the entity that started the current I/O chain. For example:
- If an NPC walks into an appropriately flagged trigger_multiple, that NPC will be the !activator for the Trigger and OnStartTouch outputs, and any resulting I/O outputs from them.
- If an entity kills another, it will be the !activator for the OnDeath output.
- !caller - the entity that was activated by the activator at the start of the current I/O chain. For example:
- If an NPC walks into an appropriately flagged trigger_multiple, the trigger_multiple will be the !caller for the Trigger and OnStartTouch outputs, and any resulting I/O outputs from them.
- !self - the entity that's doing the searching.
- If an NPC walks into an appropriately flagged trigger_multiple, the trigger_multiple will be the !self for the Trigger and OnStartTouch outputs.
- !pvsplayer - the first player found in the PVS.
- The PVS used is taken from the entity doing the searching, or the activator in no searching entity exists. If no activator exists, it returns the first player in the game (equivalent to !player).
- !picker - the entity that the player is looking at. Only useful in singleplayer, and mostly only for debugging. Note that this only finds entities that are solid (i.e. can be hit by the invisible "bullet" fired to find the entity under the crosshair).