: Here's a tutorial that explains how to swap resources in data. You should be able to figure out a solution for you with this.
It can also be done in triggers, but I think data would be better. For triggers you'd want to use a "pick each unit in unit group" to pick all the unit type of the structure you want. You probably want to specify that it isn't under construction. Then underneath that loop you'd use "Modify player property".