Ok so to answer your question
Firstly I think it needs to be said that I don’t go around terrorising animals, over many many years of travelling into and camping in the bush across Southern and Eastern Africa, you tend to encounter things and learn how to overcome them.
Across Africa, Baboons are a nuisance because humans have allowed them to see our habitats (temporary or permanent) as sources of free food.
Secondly, there are always exceptions especially in wildlife, that said:
Baboons generally are diurnal, at around sunset they’ll head up to a place of safety and nest /bed down for the night. they are hunted by nocturnal predators - Leopards & Owls so seek a place of refuge where they are safe from these.
Whilst wild camping on the doring river we had a troop at Gifberg extensively active during the day that definitely took to the cliffs at night and were no bother at all.
Baboons are intelligent and learn - As Antiquated says in Farming areas Baboons learn the sound of the vehicle that comes along with a bunch of blokes in the back shooting at them and scatter rapidly.
They can tell the difference between men children and women and (in the wild, non habituated or Capetonian baboons) will not hesitate at charging females or children (up to about 15) but will shy away from men.
They also learn exceptionally quickly that catapults (slingshots) are to be avoided and will scatter at the twanging sound.
Putting your food in sealed containers inside your tent will be the best source of safety from baboons and hyena’s.
Genets are incredibly curious and between them and Civets Ive had many a scare getting into my tent when Ive not zipped it up. Now I always zip up a tent if its not zipped up theres a bloody Genet in there.
Understanding the Baboon troop structure is useful, they have a strong hierarchy, with one Alpha male, he won’t back down to most things, and has a point to prove, so don’t challenge the big dog. Rather “challenge” a lesser huge male baboon, who will back down and then the whole troop moves off.
Baboons require the use of Binocular vision for survival, they need the depth perception to effect escape through the tree canopy or cliff face. You will not see a baboon with one injured eye, its essentially a death sentence, so they are super protective over their eyesight. If you shoot a small stone at them with a catapult, you won’t cause anything more than a stinging sensation with a body hit, but they understand the consequence of an eye shot and run immediately.
If you pull out a massive wooden mallet, or even a Panga, they won’t see this as a significant threat in the same way they will a slingshot! (Ive tried all of the above)
There is always a spotter - one sitting at the highest point on a cliff face or in the tree tops, their eyes just above the tree canopy keeping a look out - a well placed stone at that one and they will all scatter.
Lastly Baboons use sex (nonconsensual) to establish hierarchy within the troop. I stood naked outside my tent one hot “glorious” morning, and learned that Baboons have small willies and I don’t think liked the idea of us asserting our dominance on them sexually.
Bottom line you should have many more concerns about many other things before concerns about baboons at night you’re very very unlikely to come across a baboon at night