You can reduce the chance of this happening by clicking the left mouse button and holding it to direct your characters, rather than repeatedly clicking. Also, you should switch combat mode off in areas with a lot of friendly creatures (ie the imp village) or where you have mostly cleared an area but need to go back for something. Some people have even had their lead character stay in peace mode, preferring a couple second delay when encountering opponents to accidentally attacking a neutral creature. Personally, I quicksaved relatively frequently anyway, so it was easier to just reload. After a couple accidental attacks, though, I was a little more careful and didn't have to do much reloading.