Like DC said, scripts are the best way in this case.
I suggest using spawn scripts or inline like the method below with a dummy entity. This way, by using it in conjunction with other functions like spawn01, you can fully control many aspects of the spawns.
spawn GroupX
@script
void main()
{...