AIWaveSetType(w, c_waveStateRetreat, AIWaveTargetGatherO(player, c_townMain))
I've tried the above with no avail

, it seems like when a unit/unitgroup its planning to merge with a specific wave, it is somewhat designated a wave with specific integer/index attached to it (example: 14#0, 15#0, 16#0, 7#0 and etc...), completely random @_@. I'm not certain of this, but when you try to merge the main wave with the attack wave, the units that are on their journey will be displaced from its original main wave and placed in some temporary wave or something

.
I can solve the problem by manually attaching these units to the wave, but that is not my objective. So, any help would very much be appreciated XD. Thanks SuXue, for helping

.