How to Make Powerful NPCs Interesting Again
We all know the trope: the powerful wizard hires the party to go run some minor errand, which inevitably leads to them stumbling onto the World-Ending Plot, which they have to solve, alone, with only the occasional advice from their wizened mentor. It's a trope as old as time; even Hercules got occasional boons from godly beings to help him on his quests. It's a great narrative device, until some player stops and asks, "If this wizard is able to stop time with a snap of his fingers, why doesn't he just stride into the field and shove a ninth-level fireball into the Lich's cranial cavity?"
This simple bit of cognitive dissonance can really ruin the fun and undermine the urgency of an otherwise great adventure. If the party knows that the only reason they're on this quest is because Randalf the Off-White can't be bothered to deal with the horde of undead outside his tower, it can make them feel like chumps or patsies, and undermine any sense of gratitude that comes later during the campaign's denouement.
There's a few simple ways to fix this, though: tricks that can help you, the DM, keep your high level NPCs while also explaining why the great powers of the world are relying on this band of scrappy adventurers to solve all their problems. Below are just a few.
This principle is a great one, but is often sadly overlooked in many campaigns. Simply put, in the above example, the wizard mentor doesn't get involved not because he can't, but because doing so would bring in a whole host of other powerful beings that would complicate the conflict. Perhaps there's a council of archmages who have all agreed, for the sake of maintaining the fabric of reality, that they should keep their Ninth-level spells in their pockets unless they all agree it's necessary. Perhaps the BBEG has a patron on the Council, and the mentor can't interfere on his own without dragging his evil opposite into the campaign. This can actually make for a great part of the climactic battle: the mentor decides he can't stay on the sidelines anymore, and joins the fray, participating in an epic wizard's duel.
This can also be used with deities bestowing boons on the party: they can act indirectly by helping the party, perhaps because one of their rival deities is already helping the BBEG. Thus, the conflict of the campaign turns into a proxy war for a larger divine conflict that can't be fought, because it would annihilate all of existence. If you do take this path, make sure your NPC stresses to the party how essential it is that they solve this issue, because if the major players themselves join the fight, no one will survive.
Similar to the Balance of Powers, this rationale places the Epic NPC in a conflict from which they cannot afford to divert their attention or resources, even for a moment. Perhaps there is a constant threat of otherworldly incursion for which they need all (or almost all) of their capabilities; after all, you don't want to be caught with your pants down and your spell slots expended when Tiamat bursts through the material plane like an alien parasite from a man's stomach. Even the threat of such an apocalyptic event would mean that, like a missile in a silo, an epic level NPC would have to sit dormant, never expending his magical capabilities because he never knows when they may be required. This is actually a great archetype to use for the Wizard in the Tower trope; they may have built themselves a convenient magical retreat at great cost because they couldn't afford the spell slot to cast Mordenkainen's Magnificent Mansion everyday, not while that same spell slot may be needed to banish an archduke of the Nine Hells. So, they sit in the tower, separated from the affairs of the world by necessity - but, still caring about the world and wanting to make sure it's not a shit place to live, they can find and recruit adventurers to handle the more mundane threats that don't shake the foundations of the universe. This is also a great twist finale to use on the party: perhaps the Wizard in the Tower joins them in the final boss battle, expending all his magical power -- only for, at that moment, the threat he's been guarding against for centuries to finally arrive, and now it's up to the party to stand against them where he cannot.
This works especially well with warlock patrons, but it can work similarly well with questgivers and friendly NPCs that have an otherworldly or spiritual bent. The key idea is that the force recruiting, motivating, and rewarding the players is not located on the material plane itself and is therefore unable to act on it; they need to find a local agent to handle the problem. There is plenty of inspiration throughout myth and folklore; dream visitations, whether by angels, fiends, fey, or Lovecraftian horrors, are particularly common as an impetus to get an uncooperative character to fall into line. There are more tangible methods of communication as well; perhaps they are a being of immense power that is trapped in every mirror in the world and needs an agent to eventually get them free, or perhaps they can only manifest through signs and omens that require interpretation. If you want to pull from Greek mythology, there's also the possibility of a dedicated oracle who acts as the voice of the gods, but gives only vague, ominous prophecies that won't reveal their true weight until later. In all cases, a clear distinction is established between the power of the questgiver and the limitations of their abilities to influence the mortal realm, making the party the ones with agency in the situation.
You'll want to be careful how you use this one, because you only get one shot to pull it off with a given group, and once the players suspect something it is really, really hard to recover from it. The basic premise is that the powerful NPC who recruited them, who sent them off to fight against the Big Bad Evil Guy, was secretly a villain themselves, trying to bring down their rival or clear the way for their own scheme. Think of Emperor Palpatine from Star Wars, sending the Jedi across the galaxy to deal with the Sith and the CIS, only to betray them all. Unfortunately this has become a major trope, and given how paranoid players typically are, it's very hard to pull off. There's a couple of tricks to making it work, and some of them may seem counterintuitive.
Do not make the Hidden BBEG perfect or flawless. Establish a set of motives for their actions, ones that may seem prosaic but also have a selfish bent. The high priest wants to rid the land of the evil king who is oppressing the population, but who is also stifling the priest's ability to build his church. The noble ruler wants to defeat the opposing empire that threatens the peace and stability of his lands, but also is motivated by revenge for the war crimes committed in the past. Create a pretext that puts them on the same side as the party, but a subtext that leaves the party slightly uneasy. If the party is concerned about their ally having selfish motives, they'll be expecting selfishness, even recklessness, but not duplicity and betrayal.
Do not reveal the full capabilities of the Hidden BBEG. If anything, they should appear to be about mid-level; capable, but not able to handle world-shaking threats. Most often they are hiding their capabilities until some final piece is brought into their grasp. One excellent example would be Fraz-Urb'luu, one of the demon princes of the Abyss, who is obsessed with recovering his staff of power; as a Hidden BBEG, he might pose as a friend to the party, waiting until they recover all the pieces and bring them to him before he strikes, showing his true might. Another excellent example is the Heirophant from the classic geek movie The Gamers: Dorkness Rising.
Show genuine conflict in the Hidden BBEG. Let them display passion and inner conflict, moments where they are troubled by the methods the party uses and the methods they and their followers are forced to use. There's an old adage that every villain is the hero of their own story; if you can make that ring true for your Hidden BBEG, to make the party invested in not just their cause but in maintaining their moral character, then the betrayal will hurt even more.
This might seem counterintuitive, but sometimes the best Epic NPC isn't epic at all, but just a collection of ordinary folk. If your campaign originates in a specific village or town, especially one full of colorful, memorable NPCs with personal ties to the party, then the collective needs and will of that settlement can become a questgiver NPC in its own right. The town is suffering from an unnatural drought? Send the party to seek out aid or a magical cure. The town is displaced following an invasion? Keeping the town safe and finding them a new home becomes a priority. This can also become a source of individualized side quests for the PCs; they're likely to be far more concerned about seeking out the rare medicine required to save the orphan girl who the rogue took under wing than they are about exploring a random tomb for loot drops. Plus, if the PCs invest their time and effort into protecting the town, it can make for an amazing final battle when the townsfolk come to support the party in battle, armed with everything they can get their hands on, ready to die for their heroes (a.k.a. The 'Mass Effect' Effect).
I hope these provide some good inspiration for your campaign! Let me know if there's any tricks you've used on your campaigns that worked particularly well, or any that you think should be added.