The film concerns the selection of a new abbot for the Three Treasures Temple. The temple's current abbot invites three esteemed men to help him choose his successor: the worldly Esquire Wen, the fearsome General Wang, and the lay Buddhist master Wu Wai. However, Wen and Wang have arrived with agendas of their own; both men hope to pilfer the temple's copy of a priceless sutra, and have brought along cronies to help them do so. Esquire Wen is accompanied by the master thief White Fox (who is posing as Wen's concubine) and her accomplice Gold Lock. General Wang, on the other hand, is accompanied by his fearsome lieutenant. The plot is complicated by the arrival of Chiu Ming, a penitent who was sent to the temple as punishment after being framed for a crime by the lieutenant. Chiu Ming is soon entrusted by the current abbot with guarding the sutra.