In all actions of scire facias, or prohibition, the plaintiff recovering judgment after an answer was filed, or a motion directed to the complaint, shall recover his or her costs of the action. If the action is voluntarily dismissed by the plaintiff or is dismissed for want of prosecution or judgment is entered against the plaintiff, the defendant shall recover his or her costs.
735 ILCS 5/5-114