Jonah Hil talks about his friend and frequent costar Leonardo DiCaprio, who has a penchant for pranking him
Credit: Todd Williamson/Invision for Hennessy/AP

Leonardo DiCaprio has more to offer than just hilarious pranks.

Jonah Hill gave a shout-out to his Wolf of Wall Street costar and close pal during an appearance at The New York Times‘ TimesTalks series on Thursday, sitting down alongside actor Miles Teller and director Todd Phillips to promote their upcoming film War Dogs.

In the film, which is based on a true story, Hill and Teller play young international arms dealers who secure a government contract to supply weapons for U.S. troops in Afghanistan.

Hill, 32, said DiCaprio gave him advice on how to play characters that are based on real-life people.

Leonardo DiCaprio, he gave me advice: Always meet them if you can and take what you want and leave what you don’t,” he told the audience at The New York Times panel. “I really think it’s great if you can for that reason.”

And when DiCaprio isn’t handing out pearls of wisdom, he’s dishing out hilarious pranks. DiCaprio, 41, recently scared his close friend ‘sh–less’ when running up to Hill on the street pretending to be a crazed fan taking pictures. “It was just funny I was totally taken off-guard!” Hill told Entertainment Tonight on the red carpet of the premiere of War Dogs Wednesday night.

While Hill appreciated DiCaprio’s advice, he wasn’t able to apply it in War Dogs. His character’s real-life counterpart, Efraim Diveroli, was serving a prison sentence on a fraud and conspiracy conviction, so Hill wasn’t about to meet him before filming. But in the end, it might not have made a difference because this film was made for Hill – literally.

“We wrote the movie for Jonah. When I read the article [the movie is based on], and read about Efraim, I really thought, “Oh man, Jonah Hill could just kill this part,’ ” said director Told Phillips.

But it turns out, Hill almost wasn’t in the film. “Even when we went to him with this story, he said no at first,” Phillips revealed. “We kind of worked on the script, went back to Jonah, he said yes.”

RELATED: Leonardo DiCaprio’s Changing Looks!

And that wasn’t the first time Hill has rejected Phillips. “We offered Jonah a part in The Hangover and he turned us down. And that’s fine, no hard feelings, we moved on,” he revealed. “He probably doesn’t remember but I can tell you…do you remember?” he asked, to which Hill responded, “No.”

“It was oddly enough Zach [Galifianakis”]’s part but we had originally written that part as the younger brother that they took on the bachelor party, not the older brother, and then we switched it to the older brother and it was Zach,” Phillips explained.

But it all worked at in the end, because, as Hill said, “[Zach] was brilliant.”

War Dogs hits theaters Aug. 19.