First of all, the condition in loops is wrong. If you are using a loop "For each (Integer A) from 0 to intConnecter", then you should reference the instances as "dorf[(Integer A)]". What you have right now checks repeatedly only the last instance (the last instance is dorf[intConnecter]).
Second, there is no need to use "wait" in the loop. Also, the "wait" action is never accurate, so the wait time actually differs each time it is used.
Third and most important, the "Else" part of If/Then/Else in your loops is wrong. What your loop does right now is that it checks each transport and if the conditions do not match, it indexes the transport into the dorf[] array (at least that's what I understand from the german trigger).
Now imagine this scenario: Your dorf[] array already contains 3 transports - for simplicity I will call them "Transport_1", "Transport_2" and "Transport_3". So basically your dorf[] array is filled like this: dorf[Transport_1, Transport_2, Transport_3, <other indices are null>].
Imagine a unit entering "Transport_2".
Your loop does this:
Is used transport == dorf[1]? Which can be translated into Is Transport_2 == Transport_1?
- no, it's not, so it creates new instance at the end. Now it continues
Is used transport == dorf[2]? Which is Is Transport_2 == Transport_2?
- In this case it is. So nothing happens bad happens. And last iteration
Is used transport == dorf[3]? Which is Is Transport_2 == Transport_3?
- Nope, create new instance.
What you should aim for should be "If transport isn't equal to any in the dorf[] array, then create a new instance". What you have now is "if transport isn't equal to a dorf[] array instance, then create new instance".
Bribe said:Use the event "Game - CargoEvent becomes Equal to 1.00" to detect when a unit is loaded into a transport. Use the event "Game - CargoEvent becomes Equal to 2.00" to detect when it is unloaded.
You also have "CargoTransportUnit[(Custom value of Unit)]" to get the unit who is carrying the unit, and "CargoTransportGroup[(Custom value of Transport)]" to pick all units that the transport is carrying.
I will try it thank you +repWhy not just use Bribe's GUI Unit Event?