1- Set a goal for your character
2- Place challenges in your character's way which will test your character in some way
3- Make sure these challenges are slightly above your character's current skills and abilities
4- Do not set a challenge without also providing a means for your character to overcome it
5- Let your character make mistakes
6- When your character achieves a goal, give them a new one to keep the story moving forward
Now some more in-depth discussion, using The Legend of Zelda: Ocarina of Time as an example.
1- Set a goal for your character. In Ocarina, Link's first goal is to go meet with the Great Deku Tree. It's as simple as that. Link finds the Great Deku Tree dying and imploring Link for help. So Link enters the tree and clears the dungeon.
2- Place challenges in your character's way which will test your character in some way. This is two-fold. Before Link can reach the Great Deku Tree, he's blocked by a fellow forest-dweller who will not let him pass. Not until Link obtains a shield and a sword, since there are strange creatures showing up in the forest. Once inside the tree, Link faces irritating enemies and a dungeon boss. These latter two challenges all stand in Link's way of helping cleanse the tree of the evil that is killing it.
3- Make sure these challenges are slightly above your character's current skills and abilities. Link's sword isn't quite as good a blade as one would hope. Thus it takes a few strikes to defeat any enemy inside the tree. The dungeon boss is a challenge to defeat but not impossible. It's not likely you'll die fighting this boss even with only three hearts of life.
4- Do not set a challenge without also providing a means for your character to overcome it. Let's take two of the challenges Link faces in the course of this first dungeon: obtain a sword and shield and defeat the dungeon boss. In the case of the former, Link can find a sword hidden in a treasure chest within the forest. There's also a shop in the forest where he can buy a shield and plenty of in-game currency just floating around for the grabbing inside the forest. To defeat the dungeon boss, Link is presented with the opportunity to find a slingshot inside the dungeon. This not only helps him get to the boss chamber, but also to defeat the boss.
5- Let your character make mistakes. Now, if you're like me when you're playing a video game you go straight for a walkthrough somewhere to help you get everything and die the least number of times possible. There are no mistakes made this way. Don't give your character a hand-holding guide. But do leave breadcrumbs they can find and follow in order to get where they need to be. Also, let your character regress because of their mistakes. It'll make them stronger. To go with an example in Ocarina, we'll jump ahead in the game. At a certain point, Link basically hibernates for seven years, growing into an adult. Now he has five temples to clear of evil. In one of them, the sub-boss is Dark Link. Basically a shadow version of Link. It represents the evil side of Link, the evil he's capable of. Thus, fighting him becomes a fight against Link's own mistakes, and haunted past.
6- When your character achieves a goal, give them a new one to keep the story moving forward. Link's first goal in the game is to go see the Great Deku Tree. That done, he's tasked with saving the tree. When he clears the dungeon, and learns the tree is dying anyway, he's given the Kokiri Emerald and told to go to the castle and find the princess. She's got a part in this whole thing to play and Link and Zelda need to meet up. Zelda tells Link to find the remaining spiritual stones (two of them). That done, you wake up seven years later and learn you have to go wake up the remaining five sages to save the land of Hyrule. Every goal completed along the way opens a new goal for Link to accomplish, all of them leading to the ultimate goal of saving Hyrule.