Help with destroy a building, turn an enemy into your ally trigger

I am working on my own campaign in AoE2: DE, and I want to have a starter enemy who joins your side when you destroy its barracks, but I don’t know how to work that out. Any help?