UDK Auto-Turret (Reset Target)

UPDATE: There has been a consistent problem that the turret only causes splash damage while projectiles seemingly pass through the player. Thanks to Mr. Shamalinia this has finally been fixed! The solution is to use an unknown object (marked as “???”) for the Spawn Projectile instigator input, not the instigator output by the player spawn event. Attaching a Dynamic Volume is also no longer necessary. I will be rewriting the tutorials to include these changes soon!


The following tutorial is to be read as augmentation to the core setup for an Auto-Turret in UDK, which is outlined Here. As with the previous tutorial, this tutorial is intended for users moderately familiar with the Unreal Engine and Kismet.

Here is the original turret function

Reset the Turret-Target Location on Respawn
In the situation that the player is killed by the turret, and then respawns, the Dynamic Volume (labeled as “Target” in the tutorial images) will remain attached to the player without relocating to the player’s active spawn point. In this way, when the player approaches the turret again, the turret will still be firing at the target, and not the player.

To fix this, upon player spawn, the target must be reset to the active Player Start. The Set Actor Location action is all that is necessary to accomplish this. Connect the Set Actor Location’s Target variable to the Dynamic Volume labeled “Target”. Find the vector coordinates of the active Player Start (open the Player Start properties, open the Movement category, and open the location section where the vector coordinates can be copied). Then create a vector with corresponding coordinates and connect it to the Location variable of the Set Actor Location action.

Compare to the original turret function

If there are multiple Player Starts, instead of using a Set Variable action to correct the Dynamic Volume’s vector after each checkpoint, an Object Comparison of the Player Starts will allow for a more organized function. To do this, create an unknown Object (Marked as “???”) from the Player Spawned event’s Spawn Point instigator. Then create an object for the Player Start. The Player Spawned event will always output the last used Player Start. Create a Compare Objects condition, connect the unknown Spawn Point instigator to Object A, and connect the Player Start object to B. Now create a Get Location and Rotation action. Connect the A == B output from the Compare Objects condition to the input of the Get Location and Rotation action. Connect the B variable to the Target variable of the Get Location and Rotation action, then connect the Location output to the target reset vector of the Set Actor Location action.

The firing mechanic, which is unchanged, is not shown here

If checkpoints are not a concern, a similar setup may be implemented in which the Compare Objects condition is not necessary. This setup is visible in the image below. This is especially useful in situations where multiple spawn points exist, such as arenas, because the Dynamic Volume will reset accordingly regardless of where the player respawns. However, this method will not work for multiple human players.

10 Responses to “UDK Auto-Turret (Reset Target)”

  1. Hi i have question on u…i want to do: when i shoot something(or when i hit some button), the turret will stop shooting and too i want to set to some turret attack only bots and not me… i saw it in your created UDK level…thanks (PS:please wrote on my email when u can)

    • Warpdie,

      Unless there is an animation in your turret, such as a hatch opening before it can fire, you can simply connect the output of a trigger use or take damage event to the stop of the delay function used to set the rate of fire. You may also want to toggle the event used to activate the turret so that it won’t reactivate.

      If there are moving parts, then simply place a Boolean comparison at the beginning of the delay node. You can comment it as “Active?” if that will help you. Then set the the default Bool to true (assuming the turret is activatable by default). The input of the Bool should be the same as the input of the delay is in the tutorial. The “true” output should start the Delay. The “false” output can lead to an explosion effect, left blank, or whatever you want to use to demonstrate that the turret has lost function. Now, to switch the comparison from true to false, connect your Interpactor Take Damage event (or whatever event stops the turret from functioning) to a Set Variable action, specifically a Set Bool. Connect the object arrow of the Set Bool action to your Boolean comparison’s Bool object, and designate the new Bool to be false.

      To make the turret fire at the bots, simply adjust what the Dynamic Volume object is attached to. If it is attached to a bot (preferably using Actor Factor ex to spawn), then the turret will fire at the bot. Now, since the player’s death can’t be used as a deactivation of the turret any more, you will have to use the Is Dead condition, which I believe has only become available in the latest UDK, to deactivate the turret. If there are multiple bots, I used a comparison of distances from the turret for each bot so that the turret would prioritize the closest. There are a lot of options to play with, and playing with them is the best way to learn.

      I’ve sent my reply to your email, as per request, but I’ve also posted it here so that if there are future questions of a similar subject I can redirect them here. Cheers,

      – Andrew

  2. Well I tried to reset the target’s location, I do everything that you’ve said but still when I respawn the turret is firing on the same place I died!
    Not to mention that even if I move the trigger volume up, the turret still fires at the feet and I have to stay pretty far for it to hit me, otherwise if I get close the projectile just passes trough me… very strange!

    • mclogenog Says:

      Generally (as I’ve said before) this turret makes for a great prototype, and if fairly simple to implement in a level design. If you want a fully functional turret, uScript is the only way to do it. It is nice, however, to test whether a turret is even fun or not in the level before having to touch any script. As for the Target location problem, try going through the steps again, and make sure that your events aren’t one time only. If that doesn’t help, could you email me a more detailed explanation of the problem and your setup to my email (AndrewYoder@live.com)?



  3. thanks for the awesome tuturial, helped me alot making my end of level boss shoot while moving.

  4. Socrates Says:

    I love this so much but is there away that u can make 3 turret fire? i try making 3 turret fire at me but only one will work other just do nothing? any help

  5. Hey there. I have the turret mechanic almost perfect, but none of the projectiles actually hit my player pawn. They simply pass right through him and hit the wall behind him. If I get too close to the wall, the splash damage will hit my pawn, but not the projectile itself. I saw that you addressed the problem in an earlier post from jessealexander, but your solution of adjusting the relative offset didn’t do it for me, unfortunately. Any assistance would be a great help!

    • Hey Dan,

      I’ve been recently informed that the solution is to plug a blank (???) object variable into the Spawn Projectile “instigator” value. I haven’t tried it yet, but I hope that works!

  6. Andrew, Thank you for sharing this tutorial, keep up the good work!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: