You can keep track of how many of each unit the building has spawned by setting the custom values on the source building.....
You can then on the spawned units set the custom value on them to reference the source building.. so that when they die you know which building spawned them so that you can que up a replacement unit.
custom values hold "reals" so you need some kind of Unit array... when you create a new source building you add this building to the UnitArray of source buildings..... stop the building index in this array to lets say custom value 0 of its self.
then when the building spawns a unit... it stores custom value 0 of the source unit to custom value 0 of the spawned unit....
custom value 1 of the source unit can be... how many heros it has currently spawned.. custom value 2 of the source unit can be how many marines it has spawned.
since your trying to do a bit more then just spawn units and forgot ... doing this through triggers makes more sense to me..
@elitegoliath: Go
You can keep track of how many of each unit the building has spawned by setting the custom values on the source building.....
You can then on the spawned units set the custom value on them to reference the source building.. so that when they die you know which building spawned them so that you can que up a replacement unit.
custom values hold "reals" so you need some kind of Unit array... when you create a new source building you add this building to the UnitArray of source buildings..... stop the building index in this array to lets say custom value 0 of its self. then when the building spawns a unit... it stores custom value 0 of the source unit to custom value 0 of the spawned unit....
custom value 1 of the source unit can be... how many heros it has currently spawned.. custom value 2 of the source unit can be how many marines it has spawned.
since your trying to do a bit more then just spawn units and forgot ... doing this through triggers makes more sense to me..