Targetname (GoldSrc): Difference between revisions
Jump to navigation
Jump to search
Confirm:Using hash/pound signs in the targetname may make it unable to be targeted by multi_manager.
(Created page with "{{TabsBar|main=Targetname}} {{stub}} == Player Events == Any entity with the following targetnames will by fired/used (what's the correct terminology in goldsrc ?{{confirm}}) when that event occurs. * <code>game_playerdie</code> - Fires every time a {{ent|player}} dies. The player who died is the '''<code>!activator</code>'''. * <code>game_playerkill</code> - Fires every time a {{ent|player}} kills another player, the killer is the '''<code>!activator</code>'''. * <code...") |
SirYodaJedi (talk | contribs) mNo edit summary |
||
(11 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{TabsBar|main=Targetname}} | {{TabsBar|main=Targetname}} | ||
{{stub}} | {{stub}} | ||
{{This is a|keyvalue|name=targetname|engine=GoldSrc}} A '''targetname''' (also known simply as '''Name''') is the name of an entity. A targetname is not required for an entity to exist, but generally must be present for an entity to be [[target]]ed (or [[killtarget]]ed) by another entity. | |||
To avoid issues, targetnames should not have any special characters, only ASCII letters, numbers, hyphens, and underscores. | |||
{{confirm|Using hash/pound signs in the targetname may make it unable to be targeted by {{ent|multi_manager}}.}} | |||
Naming certain entities, such as [[func_door (GoldSrc)|doors]] and [[light (GoldSrc)|lights]], can alter their behavior. | |||
== Player Events == | == Player Events == | ||
Any entity with the following targetnames will | Any entity with the following targetnames will be targeted when that event occurs. | ||
* <code>game_playerdie</code> - Fires every time a {{ent|player}} dies. The player who died is the | * <code>game_playerdie</code> - Fires every time a {{ent|player|engine=goldsrc}} dies. The player who died is the activator. | ||
* <code>game_playerkill</code> - Fires every time a {{ent|player}} kills another player, the killer is the | * <code>game_playerkill</code> - Fires every time a {{ent|player|engine=goldsrc}} kills another player, the killer is the activator. | ||
* <code>game_playerjoin</code> - Fires every time a {{ent|player}} joins the game, the joining player is the | * <code>game_playerjoin</code> - Fires every time a {{ent|player|engine=goldsrc}} joins the game in multiplayer, the joining player is the activator. | ||
* <code>game_playerspawn</code> - Fires every time a {{ent|player}} spawns, with the spawning player as the | * <code>game_playerspawn</code> - Fires every time a {{ent|player|engine=goldsrc}} spawns, with the spawning player as the activator. | ||
* <code>game_playerleave</code> - Fires every time a {{ent|player}} leaves the game. | * <code>game_playerleave</code> - Fires every time a {{ent|player|engine=goldsrc}} leaves the game, the player that is leaving is the activator. | ||
=== Example === | |||
The following {{ent|game_player_equip|engine=goldsrc}} will give crossbow ammo to a player every time they kill another player. | |||
<pre> | |||
{ | |||
"targetname" "game_playerkill" | |||
"ammo_crossbow" "1" | |||
"origin" "1 1 1" | |||
"classname" "game_player_equip" | |||
} | |||
</pre> |
Latest revision as of 09:19, 21 April 2025
targetname
is a keyvalue available in all GoldSrc games. A targetname (also known simply as Name) is the name of an entity. A targetname is not required for an entity to exist, but generally must be present for an entity to be targeted (or killtargeted) by another entity.
To avoid issues, targetnames should not have any special characters, only ASCII letters, numbers, hyphens, and underscores.

Naming certain entities, such as doors and lights, can alter their behavior.
Player Events
Any entity with the following targetnames will be targeted when that event occurs.
game_playerdie
- Fires every time a player dies. The player who died is the activator.game_playerkill
- Fires every time a player kills another player, the killer is the activator.game_playerjoin
- Fires every time a player joins the game in multiplayer, the joining player is the activator.game_playerspawn
- Fires every time a player spawns, with the spawning player as the activator.game_playerleave
- Fires every time a player leaves the game, the player that is leaving is the activator.
Example
The following game_player_equip will give crossbow ammo to a player every time they kill another player.
{ "targetname" "game_playerkill" "ammo_crossbow" "1" "origin" "1 1 1" "classname" "game_player_equip" }