This script extends the troop event system with "end phase triggers". This is simply a final check on all of the event pages when a victory/lose condition has been met. Any pages that can be run during this end phase will be executed and may change the outcome of the battle.
This script is completely plug-and-play and requires no additional setup.
Basically, by combining these two scripts, you can have arbitrary page conditions. Now you can really run an event when "all enemies are dead" by simply writing