Why use == instead of =?
And what needs to be done to make the script run constantly (while the building is constructed), and not just once?
If you need to constantly replace archers with crossbowmen, just remove the break from line 32 of the script.