The first time the character of J.R. Ewing was shot on the television drama “Dallas” — on March 21, 1980 — his survival hinged on the outcome of salary negotiations with actor Larry Hagman.

This time J.R.’s fate is no surprise; it was sealed before viewers ever heard the two gunshots at the end of last week’s show. Hagman’s death Nov. 23, 2012 from complications of cancer meant the end of the manipulative oil baron played with the perfect mix of cunning and charm by Texas-born Hagman.

Reprising the “who shot J.R.” mystery seems like a fitting way for the iconic character to exit the show, but working out those details meant a challenge for the writers and technical staff. Hagman died after appearing in the fifth show of TNT’s second season of the rebooted series, yet J.R. showed up three times last week in episode six.

Executive producers Cynthia Cidre and Michael Robin explained how they did it during Paley Fest 2013, a live Q&A on Sunday streamed online featuring the two of them along with regular cast members of the show.

“Anything we could repurpose, reframe or flip the image,” Cidre said. The postproduction crew searched for any footage shot of Hagman that could be used to move the story forward. We watch Hagman as J.R. on the phone in a limo as he speaks to his son and later in a bar as he talks to his private investigator. His final scene had been shot in a bedroom at South Fork, but was digitally altered to look like the Mexican hotel where J.R. was staying.

“If only we had filmed Larry in the limo saying more generic things, we could use him for years,” Cidre joked.

Watch Hagman’s scenes in episode six and you’ll realize she’s right. J.R. says very little of substance; it’s the comments from John Ross or Bum, the private investigator, that mean anything.

Now viewers are wondering once again, “Who shot J.R.?” but Cidre and Robin promised the mystery would be solved in episode 15 before the end of the season, unlike in 1980 when the audience waited from March until November.

Patrick Duffy, who plays J.R.’s brother Bobby, already knows who did the evil deed. He said he had to find out in order to do his job. “I’m not a Method actor but I do need a little more information than ‘look sad, stunned, okay,'” he said during Paley Fest, referring to instructions on how to react to a letter from J.R.

“It’s probably the most brilliant piece of scriptwriting that I’ve read, whether it’s in this show or any other piece of television I’ve ever seen in the way that it resolves the problem with such dignity and respect and drama,” Duffy said about the resolution of the mystery. “I think every fan who has ever watched the show will think it’s the pinnacle of Dallas writing and plot.”

But before the killer can be revealed, J.R. will get the Texas-sized funeral he deserves. Monday’s episode, titled “J.R.’s Masterpiece,” promises to be a tearjerker as cast members and guest stars from the original series in the 1980s say goodbye to the villain we loved to hate. For the actors who were long-time friends, the tears they shed on the show may be genuine.

In some ways, it will be the third funeral for Hagman; his family held private services in both California and Texas for the actor after his death in November.

Blurring the lines of reality and fiction, March 11 has been declared Larry Hagman Day in Dallas — and Mayor Mike Rawlings, Cowboys owner Jerry Jones and Mavericks owner Mark Cuban play themselves in cameo appearances in tonight’s episode as they pay their respects to J.R.

Hagman was no J.R. in real life. He established the Larry Hagman Foundation with the slogan, “Evil does good,” that benefited underprivileged children and the arts.

He remained friends with co-stars Duffy and Linda Gray, who played his ex-wife Sue Ellen, after the original series ended May 3, 1991. During Paley Fest, Gray told of the deathbed scene in Hagman’s hospital room. His daughter sang the song, “I’ll Be Loving You…Always” to her father, who joined in. Two days after his death, Gray heard the song on the radio, and then again two days after that, even though it’s “an old song” she hadn’t heard since her grandmother’s time. “It took my breath away,” she said. “I’m like, ‘Larry, is that you?'”

Duffy lightened the moment by telling her, “He sings dirty limericks to me.”

Josh Henderson, who played John Ross and said he called Hagman, “Pop,” told of doing the scene where he’s on the phone with J.R. and hears the gunshots. It was after Hagman had died; things kept going wrong — noises would ruin take after take. “I knew it was Larry playing a joke like he did every single day,” he said.

Perhaps the bigger mystery than who shot J.R. will be whether the series can survive without Hagman. Duffy explained that the show continued after the death of actor Jim Davis, who played Jock Ewing, the father of J.R. and Bobby, during the original show’s third season. “Jock was pivotal,” Duffy said because the competition between J.R. and Bobby was due to their search for approval from their father.  Duffy believes that the influence from J.R. will continue on ‘Dallas’ even without the physical presence of Hagman.

Time, and ratings, will tell. But the torch from one generation to the next was passed last week when J.R. said to John Ross, “You shouldn’t have to pay for my sins. Just remember — I’m proud of you. You’re my son, from tip to tail.”