Making a Sentry Gun

Crimson

L3: Member
Nov 25, 2007
119
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:
 

Snipergen

L13: Stunning Member
Nov 16, 2007
1,051
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)
 

Crimson

L3: Member
Nov 25, 2007
119
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.
 

Snipergen

L13: Stunning Member
Nov 16, 2007
1,051
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.
 

Armadillo of Doom

Group Founder, Lover of Pie
aa
Oct 25, 2007
949
1,228
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 :)
 

Crimson

L3: Member
Nov 25, 2007
119
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.
 

Scoobingsthe2nd

L4: Comfortable Member
Nov 11, 2007
170
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.
 

Snipergen

L13: Stunning Member
Nov 16, 2007
1,051
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 :)
 

Crimson

L3: Member
Nov 25, 2007
119
1
Something isn't working. TurnOn isn't available in the drop down box as a valid selection for the Filter.
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,776
7,674
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.

ah i see, i think this model is form the earlyest version of team fortress 2 when they were going to make it realistic :)
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 :/
 
B

Big Nick Digger

Something isn't working. TurnOn isn't available in the drop down box as a valid selection for the Filter.

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.
 

Crimson

L3: Member
Nov 25, 2007
119
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.
 

Crimson

L3: Member
Nov 25, 2007
119
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. =/
 

TheBladeRoden

L420: High Member
Oct 26, 2007
491
168
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: