That’s just one of the revelations to come out of the new documentaryRobin Williams: Come Inside My Mind,which airs on HBO on Tuesday night.

All talked about the impact Williams had on their lives, but it was Belushi who appeared to have the biggest affect on Williams himself.

Wally Fong/AP/REX/Shutterstock; Ron Galella, Ltd./WireImage

Robin-WIlliams-John-Belushi

The two were close friends during the wild days of late-1970s, partying at comedy clubs and Hollywood bashes galore. Both had a sea of momentum behind them. Belushi was riding the success ofAnimal HouseandSaturday Night Live, while Williams had finally emerged from the standup scene to score a breakout role on theHappy DaysspinoffMork & Mindy.

Cocaine was a constant for Williams. “Cocaine for me was a place to hide,” he told PEOPLE in 1988. “Most people get hyper on coke. It slowed me down.”

All that changed in March 5, 1982, when Belushi was found dead at the Chateau Marmont in Los Angeles. A lethal combination of cocaine and heroin was found in his system.

Wynn Miller/The LIFE Images Collection/Getty Images

robin-williams-comedy-2-1333x2000

Williams wouldn’t learn about Belushi’s death until he was back on set atMork & Mindy.Dawber had to break the news to him.

Freaked out, they left the set together. “We just walked together toward our trailers and, just before he went into his trailer, I said, ‘If that ever happens to you, I will find you and kill you first,’ ” Dawber recalled telling Williams. “And he said, ‘Dawbs, that’s never gonna happen to me.’ ”

Soon thereafter, Williams got clean. “Here’s this guy who’s a beast, who could do anything, and he’s gone,” Williams said, in archival audio pulled for the documentary. “That sobered the sh-t out of me.”

Mork & Mindydirector Howard Storm noticed a difference. “He backed off for a while, he cleaned up,” Storm said in the film.

Dan Steinberg/Invision/AP

Robin Williams

RELATED VIDEO: Robin William’s Daughter Zelda on Healing—and Battling Online Trolls

After the cancellation ofMork & Mindya few months later, Williams and first wife, Valerie, moved away from the L.A. party scene to Northern California. She was pregnant with Zak at the time.

He’d remain sober for nearly 20 years, relapsing on the set of 2005’sThe Big White.He said in the documentary: “I started drinking a tiny little bottle of Jack Daniels, like the ones you get on an airplane. Then a week later I was hiding a big bottle of Jack Daniels.”

In 2006,Williams went to rehab. He wasback there nearly a decade later, in July 2014 — just a month before his death. Williams died after suffering fromLewy Body Dementia, a type of brain disease that affected his thinking, memory and movement control. It’s the second-most common type of progressive dementia after Alzheimer’s disease.

source: people.com