Nightmare

Nightmare is featured in The Sims 2, The Sims 3 and The Sims 4. The feature simulates real life nightmares while at sleep.

The Sims 2
In The Sims 2, Sims can have nightmares if players haven't been taking care of them. They will have nightmares if, they go to sleep when they are hungry, have to go to the bathroom, or are dirty, etc. They also have a much higher chance of having a nightmare if they passed out from exhaustion and the player made them wake up and go to bed. They can also have nightmares if they are in an aspiration desperation or are in the red. For example, if your Sim just witnessed a death or just lost their job, they will more than likely have a nightmare.

The Sims 3
In The Sims 3, if Generations is installed, it is also possible for child and teen Sims to have nightmares. If the player clicks on the sleeping child or teen, it will pop up an option of dreaming about a certain topic. Occasionally, when the player does this, a message will be given, informing that the dream has turned into a nightmare. When the Sim wakes up, they will gain a negative moodlet from the experience.

The Sims Medieval
Occasionally, sleeping Sims will receive a message describing a dream he/she is having. The player will then be required to select one of two options in which to handle the dream. Depending on the player's selection, the Sim may receive a "Nightmare" buff which subtracts ten Focus and lasts seven hours. If the player chose correctly, however, the Sim may receive positive buffs or even cash.

The Sims 4
Only toddlers have nightmares in The Sims 4, although children can wake up with an Uncomfortable moodlet due to a monster under a bed, which only Children can see. The player may wait this out, although if you want it to become less likely for a Child to do this again in the future, alternatively, you can make an adult "Spray the Monster Under The Bed". Unlike toddlers's nightmares, all sleeping Children on the lot will wake up as well as the Child who discovered the monster.

Trivia

 * Nightmares also exist in The Sims to some extent, as they tend to wake up if their motives are deep red.