In a move that is both shrewd and a bit cynical, the final installment of the “Night at the Museum” series takes place (mostly) in London. The first two “Museum” films earned $560 million in worldwide box office, so the move makes financial sense as well as creative sense, since it gives the writers a chance to try new things. This turns out to be a smart move on all fronts, as “Night at the Museum: Secret of the Tomb” is easily the best of the bunch. The scripts have gotten progressively smarter, and director Shawn Levy executes a couple of stunning visual sequences the likes of which the “Museum” series has never seen.

Larry Daley (Ben Stiller), night guard at the New York Museum of Natural History, is about to pull off a mind-blowing presentation with the help of his magically re-animated friends, but they start to behave erratically and cause a panic. He eventually discovers that the tablet of Ahkmenrah (Rami Malek) is running out of power, and the only person who knows how to restore its power is his father Merenkahre (Sir Ben Kingsley), of whom there is a figure in the London Museum of Natural History. Larry pulls some strings to get both him and his son Nick (Skyler Gisondo) transferred to London to solve the problem, and they get a bunch of unexpected help along the way. Now they just need to get past every wax figure in the London museum, who have awoken for the first time and have no idea how this whole thing works.

There was a long stretch where the plot of nearly every Ben Stiller movie was, “Let’s point and laugh at the silly nebbish Jew.” (“There’s Something About Mary,” “Along Came Polly,” the Focker movies). Those were dark, dark days. One of the great things about “Secret of the Tomb” is that the joke is rarely at Stiller’s expense. Rather, Stiller’s character gets the respect that he so richly deserves, and it’s up to someone else to suffer the indignity of, say, getting peed on by a monkey. Even better, Stiller is getting better material with which to show off his pitch-perfect deadpan delivery. The film as a whole is still merely decent, but the bar has definitely been raised here.

Shawn Levy raises his game here as well. He stages a sequence inside of a painting that looks like an a-ha video in the best imaginable way. (If anything, a-ha’s main director Steve Barron probably wishes he had thought to do what Levy does here.) There is a sameness to the story structure, sure, but everything is simply done better this time around. Perhaps the most curious thing about “Secret of the Tomb” are the multiple comments by a certain character that suggest that he plays for the other team. It is never revealed whether or not he does (nor does it matter), but bonus points for even bringing the conversation to the table. They don’t handle it in the genius manner that “ParaNorman” does, but it’s nonetheless a step in a better direction.

The “Night at the Museum” movies are a bit of an anomaly, to the point where they probably make the cast and crew of other family-friendly franchises a little jealous. They don’t seem to be at all beholden to any kind of pressure to release a film by a certain date, after which they stand to lose a large chunk of their audience. If anything, these movies appear to be made whenever the hell Ben Stiller feels like making one. If that is indeed the case, then “Night at the Museum: Secret of the Tomb” is one hell of an argument for taking the time to get it right, rather than rushing to get to theaters first.

Finally, we’d be remiss if we didn’t mention one last thing…

Fare thee well, Robin Williams. You will be missed more than you can possibly know.