- Joined
- Jan 16, 2009
- Messages
- 716
You would imagine that when you create a group and add units to it, they will be enumerated (using the ForGroup function) in the order they were added. This is true in most cases but not in all as I have found.
I have a situation where by adding a unit to a group, it will not be added at the end of the stack but at a random place, even sometimes taking the first place. And it is really random, because it will be different each time the map is launched and it seems to have no pattern what so ever.
The code basically looks like that :
This is will display two different ids in my case.
Nothing fancy is happening. I am just adding an unit to a group. It will even happen when there is only one unit in the group and I add another to it.
The really strange thing is that it seems to be only happening in this function. I guess it must be coming from another part of the function but I can't see how anything would have an impact on the group in such a way.
So this is why I came to you after long hours of searching for a solution by myself. Maybe someone has encountered something similar and have found a solution ?
I have a situation where by adding a unit to a group, it will not be added at the end of the stack but at a random place, even sometimes taking the first place. And it is really random, because it will be different each time the map is launched and it seems to have no pattern what so ever.
The code basically looks like that :
JASS:
set v = FirstOfGroup(g)
call GroupAddUnit(g,u)
call BJDebugMsg(I2S(GetHandleId(v)))
call BJDebugMsg(I2S(GetHandleId(FirstOfGroup(g))))
This is will display two different ids in my case.
Nothing fancy is happening. I am just adding an unit to a group. It will even happen when there is only one unit in the group and I add another to it.
The really strange thing is that it seems to be only happening in this function. I guess it must be coming from another part of the function but I can't see how anything would have an impact on the group in such a way.
So this is why I came to you after long hours of searching for a solution by myself. Maybe someone has encountered something similar and have found a solution ?