UDK Auto-Turret (Core Function)

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! For now, here’s an updated image:


Through this tutorial I will explain how to create a form of projectile firing turret through kismet, and I will explain a variety of ways it may be implemented. If you wish to skip the tutorial—not the advised route—you can visit Hourences and copy my kismet snippet for “A Turret Setup” into your own editor. Also, this tutorial is intended for users moderately familiar with the Unreal Engine and Kismet.

The final product should look similar to this

The first step is to attach a Dynamic Trigger Volume to the player (a Dynamic Physics Volume will work as well). In the screenshot above, the Dynamic Trigger Volume is commented as Target. The Get Location and Rotation node doesn’t work on the player as a target, but it does work on Dynamic Trigger Volumes, which is why attaching a Dynamic Trigger Volume to the player is necessary for the turret to work. First, at an enabled Player Start in your level, add a small Dynamic Trigger Volume centered at the floor; a 64 x 64 x 64 volume will do. The Volume is centered at the floor so that projectiles will not pass ineffectually over the player’s head.

The Volume is centered at the floor with 32 units above and beneath

Now, in Kismet, create a Player Spawned event. From there create an unknown Object variable (Marked as “???”) to connect to the instigator arrow. Create an Attach To Actor action, and connect its input to the output of the Player Spawned event. Connect the instigator to the Attach To Actor target. Now, select the Dynamic Trigger Volume in viewport, and create an object for it in Kismet. Connect the Dynamic Trigger Volume object to the Attachment of the Attach to Actor node. A way to test this setup is to manually attach (as opposed to attaching through kismet) a movable point light to the Dynamic Trigger Volume; if the light doesn’t follow the player, then the Volume isn’t following either.

Although any event can be used to attach a dynamic object to the player, a spawn event is the best. This is because in other events the player’s exact location is not definite, while an action instantly following a player spawn is. In the case of multiple spawn points, comparing the Spawn Point object of a Player Spawned event to the Player Starts on the level will determine where the player is spawned and where the dynamic object should be to accurately attach to the player.

The next step in creating the turret is to create a Get Location and Rotation action, which is under New Actions > Actor. Connect its input to the output of the Attach to Actor node. Note that a secondary event can start the Get Location and Rotation action, instead of causing the turret to fire on the player immediately upon spawning. Connect the Dynamic Trigger Volume object to the target of the Get Location and Rotation node. Create a vector variable and connect it to the location arrow of the Get Location and Rotation node; a vector for rotation is not necessary.

Now, create a Spawn Projectile action, which is under New Actions. Connect its input with the output of the Get Location and Rotation node. Connect the previously created instigator object (marked as “???”) to the instigator on the Spawn Projectile node. Connect the previously created vector from the Get Location and Rotation node to target location on the Spawn Projectile node. Now, create a new vector variable to connect to spawn location on the Spawn Projectile node; this vector determines where the projectile spawns and is fired from. One easy way to determine a vector is to place an object in the editor where you want the projectile to start, and then in the object properties open the movement and location categories, and the vector will be marked. After this vector is copied into Kismet, delete the object used to find the vector location.

To complete the turret, add a Delay node, connect its input to the output of the Get Location and Rotation node, connect its output to the input of the Get Location and Rotation node, and set the delay amount in the properties or through a float value. The amount of delay will determine the rate at which the projectiles fire. All that remains is to choose the projectile type through the properties of the Spawn Projectile node, and adjust the system according to your need.

Potential modifications for this turret setup include reseting the Dynamic Trigger Volume at the active Player Start upon player spawn by using a Set Actor Location node, adding moving components to make the spawn location dynamic, randomizing the target vector through simple mathematics to make the turret less accurate, or creating a Take Damage event on an in game object to allow for destruction of the turret. The turret setup I have demonstrated is simple, but it can be modified heavily.

52 Responses to “UDK Auto-Turret (Core Function)”

  1. Very creative – good work!

  2. Hey,
    I followed the tutorial but nothing will fire. I tried to test the trigger volume and the volume is working. Any ideas how to fix?

    • mclogenog Says:

      Hey Bryan,

      Check that the event causing the turret to fire allows infinite triggers. You can check that the volume attached to the player by manually attaching a movable pointlight, as I explained in the tutorial. Make sure that the projectile type is set. Last, make sure that the player is set as the instigator.

      If none of that helps, paste my snippet from hourences and do a comparison of what you created on what is there. If that doesn’t work, provide me with some more info, and I’ll see what I can do to help.

      – Andrew

      • I’m a little confused, the example on hourences says kismet, but is code. Do I need to create a mutator and put the code in there or is there somewhere else it needs to go?

      • Ignore my last post, worked after I did same thing on different computer. I’m trying to get it so it will support multiple spawns since at the moment after the first spawn it doesn’t hit the player. I’m setting get location and rotation into set actor location after the player spawn, but it still doesn’t hit the player after the first spawn.

      • mclogenog Says:

        The example on Hourences can be directly copied and pasted into kismet.

        As for making the turret usable for multiple spawns, you merely need to add a Set Actor Location action with the attachment as the actor being relocated, and the active player start as the destination.

        With multiple spawn points you can run an object comparison to determine if the checkpoint object (output from the Player Spawned event) is equal to one of the player starts in the environment. Whichever one is equal should have the dynamic volume attached to it.

        Like I said, this tutorial creates the core for a many possible variations. Play around with it and I’m sure you can develop something awesome.

  3. Learath Says:

    İ made this turret it works but it doesnt actually shoot me it spawns the selected projectile in the vector i gave to it and it stays there and boom there so im not getting shooted

  4. Learath Says:

    İ fixed it now but when i die it gots stuck in where i was dead

  5. Learath Says:

    but im not using a player spwan i am using a trigger to attach dynamic trigger volume. And i want to de attach it after somewhere

  6. Learath Says:

    how can i do it
    sorry for second post

    • mclogenog Says:

      Find the vectors for where you want the trigger to re-attach the dynamic volume, and then upon that event use a Set Actor Location action to relocate the dynamic volume at that vector. You don’t need to worry about detaching the dynamic volume, so long as it is repositioned where the player is at.

      • Learath Says:

        i tried it when i reposition it it shoots the new position i want it to stop

      • mclogenog Says:

        To deactivate the turret, you can just set a boolean comparison between the “rate of fire” delay output and the spawn projectile start. Give it an object comment such as “Active?” and then if true, have it fire, and if false, have it do nothing. Then, using a set variable (specifically, set bool) action, this boolean comparison can be deactivated, thus the turret too can be deactivated.

  7. So I did just what you suggested and it works perfectly the first spawn, but after the player dies and respawns the shots are 45 degrees off when looking at the firing point directly but then changes when I turn left and right. I tried putting example from hourences but nearly every module says outdated and didn’t work. Any idea why the turret would shoot at different point when the player turns around?

    • mclogenog Says:

      If the dynamic volume isn’t attached at exactly where the player is at, then when the player turns around, the volume will turn around too. The farther the player is from the volume, the greater difference you will see when the player turns.

      Double check that the volume location reset is functional (try to reset the location of a movable point light, and if that works, then the volume is working too, or if it doesn’t work, then the volume isn’t working). If that test proves inconclusive, make sure that the vectors are all correct for the spawn locations, and that the player and volume will spawn at the same location.

      As for the snippet on Hourences being outdated. I’ll see what I can do. And I’ll see about creating a more advanced tutorial soon as well.

  8. Learath Says:

    😦 i cant use the boolean thingy please help me

    • mclogenog Says:

      I’ll see about writing a more advanced turret tutorial soon, including turret target resets, enabling and disabling the turret, and so on. Hopefully that will help you out.

  9. You’re right, attached a light to it and it doesn’t reset to player spawn. Seems to reset 5 feet to left of spawn.

  10. mclogenog Says:

    I’ve created an augmentation tutorial detailing several means to reset the target location on player spawn. The tutorial is available here: https://mclogenog.wordpress.com/udk-auto-turret-advanced/

  11. jessealexander Says:

    I’ve followed your main and adv tutorial and they seem to work for the most part, one question I have is how do I get the player to collide with the projectiles and take damage? Currently he is only getting hit by “splash” damage off the wall, but projectiles go right through him? Some setting I need to turn on for the player to be a collider?

    • mclogenog Says:

      Jesse, it depends on where it hits the player really. The projectile source aims at the center of the attached volume. You can adjust the attached volume to be higher or lower to adjust where the projectile should be hitting. Often it appears that the projectile is passing through when it’s really passing overhead. In the case of the grenade projectile, you will want it to practically skid upon the floor to its impact point with the player. Collision is active, but it’s not perfect. With shock cores and rockets, the problem shouldn’t be as prominent.

      I hope that helps.

      – Andrew

      • Hello.
        Great info and it works well except I am having this same issue. It’s definately not colliding with the player or a cicada vehicle I’m using. Only projectiles that cause splash damage have any effect. I continue to look for an answer.

      • mclogenog Says:

        I have not tested the turret set up with vehicles, so I am not sure how that would change it. Anyway, as I’ve said before, this turret makes for a great prototype, but at best it remains only a prototype. It is nice to be able to test whether the turret is even fun in the level design before having to touch code (and that is the purpose), but if you want a fully functional turret, uScript is the only way to do it.

      • Marcus Ragonese Says:

        Hey would there be any way to adapt this into a mesh following the player via rotation?

      • Marcus, I’ve wondered about this before. At an abstract level, I would compare the player’s x and y positions to the turret’s and then use some trigonometry to determine the appropriate angles. (I described my thoughts more thoroughly a few years ago here: http://forums.epicgames.com/threads/728072-Tutorial-A-basic-Auto-Turret-through-Kismet?p=27793601&viewfull=1#post27793601 ).

        UDK still doesn’t support trig though, so I’d fake it by placing 8 or so trigger volume wedges around the turret to determine which direction it needs to face. I would then set your rotation matinee so that it doesn’t reset on rewind, and the end position becomes the new start position.

        Of course as I’ve written many times now, this kismet solution should be temporary until you can replace it with proper code. There are many limitations, such as proper rotation.

        I hope that helps!

  12. Hi !

    ok my English isnt the best so i have a problem.what is the instigator and what does it do?

    • mclogenog Says:

      The instigator is the object that instigates, or starts, the action. For example, if the player activates a trigger, the instigator of the trigger will be the player. The instigator is used in determining on whom the following action should occur. Another example, if the player walks into a trigger volume and the result should be the death of the player, connecting the trigger event to the death action in kismet won’t specify who to kill. And if you use a “player” object instead of the “???” connected to the instigator, what if a different player activated the event? It could kill the wrong player.

      Simply put, when the event occurs, the instigator output determines who caused the event. You can then connect the instigator to an action. If the instigator object is left unknown (“???”), then, regardless of whether it was player1 or player21, the action will act correctly upon the player who caused the event.

      I hope I didn’t make that too confusing.

  13. Witdarkstar Says:

    Hey Mclogenog. This tutorial is awesome and helped a lot. I started messing with various projectiles and it seems projectiles don’t actually hit you. Only projectiles with splash damage can. They go right through you. Do you know how to make it so they actually hit you? I’ve been looking for collision stuff, but haven’t found anything so far. Thanks.

    • mclogenog Says:

      Witdarkstar, Jessealexander asked the same question a few posts up. I think the response I gave her should also answer your question.

      – Andrew

      • Witdarkstar Says:

        Oh I missed that thanks. I tried moving the volume around but it still shot at the same spot. It looks like it goes though the chest or through the legs no matter where I put it. I mean I can always use Shock Core or Rockets if needed. Thanks again for the help.

  14. Hey Mclogenog. Have to agree with many of the previous posts – this is a brilliant tutorial – give more! 🙂

    In the meantime (being the novice that I am with Kismet) I’m having trouble with pushing it further. I’m trying to attach the turret to a InterpActor so that when the actor dies the turret stops – but only seem to be successfully driving myself crazy and not the desired effect. I tried your suggestion to Learath – but to no avail either. I’m definetely missing something.

    Not to create work for you – is their any chance you could post a legible screenshot of the Kismet setup from the above video so I could try and reverse engineer your setup? (Great vid btw!)

    Thanks in advance.

    • mclogenog Says:


      The simplest way to terminate the turret’s firing would be to connect an event’s output (in this case, the Interpactor Take Damage event) to the “stop” input of the Delay node. The flaw that can occur though, is if the Delay function has completed and the remaining functions are being processed (firing the projectile, and any matinee components) then once the sequence is completed it will simply return to the designated “start” input of the Delay node. If there are no moving components, then this problem won’t occur.

      That said, the way to avoid this problem is with Boolean Comparison. Simply place one 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. 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.

      As for the legible screenshot of the advanced turret, I’ll consider it. 😉

      – Andrew

      • Thanks heaps Andrew!

        The simpliest version worked perfectly. Felt a bit of a numpty when the solution was so ‘simple’ 🙂

        I did try the preferred method but (for whatever reason) it would fire off both the true & false outcomes and couldn’t figure out why. I’m sure I’m missing something obvious. Somethign to work towards I guess.

        My apoogies, I hope you didn’t take offence at me asking to look at your advanced turret kismet. Sometimes it’s easy to review experience than stumble in the dark. 🙂

        If your interested, I’ll provide a link to the work where your turret setup is used once it’s at a stage to preview.

        Thanks again.

  15. Banzhee, the trouble with uploading the kismet for the entire advanced sequence is that I can’t fit it all on my screen in enough detail at one time. Sure, I could piece it together in photoshop, but it’s better if you play around with it for yourself anyway.

    Also, I’d love to see what you’re able to make from the tutorial, though it would probably be better if you posted it, or a link to it, in the tutorial’s original forum (http://forums.epicgames.com/showthread.php?t=728072&page=2) than here.

    – Andrew

  16. Hi Andrew,

    Thanks for the tutorial. I’m learning UDK at the moment and this was VERY helpful.

    I just thought I would bring my contribution to your work:
    > Go into the kismet of you core version of the turret
    > Set the Player Spawned Max Trigger Count to 0 so the triggers fires off each time the player is spawned.
    > Go into Attach to actor action >>> Check the Use relative Offset box

    This way, the Dynamic trigger volume will be attached to the player relative to the player’s coordinates at that moment. You no longer have to add any other nodes to handle respawning since the player’s coordinates will be used when the trigger is reattached.

    Please note that I haven’t tested this with multiple respawn points but I think it should work also.

    Best regards and thanks again for the tutorial. Drop me a line if you have any other tutorials to share man.


    • mclogenog Says:

      Hey Dan,

      I haven’t played around with relative offset much, but I’ll give that a go. Also, as you can see in the companion tutorial, “UDK Auto-Turret (Reset Target),” I present my method for keeping the dynamic volume attached to the player regardless of spawn count or spawn location. If I find relative offset a satisfactory method, I’ll make sure to add it to that tutorial.

      Sorry for the late reply, university’s been keeping me busy.

      – Andrew

  17. I just downloaded the January UDK.
    Did they completely replace the “Spawn Projectile” with “Projectile factory.” If that is the case, in “Projectile Factory” I don’t see “Target Location” or an “Instigator” input.
    I’m fairly new to Kismet as well, so I may be just missing something.
    I can get it to work with the “Projectile Factory” if I could get the turret to always face the “Instigator” by assigning a socket in the turret as the “Spawn Point.”
    If that is the best solution, does any one know how to make a Skeletal Mesh always face a dynamic target, preferably another Skeletal mesh, Camera or Pawn.

    • mclogenog Says:

      I’ll have to give January UDK a look and, quite possibly, write a new approach to the auto-turret. You may want to check if there are any hidden properties in the Projectile Factory, because it wouldn’t make sense to remove the target (assuming of course that Spawn Projectile is gone in the latest build). As for making a mesh constantly face a moving target, I suggested in the epic thread to use trigonometry to determine what angle the turret needs to face; however, as of last I checked (and as of when I wrote that suggestion) trigonometric functions are unavailable in kismet.

      I’ll see what I can do.


  18. Hi you remember me finally i had a success and now i nearly mastered turrets i made a turret like yours and thx for this tutorial its really nice. Turrets are really useful in maps and thank you for giving us details about it but only thing i cant do is using non-splash(unexplosive) weapons can you help us about it

  19. Trip, you can have an AI face a dynamic trigger by using a “Start firing at” node and making sure the AI has no weapon.

    This works with a bot for example. You might be able to use a UDK bot which doesn’t have a mesh attached and manually attach the mesh of the turret to the bot.

    Hope this helps,

  20. can you plz add a Tutorial on how to destroy the turret

  21. I might Help You If I Have Tıme ıf You Can Leave Me A Message I’ll surely tell u how to make a destroyable turret

  22. thanks, that did help me a LOT

  23. Hi,

    Thanks for the tutorial great work, just what I am in need of, However… I believe that they have removed the spawn projectile node and replaced it with projectile factory i was hoping if its not too much trouble if you could explain how to set up the turret with the projectile factory. Help would be much appreciated.



    • mclogenog Says:

      Hey Michael,

      The Spawn Projectile action still exists, it is simply no longer under the same category of kismet functions. Though I believe (with some modifications) the Projectile Factory should behave in the same way, for this tutorial continue to use Spawn Projectile instead.

  24. Hi Andrew,

    Thanks for your reply you were correct, and the turret is working fine for a basic system.

    I’m wanting to take the turret a step further by setting a proximity area for it. I gave it a go by adding a get distance and compare floot not sure if this is correct but I couldn’t get it to work anyway, if you could help me out with some screen shots of a kismet setup that would be great, it appears that your advance turret has proximity?

    Many Thanks

    Michael Friel

    • mclogenog Says:


      The setup demonstrated above as a single system really consists of two systems connected. First there is the aspect of the player spawn and attaching the dynamic volume to the player. Second there is the turret itself, including target acquisition and projectile spawning. In the above setup, the second system (the turret) begins as soon as the first systems (player spawn) has finished. These don’t need to be connected; any amount of space can occur between the two. That said, it could be a trigger volume (as was the case with my advanced turret) that activates the second system. As long as the dynamic volume remains correctly attached to the player, and target acquisition happens before the projectile is spawned, then any number of events could activate (or deactivate) the turret.

      As for a screenshot of my advanced turret, there’s really nothing complex about it except refining the above turret system with some Boolean comparisons and matinee, which is one of the reasons why I haven’t shown a screenshot. I also haven’t released a screenshot because, due to the simplicity beyond the core element, it would only result in duplicates. And though I don’t care if I see the same systems used elsewhere (indeed I’d rather enjoy it), it is much more important to experiment and play with kismet than to “get it right” the first time while learning nothing.

      – Andrew

  25. Hi Andrew,

    This is a nice tutorial. I just tried this for a level of mine. Could you specify as to how to shoot down a custom projectile (or any UT Projectile) and track it probably for counting the number of hit projectiles?



    • mclogenog Says:


      Though I’m not sure of shooting down a projectile, as in the player’s hitscan weapon colliding, I would think collision detection is what you want. I believe the redeemer missile projectile in UT3 can be shot down, so it should help to look at the script for that in creating your custom projectile. As for counting the number of hit projectiles, there is a kismet event—”Take Damage” I believe—that when applied to an Interp Actor (or an otherwise dynamic actor with collision) will output appropriately; this can then be connected to a switch, or some simple math with a logged integer.

      I hope that helps, and I’m sorry it took me so long to reply.

      – Andrew

  26. Hey, very nice tutorial!

    I got a question:
    – How can I copy paste those codes to “kismet” and “level”? I know how to copy and paste (duh), but where do I need to paste them. I don’t have any text-fields in kismet 😮 and where do I paste the level code?

    It would be nice if you could answer 🙂

    Thanks, take care.

    • You can paste directly into kismet or into the world, no text input fields needed. Copying is about as easy; just select whatever you want (bsp, lights, playerstarts) and you can copy-paste it into a text file. This doesn’t work with packaged stuff (meshes, textures, materials) though. I hope that helps!

      – Andrew

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: