Tribe System
Inspired by the RTS game Totem Tribe, the Tribe System can be used to create buildings that house a certain number of units and retrain them whenever the old ones die. In this template we have Pig Farms that train a maximum of 3 Peons and Barracks that train a maximum of 5 Grunts. Units are free and take no food supply, but the building will not train more units than its limit. In the original game, if you had let's say 2 Barracks and 10 Grunts and 1 Barracks was destroyed, if a Grunt from the not destroyed Barracks died, instead of starting training a new grunt, it would assign one of the homeless grunts to its group, until there were no more homeless grunts, and then it would start training new grunts. Also newly created buildings would do the same if there were any matching homeless units. This is quite a pain to do, so instead I made it so when a building is killed all its units will become hostile (you can change this if you don't like my idea).