For a swashbuckler character, see Swashbuckler.
A gun and a sword (or other melee weapon) combo...when not used at the same time. Typical combination for characters and armies on the advent of gunpowder, the ranged weapon in this case is often more of a throw-away weapon used to down an opponent before closing to meet with the rest. The gun can be a pistol or a rifle just as well - in fact, the musket itself (which the musketeer is named for) is a long two-handed gun. This sort of a warrior tend toward the Wooden Ships and Iron Men — pirates may even wear a bandolier with several loaded pistols, like Real Life Blackbeard did, in addition to two pistols on his sword belt — and Swashbuckler settings, but not limited to them. Samurai Cowboys need both a Revolver and Katana, so they apply as well. It can even be more modern and futuristic, up to Jedi proficient in both the blaster and the lightsaber.
One important thing: these weapons aren't reserve weapons. This trope is for fighters who are proficient in using both the gun and the melee weapon. Someone who is just picking up a lead pipe or something because their gun is out of ammo isn't an example. The character is good with both weapons and will use them as the situation fits.
Bayonets are a special case. They are a blade that attaches to the front of a gun weapon that turned it into a short spear. Many variety of bayonets are basically a modified knife that clips or fixes onto the front of the gun and can be wielded like a fighting knife when not attached to a gun.
Not to be confused with Sword and Gun, which is when this trope meets Dual Wielding. Subtrope of Choice of Two Weapons. See also Bow and Sword in Accord, which is different but still related.
Setsuna F. Seiei from Gundam 00 pilots a Gundam that specializes in close quarters combat; Exia and 00 are armed with massive swords that also have integrated beam rifles. The GN Sword on the Exia and the GN Sword III wielded by 00 Raiser are essentially massive switchblade-type broad sword that can rapidly cycle between rifle mode and sword mode. The GN Sword II is used in conjunction with another sword II and also doubles as rifle with a range of firing modes. Setsuna was less proficient with the rifle mode earlier in his career, but eventually becomes a better marksman (to the point where Graham Aker notes that Setsuna's ranged attacks are far more accurate than they were).
Humongous Mecha often follow this trope, and Gundam is no exception. Most of the Gundams piloted by the various protagonists, starting with the original series, have historically been armed with a highly effective ranged weapon (typically an energy-based rifle) and a highly effective close-combat weapon (typically a beam saber). For that matter, a substantial number of the Mecha-Mooks in the series also carry and use effective (well, effective as far as mooks go) weapons of both varieties.
During the climax of the Sin City tale, Hell and Back, the main character duel wields a pair of colts and has a machete available. Incidently, he eventually throws the machete to kill a mook from a distance.
Nikolai Dante is this, thanks to the bio blades afforded to him by his weapons crest and his Huntsman 5000 rifle. To the same extent, several other characters are this, due to tactics having regressed somewhat over the last few centuries.
The Marvel Comics ElseworldThe 5 Ronin transplants familiar Marvel characters to Japan under Ieyasu Tokugawa's rule. The series' version of the Punisher is an expert swordfighter and an ace gunman, but depending on the situation he will only use one weapon, his rifle or his katana.
The Empire Strikes Back sees Luke carrying a lightsaber and a blaster into battle, although he never uses them in concert. For instance, in the climax, he uses a blaster to shoot down several Stormtroopers, then puts it away in order to go after Darth Vader in a lightsaber duel. He is the only Jedi or Sith to do that in the movies, with the notable exception of the one scene in the prequel trilogy where Obi-Wan uses a blaster, but it's not his, he only uses it as a desperate last resort, and he drops it with a disgusted look on his face after the fight is over.
In Edgar Rice Burroughs' Barsoom stories, John Carter often carried (and used) both his long sword and a radium pistol (the bullets of which had explosive warheads).
The Three Musketeers do this, though they're better known for using swords. Since swords were the standard sidearm of the day, most of the book isn't spent in line combat, and guns of the day were single-shot weapons, it's quite understandable.
In the Old Kingdom books, military stationed in the Perimeter are armed with guns, swords, and sometimes bows and arrows. The guns are their normal weapon of choice; the swords are for when technology fails due to the proximity of magic. The most experienced soldiers become proficient with both.
Solomon Kane's usual tactic when confronting multiple attackers is to discharge both his pistols, then draw his rapier and dagger.
An honourable mention goes to the pistol and close-combat weapon combo that is very common in Warhammer 40,000 - while the units that do this are much less effective at ranged combat when compared to units that are geared for ranged combat; using a pistol with another close-combat weapon gives the same benefit as if you had two close-combat weapons, except the unit can also shoot their pistol before charging into melee. In addition, Chaos Space Marines and Space Wolves carry a gun, a pistol and a sword, so they can both shoot effectively and fight in close combat. In older codexes, where the characters are allowed to pick a certain points worth of items from the wargear list, it was possible (but not very practical) to buy multiple ranged or close combat weapons. The newer codexes characters can only pick certain items listed on their profile and the choices tend to be mutually exclusive (so one on range weapon from the list of available options etc). However there are some exceptions; for example, Huron Blackheart has a power weapon and a powerfist (he can't use them both at the same time, though).
In any game of Dungeons & Dragons or Pathfinder where guns exist, this trope will be ubiquitous. Due to the Class and Level System, a character's chance to hit is highly dependent on whether they belong to a fighting class and their level, barring Game Breaker exploits of the system. Every character is going to carry at least one hand weapon and at least one missile weapon, even the Squishy Wizard. Many characters are far more powerful at range or in melee, and many other characters would only resort to physical attacks when desperate, but they all will still follow this trope. If there are no guns, expect Bow and Sword in Accord to be just as common, with characters who can't use bows using slings, crossbows, or anything else they may have.
Early versions of BattleTech RPG spinoff Mechwarrior encouraged player characters to do this; to-hit rolls in infantry battles were all determined by the dexterity stat, and most of the commonly available weapons didn't have magazines that would hold more than ten combat turns' worth of fire. Reloading was a 'complex action' that took a whole turn to complete and could be interrupted, which meant that in a close-range battle it was faster and more efficient to simply draw your melee weapon (a simple action, which you could make at least two of per turn) and go to town on the nearest enemy. As the system evolved and rolls could be checked against skills, this trope became less prevalent, but is still present. Bearing in mind that Battletech is a Space Opera, the romanticized nature of melee combat on the infantry scale is in full effect.
The hero in Fable II has a sword and a gun, which can be a pistol or a rifle. He/she can also wield a crossbow.
The third one has completely gotten rid of crossbows, as they're just not as powerful anymore. It is the Industrial Revolution.
Possible in Knights of the Old Republic with a blaster and a melee weapon. There's not always a lot of point to it though, unless you're far enough away from the enemy to get in two shots before melee begins.
From Halo 2 onwards, both Master Chief and the Arbiter were capable of wielding the plasma sword and later gravity hammer in addition to their ranged weapon.
Ratchet & Clank is mostly known for its bigger weapons, but the wrench is not to be lightly discarded, especially in the early game. There's also the plasma whip, basically a vamped up, longer ranged version of the wrench.
While not a gun per se, Link of The Legend of Zelda is known for using gunpowder weapons like bombchus and bombs effectively. Considering that guns aren't invented yet, its as close as a character can get to the trope in the game.
Left 4 Dead allows you to swap between a small weapon and a large one. Its sequel allows you to make this selection to be between a melee weapon and a large gun instead.
In the first two Fallout games, it was possible to switch quickly between two weapons without AP costs if equipped for that. Too close? Drop The Sledgehammer. It's still possible, but not as intuitive, in the third and fourth games (you have to assign weapons to number keys, like in traditional FPS games, and New Vegas takes away one possible slot to use its key for an entirely different mechanic instead).
Warhammer 40,000: Dawn of War 2 has Tactical Marines which are durable units that shoot at enemies by default, but actually achieve a better damage per second with melee attacks, and have a 'Melee Resistance' aura for themselves that reduces melee damage taken (all other melee units in the game has this).
A number of units in the Dawn of War series are like this, in fact, armed with both a long-range firearm and some form of melee weapon, with the player given the choice to make them use one or the other depending on the situation.
Age of Empires III had musketeer units - true to the trope, their ranged attack is useful against melee-based units, but their melee attack is what makes them good against cavalry and had a better damage per second statistically.
Call of Duty: Modern Warfare 2 has the Commando perk that make your knife attack from farther away at no cost to your ability to shoot down range, and the 'Tactical Knife' attachment for Handguns that allow you to hold your knife while using a handgun to make your knife hit faster, also at no cost to your ability to shoot with it. World at War allows for bayonets with most rifles, and the trench gun.
These are actually part of the reason for some players' dislike of Modern Warfare 2, where the knife has an infamous reputation for being better than firearms, due to the knife's instant-kill property no matter where it hits on an opposing player's body, whereas almost all firearms take multiple hits to kill unless they hit the head, which is rather difficult to do intentionally.
In Sid Meierís Pirates!, your character can have a flintlock pistol to fire at the opponent before a sword fight, having them start out pushed back.
Every Tenno in Warframe is always equipped with a melee weapon, primary ranged weapon, and secondary pistol . The former sees as much use as the latter two, as their Charged Attack and Ground Pound deals massive damage and knocks down enemies respectively.
Raidou Kuzunoha XIV uses both Sword and Pistol when going against demons, and while generally the sword does better damage, guns are very useful in both Kuzunoha games due to their secondary properties (ability to load elemental bullets in first, the ability to stun foes in the second).
Zero is capable of using his Arm Cannon and his Zero Saber in tandem, depending on your control set-up.
Lightning is an interesting case because her sword and gun are combined into one weapon that changes between the two.
Many, many combat games have dual weapon sets that can be quickly switched between, and many players have melee gear in one set and ranged weapons in the other.
Kyle Katarn and his apprentices Mara Jade and Jaden Korr, the protagonists of the Dark Forces Saga, are lightsaber-wielding Jedi who also make use of blaster weapons, heavy machineguns and rocket launchers.
The Kid of Bastion is capable of using both a variety of guns and various melee weapons. In the setting, the Slingers were known to use machetes and dual revolvers.
In the orginal Persona the playable characters can alternate between a melee weapon or a ranged weapon with the grid based battle system.
Several of the musket units in the Total War series are pretty good in melee, such as the Matchlock Samurai in Shogun 2.
The Dwarvish Thunderer line of units in Battle for Wesnoth. While their primary weapons are definitely their single-shot "thundersticks", their backup daggers aren't too shabby in melee either (indeed, the basic Thunderer's dagger attack is straight-up more powerful than the human Bowman's short sword).
The O'Carroll brothers in Sang-Froid: Tales Of Werewolves carry an axe and either a rifle or a musket as their personal weapons switching between the two at need.
Cadegund, an NPC party member in Pillars of Eternity, is armed with a wheel-lock musket and a warhammer. This is apparently fairly typical of the clergy of Magran, goddess of war and fire.
Kenji from Battle Realms gains a pistol halfway through the campaign to complement his sword, and will fire it when he's not engaged in a melee or ordered to attack.
While some of the earlier musketeers also carried a sword, which they would draw when closing in for hand-to-hand combat, most rank-and-file soldiers were too poor to own one. Instead, before the advent of the bayonet, they would simply wield their musket as a two-handed club by using the heavy stock to crush heads and limbs. After the advent of the bayonet, the basic musketeer fully fit the trope - musketeers armed with one became the standard infantryman and tactical doctrine held that infantry would shoot their muskets while defending against other enemies at range, but brace their bayonets against cavalry and charge with their bayonets to attack (due to the musket's low fire-rate lacking the same morale-breaking power as a horde of men charging at you to stab you). The earlier plug bayonet fit the trope even more starkly - troops had to place their bayonet into their musket's barrel, preventing them from shooting, making it especially blatant their two main weapons were the musket and bayonet.
When gunpowder was first invented, pikemen were supposed to support the gunpowder units, which were separate from them. Later on, with the advent of decent bayonets, the pike element became less important until it was dropped entirely, as what both sides were holding were basically short spears that fired stuff.
All modern real life examples should include a caveat. This trope is about characters who are both swordsmen and riflemen, not guys who "swing a lead pipe because they're out of ammo." It is quickly becoming a Dead Horse Trope in the real world because modern weapons make hand to hand fighting extremely rare. Thus, in almost all cases, the use of any hand weapon is a case of either extremely strange circumstances or simple desperation. Elite commando units may occasionally train in using entrenching tools, knives, and tomahawks, but this is very secondary to shooting. Infantrymen practice bayonet drills in basic training/boot camp because it teaches aggression, confidence, and that "I'm gonna gut you" mentality that an infantryman's life may depend on. After initial training, bayonet drills are far, far less common than time at the shooting range or battle drills with rifles and heavy arms. Most close quarters battle training focuses learning to clear rooms quickly, on shooting quickly and accurately, prioritizing targets and controlling fields of fire, and on responding to a chaotic urban environment where targets can pop up at any range from two feet to two hundred yards or more. There usually is no time and no reason to switch to a hand weapon in this kind of environment. Unarmed combat training is more common, but the goal is usually to get an enemy off a soldier so the soldier can just shoot them.
A number of bayonet charges have worked in the modern day conflicts against insurgents and terrorists not expecting their enemies to charge at them yelling. Needless to say, those soldiers who performed them probably fit this trope.
Oddly enough, one of the units that did a bayonet charge on Iraqi insurgents is a military descendant of the entry below.
The Highland Charge was developed to give Scottish armies an edge against better equipped and better trained armies in this way. The enemy line could be broken up and their morale shattered while the Scots were just getting started with their new one-handed claymores. Against armies who held ranks they tended to get massacred though.
In fact, the dreaded Highland Charge helped lead to the development of the socket bayonet, which unlike the previous plug bayonet, fit over the barrel of the musket and allowed it to shoot and stab all at once. Therefore, the English units were able to enter the battle with already fixed bayonets instead of having to equip them while a horde of screaming Scotsman with BFS bore down on them.
The swords of this period were one-handed light swords similar to a later broadsword. It was certainly not the claymore most people envision when they hear the word. By the 17th Century, gunpowder had completely dominated the battlefield and any heavy infantry with armor and a BFS was a relic waiting to be slaughtered. The charge relied on a light targe, a broadsword or dirk, momentum, and a movement which left the English infantry helpless just long enough for them to be cut down.
The Highland Charge was a Awesome yet Practical shock tactic of closing to roughly twenty yards, firing a volley, then dropping one's firearm. The follow-through then followed up with sword/dirk and targe. The attacker would drop to a knee or stoop just outside the range of the bayonet, use the targe to come up and knock the musket off to his left, and with the same motion spring forward and kill his defenseless target with his sword or dirk. The man with the musket had absolutely no time to bring his musket back around to stop his attacker. If he had a hand weapon (which he usually didn't), he had no time to draw it. He could not retreat to make space, since he was part of a battle line and someone was right behind him. The English were fed several devastating defeats in this manner. The English eventually created a defense which shut down the charge for good and was even more Bad Ass than the charge itself. First, the above-mentioned socket bayonet meant a unit could always have its bayonets mounted. There was no time to fiddle around with plug bayonets. Each man, finding his bayonet knocked to the right (the charger's left), would forgo his own defense and instead stab the exposed side of the man to his front-right, similar to how pawns in chess attack. He would then be helpless to defend himself and would have to rely on the man to his left to protect him, just as he protected the man to his right. The discipline a formation of soldiers would need to have each man forgo personal defense and put his life in someone else's courage is simply mind-boggling.
Early Russian riflemen would use a two-handed battleaxe as their melee reserve weapon, and as a gun rest to steady their aim.
Modern U.S. Army Rangers and U.S. Marines occasionally can be found carrying tomahawks as both a melee weapon and a general useful tool.
Hand weapons like this are common among many elite units, but do not really fit this trope. Most US military martial arts are designed to get an attacker off a troop so the troop can shoot them at point blank range or else pin them down so their buddies can do it.
The e-tool's effectiveness as an improvised battleaxe is infamous, and there have been some spectacular stories of it butchering enemies. That said, only armchair soldiers would think that military personnel would want to resort to using it first when insanely lethal battle rifles are considered small arms. Some units continue to train in the use of such weapons, but in almost all cases it is as an emergency weapon when all else has completely failed.
As soon as guns made it to Japan, the Samurai became Musketeers. Miyamoto Musashi's famous Book of Five Rings covers the importance of the gun and of using it well as an essential part of a samurai's training. Guns saw heavy action in the Sengoku Jidai period before the unification of Japan under the Tokugawa shogunate. The Battle of Nagashino is the most famous example of what happened to those who didn't see the writing on the wall, where already-common firearms were used by Oda Nobunaga from behind wooden fences in rotation to deliver devastating fire that destroyed Takeda Katsuyori's cavalry.
As the numerous modern examples make clear, the Musketeer has largely vanished from the battlefield in favor of the pure rifleman. It seems plausible that the trope is now more relevant to the civilian world, where carrying a firearm at the ready is considered unacceptable and any attacks will probably come by surprise. Here, the "protagonist" has a roughly equal likelihood of responding with either gun or melee, and quite likely will finish the fight with what he grabs first. If he travels to the many so-called "gun-free" areas, he'll find himself facing gun-armed attackers with only his melee capability. This is becoming more commonly stressed by trainers, who are finally branching out from the old pigeonholes of "shooting", "martial arts", etc, and addressing the need for a more well-rounded skillset as our society becomes progressively more dysfunctional.