the major scale is 1(root) -w- 2nd -w- 3rd -h- 4th -w- 5th -w- 6th -w- 7th -h- Root Octave and repeat scale. Interval wise 'W' = whole step and 'H' = half step. A whole step on the guitar is 2 frets--fret 5 to 7, 6 to 8, 7 to 9...0 to 2 etc... A half step is = to 1 fret so 5 to 6, 7 to 8, 0 to 1...etc.
When you want a specific harmony you just need to make sure the notes you harmonize with are at a specific interval. For example, you can do a major 3rd harmony and play one set of notes say G - D - B of the G major chord and harmonize them all with major third intervals for a melodic sound, using notes C - G - E. The most common harmonies are major and mior 3rds i believe. From what i have seen anyhow. You can hear is alot in modern melodic metal.
Minor and major third intervals occur naturally in any key so you can build chords diatonically--within the scale. For example in the key of G major/E minor you can create G, Am, Bm, C, D, Em, and Fdim from the intervals in the scale you can create harmonies based on the stacked 3rds that these chords are made from. Major chords are built by the Root - 3rd - 5th, whereas minor chords are constructed with the Root - b3rd - 5th. Take E minor, it consists of E - G - B the first two notes are the root and the minor 3rd (1 1/2 steps down or up from the root) in unison playing E with G you get a minor third harmony. Very evil sounding. At the same time melodic. Then you can play D major and cut of the 5th again and leave root and the third together to create a major third harmony..Using notes D and F# of D major (D - F# - A) you get the happier sounding major 3rd sound. Continue doing this with all the chords in a key and you can write a simple melodic tune in no tme. or add some melody to your songs you already have.
I hope that helps, it was quite a lot to explain and i hope it's coherent.