It’s an (annoying, to me) trope from some fantasy games. There are many threads on the Internet where people have tried to figure out where it came from. From having dipped into several of them in the past and a few just now, I think it may have been started by Warcraft II (computer game) and/or Warhammer (miniatures game and RPG), and from there made it into later editions of D&D and the above-mentioned games, and others.
In any case, the real (well… ok, my) answer is: they don’t almost always, or even often, speak in Scottish accents, except in certain not-so-great games that have been copying that aspect from each other for a while.