targetname
Function
This will set or change the value of an entity's "targetname" key. Applies to all entities (see notes below).
Syntax
|
$<entity_name> targetname "<new_value>"
|
Notes & examples
|
Almost all entities in SiN can be given a targetname key/value pair by which it be refered to in a script. For a reason unknown to me, the only exception to this are pickup-able items such as weapons, ammo, health, etc.
The wierdest part is that they can in fact be given a targetname but only through a script with the use of this command. Here's an example:
Let's say you insert a weapon_assaultrifle entity in the editor and give it the targetname "mygun". The compiled .bsp map will not register that value. Suppose that the entity happens to have the sequence number 40, by dropping the game console and using the "whatis" command, this is what you'll get (partial list):
]whatis 40
Entity # : 40
Class ID : weapon_assaultrifle
Classname : AssaultRifle
Targetname :
Modelname : models/asrifle.def
Animname : idle1
Origin : ( 54.410000, 194.360001, -111.928345 )
Bounds : Mins( -6.41, -2.35, -8.04 ) Maxs( 19.58, 2.36, 6.71 )
etc...
As you can see, the Targetname field is there but it's empty even though you did assign a targetname to the assault rifle entity in the editor. Now you can use the entity's sequence number to refer to it in entity commands. So we can use it here to give the assault rifle a targetname:
*40 targetname "mygun"
Then, if you use the "whatis" console command again after the command was run in the script, you will get the following output (partial list):
]whatis 40
Entity # : 40
Class ID : weapon_assaultrifle
Classname : AssaultRifle
Targetname : mygun
Modelname : models/asrifle.def
Animname : idle1
Origin : ( 54.410000, 194.360001, -111.928345 )
Bounds : Mins( -6.41, -2.35, -8.04 ) Maxs( 19.58, 2.36, 6.71 )
etc...
The targetname value was registered by the weapon_assaultrifle entity and can thereafter be refered to in the following commands which would apply to this entity. I agree this is a very tedious procedure and it requires that your 3D card responds to the sv_showentnums cvar to be able to display the entities' sequence numbers (this procedure is described in detail in the notes of the removeent Master command) but this is the only way to give a pickup-able item a targetname.
|
|