Sleep walking/talking happens when part of your brain – that should be resting – tell your body to start moving. Normally while you are asleep this is stopped, but sometimes factors can affect this – such as where you are sleeping, or conditions you body might have.
Curiously it only happens when you are not dreaming, in a stage known as non-rapid-eye-movement. This is why children sleepwalk/talk much more, as they spend more time in this stage of sleep
Sleepwalking can be inherited from your parents, although nobody is quite sure what causes this. Other factors include lack of sleep, fever, stress and drugs.
I have a friend you won’t stop sleeptalking…. nobody ever wants to sleep in the same room as him!