Making a Sentry Gun

Discussion in 'Mapping Questions & Discussion' started by Crimson, Dec 10, 2007.

  1. Crimson

    Crimson L3: Member

    Messages:
    119
    Positive Ratings:
    1
    So I am very interested in what can be done with entities and their properties. I was looking into making a SG that could be used as a turret of some sort that players could grab and control, but that didn't really fit well into my map, so now im looking another direction.

    Would it be possible to make a Sentry Gun that attacks when triggered? Basically I want to make areas that when the enemy team enters in your base, a SG built into the ground or roof popups and kills them. I saw a SG model with animation such as it deploying, etc. I am curious how I would go about making one that comes out and kills players of the enemy team.

    Im very new to mapping and "scripting" so please be detailed :biggrin:
     
  2. Snipergen

    Snipergen L13: Stunning Member

    Messages:
    1,053
    Positive Ratings:
    150
    i doubt this is possible crimson, you could make your own model of another sentry gun if you make it in .max, and im sure that via a bunch of triggers its possible to shoot you down, but i would have no idea how it has to follow the player.

    Also, let the thought go about using the sentry gun model for the engineer, it would be confusing, people would think they can destroy it, so use another model (custom)
     
  3. Crimson

    Crimson L3: Member

    Messages:
    119
    Positive Ratings:
    1
    Im not talking about using the Engineer's SG model, there is another one. And the one I am talking about is not just sitting around like the Engineers, it actually comes out of a small object.

    Basically what I need to know is how to activate a certain animation when triggered (say an enemy player walks into the trigger box) and how to make it shoot at them.
     
  4. Snipergen

    Snipergen L13: Stunning Member

    Messages:
    1,053
    Positive Ratings:
    150
    I think you are talking about the portal one? can you say the path of it? id like to take a look.

    to make it do an animation is make a trigger, than refer in your output to the model by its name, than in outputs use SetAnimation and type the name of the preferred operation. :) thats how i open my doors before they hit it so you can run smoothly trough them.
     
  5. Armadillo of Doom

    aa Armadillo of Doom Group Founder, Lover of Pie

    Messages:
    949
    Positive Ratings:
    614
    You're in luck, as I did this exact thing for Deathmatch. For now, there's no grabbing stuff in TF2, nor is there a 'use' key for interacting. So it will have to fire via trigger. Believe it or not, the hardest part will be creating the gun itself. I should point out that there is no way to have the gun specifically track or target enemy players. The enemy team will activate the laser, but it will hurt everyone.

    For starters, just make a simple block or cylinder, and that will be your gun. The next step is the bullets. Add env_laser and info_target. Name them laser_1 and target_1 respectively. Set the target of the laser to 'target_1'. Now you can mess around w/ the brightess, width, and color. Set RenderFX to 'fast pulse'.

    Now create a brush with the texture tools/trigger, and make it the size of the activation area. If an enemy touches this, the gun will activate. Transform it to 'trigger_multiple' and name it trigger_red_gun_1. Now add the entity filter_activator_tfteam. Name it filter_red_1. Set the team to red, and filter mode to 'allow entities that match this criteria'. Still on the trigger_multiple, look for the outputs tab at the top. Add a new output. MyOutput OnStartTouch; TargetEntity filter_red_1; ViaThisInput TestActivator. Now click your filter, and add a new output. MyOutput OnFail; TargetEntity laser_1; ViaThisInput TurnOn.

    So now whenever a Blu player enters the designated area, the trigger will test the filter for Red. Since Blu players fail to be Red, the laser will turn on. You have a few options for turning off the gun. For the sake of simplicity, I recommend making it timed. To do this, just add one more output to your filter. OnFail laser_1 TurnOff Delay #

    I hope this helps :)
     
  6. Crimson

    Crimson L3: Member

    Messages:
    119
    Positive Ratings:
    1
    Awesome! Thank you!

    And I believe the model was located in turrets/mini-turret.mdl or something along those lines. I just typed in turret in the keyword box and it had "tf" next to its name.
     
  7. Scoobingsthe2nd

    Scoobingsthe2nd L4: Comfortable Member

    Messages:
    170
    Positive Ratings:
    0
    yeah, there is a TF turret that isn't used currently, but I bet it would be.

    It looks a lot like the old SGs in TFC that would kill you if you entered the enemy spawn.
     
  8. Snipergen

    Snipergen L13: Stunning Member

    Messages:
    1,053
    Positive Ratings:
    150
    ah i see, i think this model is form the earlyest version of team fortress 2 when they were going to make it realistic :)
     
  9. Crimson

    Crimson L3: Member

    Messages:
    119
    Positive Ratings:
    1
    Something isn't working. TurnOn isn't available in the drop down box as a valid selection for the Filter.
     
  10. Armadillo of Doom

    aa Armadillo of Doom Group Founder, Lover of Pie

    Messages:
    949
    Positive Ratings:
    614
    Then you don't have the env_laser selected for 'targets entities named'. Also note there are multiple output choices. You need to scroll down to see them all. 'TurnOn' is the very last one.
     
  11. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,535
    It IS the exact same model from TFC, with no changes other than being ported to a source format.

    Immortal: The +use function is still in the game, it's just not in the controls menu so it can't be relied on :/
     
  12. Crimson

    Crimson L3: Member

    Messages:
    119
    Positive Ratings:
    1
    Can you check this out and see what I am doing wrong? I can't even get the very basics of it to shoot at me lol.

    http://www.nightmaremotorsports.com/clanhex/tf/turret-test.zip

    Also, once I do get this working, how can I control what animation is used? Like the "idle" one so its not really seen, then the deploy and fire when its about to shoot at someone.
     
  13. Logo

    Logo L3: Member

    Messages:
    115
    Positive Ratings:
    26
  14. Big Nick Digger

    Big Nick Digger Guest

    Positive Ratings:
    0
    there are outputs that may not be listed in the dropdown list! just compile and see if it works, even though it says its a broken output.
     
  15. Crimson

    Crimson L3: Member

    Messages:
    119
    Positive Ratings:
    1
    I think I have narrowed the problem down to the lazer, but if anyone gets a chance to check out the file I posted, I would be grateful. Just not sure what I am doing wrong.
     
  16. Crimson

    Crimson L3: Member

    Messages:
    119
    Positive Ratings:
    1
    Anyone had a chance? I would love to get this working. I am just not sure where in the steps listed I failed. I redid it twice and same thing. =/
     
  17. TheBladeRoden

    TheBladeRoden L7: Fancy Member

    Messages:
    491
    Positive Ratings:
    167
    Since I have a vested interest in putting turrets in a future level I thought I might help you out.

    I think it's possible that putting hyphens in names can be problematic. So yeah, I fixed that.

    Also, through a series of trigger_multi's and movelinears I've made it so the laser moves wherever you're walking, which looks kind of nifty.

    Only problem is that the spy's cloak and disguises won't fool it.
     
    Last edited: Dec 19, 2007