its really complicated but here is how it works:
get your gen 3 cartridge an put it in a ds. then go to pal park after seeing all 150 Pokemon in dp national dex. reset your game and select "migrate from sapphire". make sure the Pokemon you wanna transfer dont have a hm move. so you get park balls which is like master ball but you can only use it in pal park. catch the Pokemons you wanna get and lets move on:
in gen 5, first beat the game. go to route 15 and head west. go to the transfer lab. you need another ds with your gen 4 game of choice. go to download play with wireless connection. and you have to do a minigame using a slingshot. catch the Pokemon you want in the time and your good to go. onto the final step.
put black, white, black 2 or white 2 in your 3ds. Get pokebank and get the 30 day free trial or 1 year for $6. put all the Pokemon you want to transfer in box 1 and then save and quit. put in your gen 7 game an put the Pokemon in the box on the bottom screen. you dont need gen 6 for this method.
or just watch these videos: