Shooters

This tutorial explains how to build rockets or other projectiles that appear out of nowhere and hit always the same target in the map or the player.

For this tutorial you require:

  • 1x brush
  • 1x target_position
  • 1x shooter_grenade
  1. Creating the trigger
    First of all you have to build something that triggers the grenade. You draw a regular brush and texture it with the "common/trigger" shader. Deselect everything and select the trigger in the 3D view. Right mouse button click into one of the axis view windows and select "trigger" and go to "trigger_multiple". Press n to open the entity property dialog.
    - wait - this sets the time the trigger needs to regenerate. "-1" means it can only be triggered once. (always use -1 for timer start triggers).
  2. Creating the shooter
    You have to build an entity that spawns the projectile.
    Deselect everything Esc and right mouse button click into one of the axis view windows. Select "shooter" and go to "shooter_grenade". Move the entity to the position where the grenade should appear.
  3. Create a target
    So the shooter knows in which direction it has to fire you have to build a target. Deselect everything and right click into one of the axis view windows. Select "target" and go to "target_position". Place this entity at the spot where the grenade or any other projectile should hit. Note that this entity only defines the direction of the grenade to be fired. Unlike for jump pads, the distance to the shooter entity has no meaning.
  4. Linking the entities
    The shooter has to know when it should activate. It only get's this information when it's linked to the trigger_multiple. Deselect everything and select FIRST the trigger THEN the shooter_grenade and press Ctrl+k. A colored line (grey in NetRadiant) should appear that links the "trigger_multiple" and the "shooter_grenade" entity. The shooter also has to know where to shoot at. FIRST select the "shooter_grenade" THEN the "target_position". If everything went right another colored line should appear between the "shooter_grenade" and the "target_position".
    Note: You can aim shooters at players automatically by using the "shooter_grenade_targetplayer" instead of a "shooter_grenade" entity. You have to add the "targetplaye" flag in the entity's options, though. The "target_position" should not be created, too.
(Image shooter 2d view) (Image shooter 3d view)

Congratulations you built a shooter that is triggered by walking into the "trigger_multiple". It will shoot in the direction of the target_position or the player every time it's triggered.

This is the map file for the tutorial:

Written by HK