In the interest of creating a traditional medieval setting, many authors decide not to use guns and other explosives in their works. Sometimes reasons are given for this and sometimes not. In Real Life, gunpowder and derivative inventions existed for most of the medieval era.This shows up most often in fantasy (hence the name), but can appear in any genre.
Expect lots of theories about technology suppression and other Fan Wank over why. If guns are present, but nerfed — whether for Gameplay reasons or Rule of Cool — it's Guns Are Worthless.
Something to note is that this primarily applies to fantasy set in the typical medieval-ish setting, with castles, swords, knights and so on. Urban Fantasy tends to have no problem mixing guns and vampires, witches, wizards, etc., since this form of Fantasy tends to use the modern world as we know it. The same goes for Science Fantasy, where the intent is to Mix And Match things like laser guns and spells. When it comes to Fairy Tales, the trope is absent, although guns do tend to cross into the Deus ex Machina level.
See the Analysis page for theories on why this trope is so prevalent.
Gunpowder exists in the Berserk universe, and at least two characters use steampunk-style cannons: Guts himself, who has one to replace his left arm, and the demonic Grunbeld, who has one built into his shield. Nethertheless, while conventional gunpowder weapons such as cannons are used for attack and defense in siege warfare, ordinary soldiers and peasants are never seen with guns and rarely seen with other ranged weapons. Giving background characters the ability to defend themselves at a distance would massively detract from the themesoftheseries.
There's also a long stretch in history where longbows were many times more effective than guns. Cannons, however, overcame other methods of siege warfare pretty early on, and were not entirely without use against certain military tactics. If nothing else, they were loud and intimidating. Also, a cannon would take out heavy cavalry soldiers far more efficiently than a gun would.
The anime introduced gunpowder-based weapons as the arsenal of Jillas, a humanoid fox minion of the third season's Big Bad Valgaav. He has access to guns, bombs, and even built a primitive tank. This was given a certain justification in that Jillas came from a region with less magic; without magic, people had to come up with other ways to do things — and "other ways" include building a ballistic missile as powerful as a Dragon Slave.
In REVOLUTION, it's revealed that Seyruun has at least adopted cannons, and it's hinted they're designed by Jillas.
Averted in One Piece. Pirate crews typically have gunmen along with swordsmen, and neither are shown to be any less effective than the other. The only exception is the Straw Hat Pirates - the ranger of their team, Usopp, uses a slingshot instead, as it lets him use Abnormal Ammo.
InuYasha is fully aware of the time period it is set in, where firearms are growing in popularity but haven't quite reached Japan yet. So when one of the Band of Seven has guns, they're just handwaved as being imported. Before the arc is over, he gets turned into a tank with missiles .
Guns make an appearance on occasion being essentially an equalizer between nobles who use magic and plebs who cannot though only a few well trained musketeers are ever seen using them.
There's a Vietnam era rocket launcher and a WWII era Zero fighter aircraft appear in the first season. Being from Earth the natives don't know how they work. Colbert learns how to make gasoline for the plane and the fact that the Zero fighter still has ammunition in the second season suggests that SOMEONE learned to make bullets. A Howitzer appears in season 3.
One of Pain's paths is basically a bio-mechanical weapon that can fire missiles.
The normal Word of God prohibitions on guns is ignored in The Movies, when there are kunai turrets, artillery, muskets, and kunai machine guns. Also, the characters recognize the existence of guns.
You have to pay attention, but during the Land of Waves arc, in one of the shops Sakura goes into, you can see the owner has a shotgun. Much later, in Part 2, Suigetsu jokingly threatens Sasuke by holding a finger-pistol to his head. Should be noted, though, most ninja possess enough Super Speed to render guns moot (at the very least, they are far too fast for most shooters, if not the bullets) and possess far greater destructive power, with the strongest capable of destroying Villages and mountains and and single-handily taking on entire countries in battle. In other words, they don't really need guns all that much.
It can also be argued that the necessity of guns dropped due to the difference in how battles are fought; in the Naruto universe, combat tends to be more focused on speed and stealth rather than firepower. Guns are notorious for being loud, and take precious seconds to reload, seconds that your enemy could take to send a kunai down your throat. While guns may make small appearances here and there, guns in the Naruto universe are woefully outclassed in large scale warfare, and therefore are pretty rare to find being utilized in combat.
Suigetsu's finger gun gesture gets explained much later; one of his clan's signature jutsus is to make the gesture in order to shoot a high-speed water bullet out of their pointer finger. Hell, it's even called the "Water Gun Technique".
Drifters actually uses this as a plot point. The eponymous Drifters, being sucked from various ages and times in our world, range from those used to fighting with nothing but swords and arrows, to the Wild Bunch (with six-shooters and an early gatling gun) and a Japanese Zero pilot. The world they're dumped in, however, is roughly around the same era of advancement as 1100's Europe, with no real machinery and firearms being a near-complete unknown. One of Oda Nobunaga's first tasks is to get large supplies of sulphur and charcoal and to start the creation of a saltpeter pit for gunpowder, and practically creams himself when he sees how far ahead of muskets the Wild Bunch's firearms are. The Drifters are explicitly changing the rate of technological expansion at a breakneck pace every time they're brought in, and it's even stated directly by the guy who summons them that it's one of their primary purposes — to force the world to advance well beyond the pace it normally would.
Guns exist in Attack on Titan, but aren't the standard issue military weapon since they're virtually useless in fighting the Titans themselves (although they are issued, to a seemingly minor degree, to the civic police). Conversely, fairly sophisticated artillery is used in fighting the Titans, albeit primarily as a support weapon. Although there is one stage where tactical deployment of a raided cache of muskets is intrumental in eliminating a large group of Titans.
The Grimjack comic includes firearms ... but since the city of Cynosure exists in multiple dimensions, the natural laws of any given neighbourhood may not let them work.
Similar to the Amber example below, guns are simply impractical in Necrophim because gunpowder spontaneously explodes when brought near a furnace. In prog 1665, one of Astaroth's lieutenants recruits five real-life firearms engineers to develops guns that will function correctly in Hell.
Artesia is set in a fantasy world that looks to be at about 15th-century European technology levels. They have bombards, although they have not been seen on-page as of yet.
Both justified and subverted in Fables. Since the Empire coexists with modern-day Earth, the Adversary could provide his army with modern firearms. He chooses not to, because he fears that introducing guns to commoners might lead to rebellion. The exiled Fables of Fabletown have no such inhibitions towards modern arms technology, which is one of the main reasons they win the war against the Empire.
Films — Animation
Inverted in the 1977 animated film Wizards, where Guns vs. Magic is the plot.
Averted in Princess Mononoke, where the hand cannons and arquebuses used by Lady Eboshi and her men are central to the story.
In The Wizard of Oz, some of the munchkins are seen wielding muskets, and the Scarecrow has a revolver when he goes with Dorothy to find the Witch. None of them are actually used, however.
The Lone Wolf series averts this with the Darklords' ironclad warships armed with cannons and the "primitive" Dwarven Bor Muskets. In this series, guns are NOT worthless; Lone Wolf will either die or face a chance of dying instantly if an enemy has one of these muskets. When the muskets are first seen in Book 5, the friendly dwarves who have them manage to drive off a flock of Kraan, flying beasts that always give Lone Wolf a good fight in hand-to-hand combat. Oddly enough, they are always referred to as "primitive"; nothing else (except the aforementioned ironclads) seems to be more advanced in Magnamund. Certainly nothing from Sommerlund.
Once Upon a Time: About half of the series takes place in a fantasy world inhabited by classic fairytale characters. On Captain Hook's ship, cannons can be seen in the background. However, that is the only time gunpowder weapons make an appearance in the Enchanted Forest world. Also, guns are never seen being used in battle.
Most civilians carry low-tech weapons like swords and crossbows even though cartridge firearms were invented before electricity was harnessed. This is explained as guns being illegal for civilians to own, which was graphically demonstrated on a rebel who got caught by the militia for illegally possessing guns in Episode 2. However, that doesn't explain why militia members, who are allowed to have guns, only use muskets. Could be explained by most of the modern ammunition being used up during the intervening 15 years. Musketballs are probably easier to manufacture with primitive technology. This theory is verified by Episode 3, with Jeremy mentioning that pre-blackout ammunition was a rare commodity and that copper jackets and smokeless powder were beyond at least the Monroe Republic's manufacturing capabilities.
Although that too makes little sense; modern weapons can easily fire lead bullets without a copper jacket, smokeless powder can be replaced by conventional gunpowder (although at a lower efficiency), and brass casings are reusable. The hardest part would be replacing modern primers, but that's possible too.
It could also be a control measure as well. Monroes guards are seen carrying automatic weapons, while most of the rank and file are carrying single shot muskets. Considering that it can take anywhere from 20-30 seconds to reload a musket of any type, they certainly wouldn't be able to match the fire power of those most loyal to Monroe, who would then proceed to waste every one of them with a single magazine in the time it takes any of them to get their next shot off.
Later episodes did bring out modern weapons into the mix...
BIONICLE only had throwing disks, explosive fruit and energy projectiles for half of its run, then introduced more gun-like weapons due to Executive Meddling (they sold better than close-combat weapons), the most notable being the Cordak Gatling guns whose projectiles weren't magical energy-blasts or Phlebotinum shells, but genuine explosives. The Zamor launchers, Midak Skyblasters, Nynrah Ghost blasters and Thornax launchers are more fantasy-esque, but resemble personal, hand-held firearms. Kopaka's Skyblaster is even outfitted with a bayonet, Gali's Nynrah Ghost gun has crosshairs attached, and both have laser-sights.
Averted in The Order of the Stick, of all places. The dwarven assassin who tries to kill Roy (believing that he's the King of Nowhere) wields a pistol and uses barrels of explosives to (unintentionally) destroy the inn where Roy is staying. Guns probably aren't widely utilized given the prevalence of magic in this setting and the fact that no weapon is particularly lethal due to Hit Points.
Skullkickers has no practical guns EXCEPT for Baldy's surprisingly sophisticated revolver.
The Dimension of Lame from Sluggy Freelance has this in place, though not for the usual reasons. It's not that they don't have the technological capacity to build guns, it's just that every single person in that universe is a die-hard pacifist. Their most advanced weapon is a NUKE (Notification of Unified Kindness' Envelopes), the "NUKE" blankets the area with thousands of polite yet stern letters.
Firearms are present in Strays which is otherwise Medieval European Fantasy or thereabouts. The exact kind/"tech level" of firearms available is undetermined as only one has been seen, and even then not clearly.
Partially averted in Tales of the Questor: The Racconans figured out not just gunpowder but riflingcenturies ago — it's just that "Boomslangs" capable of killing a hardened target (such as croco-centaurs or thugs with lux-reinforced armor) are too big and heavy for most of them to carry, let alone fire. Another problem is that Racconan lands are notoriously poor in metal, which makes using a kilo or two of precious steel for a single weapon prohibitively expensive.
Twice Blessed has a kobold bounty hunter that uses a very large gun (or a small cannon) with a Chinese dragon motif.
Averted in Amya, with multiple characters wielding flintlock pistols.
Paul Twister apparently Doesn't Like Guns, and in his narration he says that that's one thing he has no intention of starting one of his research projects on. And in the epilogue, we find out that the invention of gunpowder was what prompted the dragons to separate the world of magic from Earth, and they've been suppressing knowledge of it ever since. Ryell tells Paul that guns, bombs and rockets are "abominations" that are forbidden. She claims that she wants to preserve a peaceful world; Paul theorizes that the real reason is that they would make it possible to create weapons that could easily harm a dragon.
Pirates of Dark Water has guns that are actually some sort of acid-spraying or dart-throwing creature encased in a tube, with a grip and trigger much like a pistol. Much of their technology is based on the indigenous ecology of Planet Mer. Like using a sea star as a shuriken.
My Little Pony: Friendship Is Magic is possibly the strangest show to avert this. Rainbow Dash mentions she wants a pet "fast, like a bullet," names the pet she gets "tank," and Pinkie Pie has a party cannon. This is really strange considering A) it is a show about magical ponies marketed to little girls, and B) no pony actually has fingers and a third of the population has access to magic.
Even more bizarrely, the closest thing to an actual firearm in the show is the show's main magic-attuned character, Twilight Sparkle, herself. In two different episodes, she rapidly "fires" magic energy at other characters in a manner similar to automatic weaponry. In "A Canterlot Wedding" Pinkie Pie uses Twilight Sparkle as a magic Gatling gun by grabbing Twilight's tail and using it as a trigger, causing Twilight's unicorn horn to rapidly fire at an army of changelings. In "Too Many Pinkie Pies" Twilight fires rapid-fire spells at a number of Pinkie Pie clones until her horn overheats and needs to cool down.
Avatar: The Last Airbender and its sequel The Legend of Korra are an interesting case. Guns don't appear, although by the second series technology had progressed to cars and skyscrapers. This is explained by the fact that the rudimentary early firearms wouldn't have stood a chance against powerful benders, especially the metal-benders. However, gunpowder and other explosives are quite prevalent, and used in both war and terrorism. One cannon is even seen as early as the first series.
In the Justice League Unlimited episode Chaos at the Earth's Core, Skartaris is shown as a medieval or lower society with strong magic users. Since the Warlord of Shamballah and the Big Bad's mooks have no trouble using guns and other advanced weapons, the issue seems to be one of know-how and available resources.
Averted in The Grimorium Verum, which contains a spell for protecting the the caster against firearms.