How good of an artist are you? How well can you hear the idea in your head? How good are you at putting it on to the insturment? These are things you have to be good at to write good music, but most of all, how bad you want it? The bigger that fire is uder your seat the more those other things don't matter. Otherwise you can do it the robotic way, learning your key signatures first off, then learning scale degrees, then learning chord degrees, then learning cadences, dominate preporation, inversions, modulation, secondary domanints etx. which does not sound like fun to you and trust me it really sucked learning it. But take your pick I think if you want it bad enough you'll get good tunes out of your head and on to the fretboard. Good luck!