Learn your scales and your chords. Between the two, anything is possible. As Repner said, if you start teaching yourself music by simply listening to it, you'll begin to grab an ear for specific notes and can then go on to work with harmonies and various melodies. Also, when Repner says it's easier to write at night; He's not kidding. The night hours seem to be people's peak of creativity, things just flow more naturally. And if you're covering a lot of songs with ease, try to break the songs down - Learn what the guitarists from the bands are creating their music from; what chords, what scales. Take each riff note by note and examine it deeper than the surface.
And when all else fails - Just jam! Play anything and everything, find a riff that sounds good to you, write it down and go from there! A simple riff can be turned into something insanely technical, or it can be broken into multiple sections. Either way, just one riff can sprout an entire song.
"i once killed an antelope, you should come over for dinner"