Most importantly, there are offensive and defensive classes in TF. Classes which are primarily defensive should stay that way; trying to fill a role which your class was not designed for is not heroism, it's stupidity. Don't be an idiot and go traipsing off alone (or even in a group) deep into enemy territory; more likely than not you'll get slaughtered by the mass numbers of defenders, and in the meanwhile your team's defensive capabilities have been seriously reduced. One fully healed and upgraded sentry gun makes a lot of difference, and you being there is a deterrence to enemy attackers. Engineers should hang back with the rest of the defense to make sure that their defense is not compromised.
Secondly, the engineer does not carry his most powerful weapon. The sentry gun is indispensable for getting, in essence, free (or almost free) frags, while at the same time accomplishing essential defense which otherwise would have to be covered by a human player. Every player who has ever been chopped down by an enemy's sentry knows how frustrating a well-hidden gun can be; when it's well guarded and stocked as well, they are virtually indestructible. When they do get destroyed, they can be rebuilt and fully upgraded in a matter of one to two minutes, usually the space between attacks. The moral? Your number one priority is to keep your sentry gun alive and well, and protecting a vital area. It's value to you and your team is immense, so don't forget it. For more hints on the use of the sentry gun, see below.
If need be, however, the engineer can fend for himself; his railgun is a pretty nice weapon which can take out or really wound the enemy from long distance, and the double barreled shotgun is great for close battles. Remember, though, you're not out there to kill guys by yourself -- you have that sentry to keep going! On the other hand, you don't need an escort to go out and take care of business if need be. Try to keep as much distance between you and the enemy as possible (unless you're going up against a rogue sniper, go get in his face and shove that shotgun down his throat). The engineer is a pretty well-balanced class, so he takes the best of both offensive and defensive classes to make a happy medium.
Bind a key to the command "id" in the console (type "bind __ id ", replacing the blank with whatever key you want to press to ID someone and without the outer quotation marks). In addition to allowing you to see how much armor one of your teammates has, it also is invaluable for looking down dark hallways and into corners, identifying spies (someone else is running around with your name), and communication between players. You should also bind a key to "special" (executes a special command for each class, and for the engineer, this is the command to build sentries and dispensers, MUST have), "discard" (discards ammo which you cannot use, e.g. nails for a soldier, which is also an absolute MUST), "saveme" (lights you up so that medics can see you need help without id'ing you, as well as playing a sound telling those around you that you are wounded). Some people bind a key to "reload", which reloads a clip when you are not in combat, but the engineer's main weapon is the railgun and I usually do not use "clipped" weapons while playing this class (e.g. the shotgun), though they do come in handy for other classes. If you get caught in a close range fight (try to avoid this), definitely use the shotgun if you can remember in the heat of the battle. If you play as any other class, you will probably want to have a key bound to force a reload anyway. You also will want to have the status bar up -- type "sbar_on" at the console. This will tell you how many cartriges you have left in your clip, and if you're an engineer, how much damage your sentry gun has taken. I never go into a game without the status bar. As an afternote,the engineer is a walking dispenser -- just bind a key to "dropammo" and you will be able to create any type of ammo for your loyal defensive team members who can't make it to the respawn room to refill. Believe me, if you're trying to get on peoples' good side, do this often. Nothing is more encouraging than getting refilled by a consciously defensive-oriented engineer (or any other class; they can drop ammo if they have it but only engineers can create it). This is also useful for reloading your sentry gun. If you're a long way from a reload area, just make some rockets or shells, pick them up, and put them in the gun. Cool, huh?
In addition, the engineer also has another very important function -- repairing armor with the spanner (weapon 1). For soldiers, heavy weapon guys, demomen, or any other for that matter, this ability can make or break them. For those classes which respawn with red armor (soldier, hwguy), getting filled to 250 armor is something which every one of them should be able to do -- courtesy of you, the engineer. Whenever you see a teammate, FILL THEM UP WITH ARMOR! Or at least make sure you have an ammo dispenser at one of the respawn points (usually the ammo rooms). I hate engineers who hide their dispensers, or don't make their locations known. Other than maintaining sentry guns, this should be your number one objective. It will save your teammates some travel time, repair rocket jumping soldiers (believe me, that armor runs out fast!), and more than anything mark you as a teammate who can be depended on. I'm sure all of us have been in a situation once where you've been way low on armor and health, and seen several engineers and medics take a quick look at you and move on when they could've take a couple whacks at you to give you a fighting chance. Remember that this is a team game, and a gain for the team is a gain for you. Keep that in mind next time you see a straggling hwguy with 15 armor hobbling back into base. At the very least, you will help him make it to find a medic or ammo room so he won't get slaughtered by an enemy attacker. [Editor's note: with the advent of 2.65 servers, most maps now give you maximum armor in the form of red armor being placed in the respawn rooms. However, it is still imporant to whack at all your teammates to ensure that they don't have to constantly run to the ammo closets.]
For those of you who aren't engineers, give engies preference to picking up armor unless you don't have any yourself. An engineer's spanner is much more powerful than the armor you pick up, so if you need a refill just let him get it; then hit "saveme" and jump around until he notices you want some armor. However, the engineer can not give you armor -- only increase any ammo you may have. If you have none, time to get to the ammo room.
An important ability of the engineer is to build ammo dispensers. For
the respawn rooms, an ammo dispenser allows everybody to fill up on ammo
and armor immediately, without having to wait for them to respawn (maps
like 2fort4 and its 32 player counterpart don't have the backpacks where
you just walk through them to get refilled -- you have to pick up the ammo
just like in CTF or deathmatch). Those
precious extra seconds could mean the difference between a captured and
dropped flag. Make sure you have an ammo dispenser near high traffic areas
(but not in them, so an enemy passing through can't make a quick
fillup) so everyone can get stocked on their way to their position. On
such maps which have the supply backpacks, you might want to put the
dispenser in a more obscure place, or use it for
defense.
Miscellaneous TF tip #9: When attacking the enemy fortress (as a class other than an engineer, of course!), don't fill up on ammo. If you die, then all you're doing is restocking the enemy defenders. Another good idea is to discard before you leave your ammo room, so that other enemy class types won't be able to get your ammo either. Of course, discarding unneeded ammo is just common courtesy to your teammates. Do it.
More on the sentry gun -- it's practically useless unless you keep it filled to the brim with ammo, upgraded to level three, and fully healed (hit with spanner, menu pops up, select "repair sentry gun"). If you upgrade your sentry to level three, it will be able to fire rockets as well as rapid fire bullets. One rocket in the face and a spray of lead from a fully upgraded sentry will usually take out an attacker fairly quickly, or at least seriously weaken him so he will get taken out by other defenders. If you keep an ammo dispenser near the sentry, this is no problem -- just upgrade, reload, upgrade, reload, repair, until you've got the puppy ready for some real action.
Dispensers are refillable! Just hit the dispenser as close to the bottom as possible and you will get a popup menu asking what to put in the dispenser. See figure at right. See where the crosshair is under the 's' of the 4th choice? That's where you hit it. If you've got some time on your hands, pick up all the ammo in the room and chuck it in the dispenser. This way, the ammo can respawn, thus creating an ammo 'inflation'. Once it respawns, just place in the dispenser and your ammo stores will grow at quite a rate.
To build or detonate a sentry, or ammo dispenser, simply hit the key bound to "special" and a menu will pop up. Stand with your back facing the direction you want the structure to point (it will come out facing you), make sure there is sufficient room to build, and hit the number of the command you want. To upgrade, reload, and repair sentries, or to turn them 45° to the left, select the spanner (impulse 1, I'm not going to tell you again) and hit the structure. Another menu will pop up and then select what you want to do. Keep in mind, though, to upgrade, repair, and reload, you have to have sufficient cells and ammo, respectively. To build a sentry you need 130 cells, to upgrade, a little less (I'm not sure, but you'll have to reload), to repair, usually between 25 and 50 cells, and to reload, you must have shotgun shells and/or rockets. No minimum, it will usually take all but 10 shotgun shells and all your rockets.
I noticed someone doing this the other night on a public server -- they
built their sentry (2fort4) directly under the sniper deck, just inside
the right door to the entrance of the fort, with its nose sticking out.
From our battlement, I could see the sentry sitting there, so I jumped
off, ran to the door, and tossed in a couple grenades. It went boom, with
not one teammate maimed or killed, with absolutely 0 risk to myself. When
you are building a sentry, make sure it is not near a corner where an
enemy can drop in a couple of grenades without ever showing his face -- if
at all possible, put it in as long a hallway as possible so that only a
sniper or soldier could take it out easily (which is pretty tough to do
while it's firing at you). However,
you don't want it too long of a hallway; the sentry has a limit of how far
it can detect enemies. For instance, do not place the sentry in your flag
room in 2fort4. When an enemy peeks his face in to check for a sentry, he
will spot it immediately but the sentry will not fire, because he is just
outside the range of the detection mechanism. He can then sit and plug
away at the gun with no chance of ever getting hit by it. The moral? build
the sentry in the darkened portion of the hallway so it can detect enemies
just entering the long flag hallway. I've said this once and I'll say it
again: as a rule, I only build sentries outside the range of a grenade
toss; that is, when an enemy first sees the sentry, he should not be able
to hit it with a grenade, whenever possible. [See figure at left]
A couple final notes on the sentry gun -- refill them from behind, and stay out of their line of fire. They do not stop firing when a friendly is in their way, and if an enemy comes in the room while you're reloading, you'll get your stomach perforated while the attack goes on unmolested by your vaunted sentry. When building against a wall, leave a little space on the sides or back so you can squeeze in to do an upgrade or reload. Nothing is more humiliating than the message "Player hates his own sentry gun!"
Additionally, the sentry does its best work when it's on the same plane as its target and has full visual. If these conditions are less than optimal then the sentry will take longer to detect its target. An example of this is in rock1, in the narrow hallway across from the jail cells which has a smal slit in it just the height of the sentry. Though the sentry is very well protected, it will take much longer to detect an enemy since it can't see the whole thing. Keep that in mind when you're looking for a perfect spot for your sentry.