I can think of a few:
1. Forces the MSM to cover the story that Stormy's suit was dismissed and that she must pay Trump's legal costs.
2. Baits the MSM into resurrecting the Stormy story and getting Avenatti more air time. Avenatti is a despised figure who ginned up the Swetnick story that alleged Kanvanaugh was a serial rapist. Many Dems blame him for the confirmation of Kavanaugh because he effectively linked the Ford story to the Swetnick outrageous, unbelievable story.
3. Goads Avenatti and Stormy into appealing the decision and thereby incurring more legal expenses. I wasn't aware of the case in Texas, but Trump could be setting them up on this one as well.
4. Distracts the MSM from the stock market decline and the midterms for a few days.
5. And it sends the message to any future Stormys contemplating legal action against Trump that it could cost them money. A deterrent.