If you assign units to spawn in a region, you can put that region anywhere, like under a building for example, so it will give the effect that the unit is spawning from the building, or you can trigger the units to spawn at a position of a unit, such as a building. As for the changing units, you need to a spawn trigger for each unit type, and all of them turned off except the one spawning the initial unit typ. When you research, you'd have to turn off the current spawn trigger and turn on another.
Trigger examples:Event: Every ??? seconds of game time
Action: UNit-create a (unit-type) for (player) at Region-center of region (x)
-or-
Action Unit-create a (unit-type) for (player) at Unit-position of (unit)
Research:
Action: player finishes research
Condition: Player- triggering player is equal to (player) red?
Action: Turn off "red's footman spawn tigger"
Turn on "red's knight spawn trigger" (just example)
-VGsatomi