#2
Just prat around with a few notes or powerchords until you find something, there isn't really any set method of doing it.
#3
...



I'm not sure anyone can really 'teach' you how to write a guitar riff?

Listen to and learn the sort of riffs you enjoy, then look at similarities between them, and just play around on your guitar, keeping in mind what you like about them. And after a while you will probably come up with something you like.
#4
you can't learn other than with time
i spend hours just messing around with the guitar
but the standard is just a few bar chords and a note fill inbetween and repeat
just try and make it as catchy as possible
#5
Make sure while you're trying to write this riff, listen to exactly what you're playing, and follow up with the note you want to, not where your finger automatically goes. Hear the riff before you play it, or your riff will sound dead and the phrasing will be terrible.
#7
Quote by bainsy911
so theres no theroy in writing music



No there's quite a lot - more than one answer could ever give.
You could use some basic theory - pick a key, a scale, write a basic chord progression, build a melody over that. But you can't just learn theory and expect to be able to write, it's more about creativity. (That said theory is very helpful in writing, as it gives you good direction in where to take a song).
The best way to write an interesting riff is often through improvisation, riffs don't just write themselves.