What’s the purpose?

Sometimes I have some strange nightmares. I used to think that maybe it was some telltale sign about my psychology or outlook on life or a premonition of what was to come. But I noticed I always woke up from my nightmares either too hot or needing to pee. So now I just think that I’m waking up because I’m either too hot or I need to pee. Nightmares are just the mechanism my body uses to wake me up. It helped me to ask, “What’s the purpose of a nightmare?”  

I also noticed that my nightmares are even stranger when I eat foods with MSG in them, or once when I took an anti-malarial medicine (Lariam, mefloquine) that mentioned possible side effects of nightmares.