info_snipertarget
This article needs more links to other articles to help integrate it into the encyclopedia. Please help improve this article by adding links that are relevant to the context within the existing text.
January 2024
January 2024
...
info_snipertarget
is a point entity available in all Source games. An npc_sniper
will take shots at this target, but only if told to, using inputs available to that entity. The info_snipertarget
has parameters to alter the behavior while aiming and shooting.
To make the sniper take shots at a moving target, you'll need to parent the info_snipertarget
to that target, but this appears to be bugged.
Confirm:This parenting issue was noted back in 2006 and may not apply anymore.
See d1_town_05
for multiple examples of its use.
Contents
Flags
- [
1
] : Shoot Me
Sniper will shoot at this target once satisfied with aim.
- [
2
] : No Interruptions
All other targets will be ignored while sniper aims for this.
- [
4
] : Snap Shot !FGD
: If a more important target comes into view as the sniper is aiming for this target, the sniper will fire at this target immediately, hoping the current aim was accurate enough to hit it, then focus on the higher-priority target. This shot will still count as interrupted, and the sniper will therefore resume to take another shot if the Resume if Interrupted flag is set for this target. This is considered obsolete from Episode 1 onward,[Why?] but can still be used.
- [
8
] : Resume if Interrupted
If the sniper is busy taking shots at other targets when he is ordered to take a shot at this target, he will just delay the shot at this target until he is done, instead of ignoring it completely. This is unless he is ordered to take another shot in this time.
- [
16
] : Snap to me
The sniper will set his sight on this target before turning the dot on. This means that the dot will immediately start fixed at this position.
Keyvalues
- Sweep to Speed (speed) <float>
- Seconds it takes for the sniper to align their shot onto the target.
- Group Name (groupname) <string>
- The name of a group which the
info_snipertarget
belongs to. Used as a parameter forSweepGroupRandomly
inputs fornpc_sniper
.
Base:
- Parent
(parentname)
<targetname> - Maintain the same initial offset to this entity. An attachment point can also be used if separated by a comma at the end. (
parentname [targetname],[attachment]
)Tip:Entities transition to the next map with their parentsTip:phys_constraint
can be used as a workaround if parenting fails.
- Origin (X Y Z)
(origin)
<coordinates> - The position of this entity's center in the world. Rotating entities typically rotate around their origin.Note:Hammer does not move the entities accordingly only in the editor.
- Pitch Yaw Roll (X Y Z)
(angles)
<angle> - This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.Note:This works on brush entities, although Hammer doesn't show the new angles.
- Classname
(classname)
<string> !FGD - Determines the characteristics of the entity before it spawns. Tip:Changing this on runtime still has use, like making matching an entry in S_PreserveEnts will persist the entity on new rounds!
- Spawnflags
(spawnflags)
<flags> !FGD - Toggles exclusive features of an entity, its specific number is determined by the combination of flags added.
Inputs
Base:
AddContext
<string>- Adds to the entity's list of response contexts. See Context.
AddOutput
<string>- Assigns a new keyvalue/output on this entity. For keyvalues, some rely on extra necessary code to be ran and won't work if its simply just changed through this input. There is a strict format that must be followed:
// Format of changing KeyValues: "AddOutput [key] [value]"
//// Raw text:
"OnUser1" "!self,AddOutput,targetname new_name"
// Format of adding an Output: "AddOutput {targetname}:{inputname}:{parameter}:{delay}:{max times to fire, -1 means infinite}"
//// Raw text:
"OnUser1" "!self,AddOutput,OnUser1:SetParent:!activator:0.0:-1"
// Arguments can be left blank, but the empty blank should still be contained.
//// Raw text:
"OnUser1" "!self,AddOutput,OnUser1:ClearParent::0.0:-1"
|
ClearContext
- Removes all contexts from this entity's list.
ClearParent
- Removes this entity from the the movement hierarchy, leaving it free to move independently.
FireUser1
toFireUser4
- Fires the respective
OnUser
outputs; see User Inputs and Outputs.
Kill
- Removes this entity and any entities parented to it from the world.
KillHierarchy
- Functions the same as
Kill
, although this entity and any entities parented to it are killed on the same frame, being marginally faster thanKill
input.
RemoveContext
<string>- Remove a context from this entity's list. The name should match the key of an existing context.
SetParent
<string>- Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment
<string>- Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
SetParentAttachmentMaintainOffset
<string>- As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
Outputs
Base:
OnUser1
toOnUser4
- These outputs each fire in response to the firing of the like-numbered
FireUser1
toFireUser4
Input; see User Inputs and Outputs.
See also
npc_bullseye
, a similar entity that can be used by other NPCs as well.