Knowing the person, at least vaugly, and having some sort of connection(school, work, ect) definately helps. Talking to them also does, asssuming you can summon the courage to even speak. BUt really if you have such a problem with talking to people in real life you could try explaining at first that your shy so its hard for you to talk at first sometimes. Heck at least it would give you soemthing to talk about. Hey I do it and thats how come I am able to talk to some people(I'm not always shy but it happens). Besides that you should just be yourself. I mean if you have a good personality then people will just naturally take to you usually. If you have a bad personality..well people will take to you still but normally they end up having bad personallitys too...