Scripted Shooting with Func_Tracktrain

While I was looking at some of Valve’s maps in Water Hazard, I came across a rather interesting entity setup that I adapted to my CombinationVille entry.  The basic gist of it?  Parent a Bullseye to a Tracktrain and have a Strider shoot at it in order to take out several panes of glass.

What You Need
This tutorial assumes you have already set up a Strider.
Here is our example setup, showing the bullseye, pathtracks and tracktrain in front of several func_breakable glass windows.

  • At least two path_track entities.  The last path_track’s Next Stop Target should be the first path_track, to create a loop.
    Orientation Type: No change
  • func_tracktrain brush entity.  This should be a small 16x16x16 box, textured with tools/toolsnodraw.  This will be an invisible object that follows the path_tracks.
    Place it next to the first path_track.
    Name: tt
    Disable Shadows: Yes
    Disable Receiving Shadow: Yes
    First Stop Target: The name of the first path_track.
    Max Speed (units / second): 100 is a good starting point.  Adjust this as you see fit.
    Change angles: Never (fixed orientation)
    Distance Between the Wheels: 0
    Height above track: 0
    Flags: Check only the following: No Pitch (X-rot), No User Control, Passable, Fixed Orientation and Is unblockable by player.
  • An npc_bullseye.  This is the target the Strider will fire at.
    Name: be
    Parent: tt
    Flags: Check only the following: Not Solid, Take No Damage, Fall to ground, Fade Corpse
  • An ai_relationship.  We call ApplyRelationship on this when we want the Strider to shoot the target, and RevertRelationship when we don’t.
    Name: air
    Subject: npc_strider
    Target: be
    Disposition: Hate
    Disposition Priority: 100
    Reciprocal: Yes
Based on criteria you decide, you’ll want to start the tracktrain moving by sending it the Input “SetSpeed” with an argument of 1.  When you want the Strider to shoot at it, do these two things:
  • Send the Input “ApplyRelationship” to the ai_relationship.  This will make the Strider hate the bullseye.
  • Optionally, send the Input “SetMinigunTarget” to the Strider with the argument be.  This will make the Strider stop whatever he’s shooting at and begin firing at wherever the bullseye is.
Note, you should be able to adapt this to virtually any enemy, including Hunter-Choppers, to make them do dramatic shooting effects!
You may also want to give your func_breakable windows a Damage Filter so only the intended shooter can deal damage to them.