There is an issue with The E's solution which is relatively minor here but in other circumstances you could have a problem. You've kind of tripped over it with the repeat count. The issue is that you can't guarantee a maximum amount of time for the game to actually find a valid cargo. If you have 4 items of cargo you should be able to pick one after 4 loops at most. The solution here however only picks one of the options at random and there is no reason why it can't simply keep picking the 3 destroyed cargoes and ignoring the one that is intact.
For that reason I'd use this version instead. Notice this is all one event. I included the spaces for clarity.
when-argument
-random-multiple-of
Cargo 1
Cargo 2
Cargo 3
Cargo 4
-true
-when
--is-destroyed-delay
---<argument>
---0
--invalidate-argument
-when
--and
---has-arrived-delay
----Freighter
----0
---not
----is-destroyed-delay
-----<argument>
-----0
--add-goal
---Freighter
---ai-dock
---<argument>
---cargo dockpoint
---cargo dockpoint
---89
--invalidate-all-arguments
Unlike The E's solution (which it's heavily based on) this version only requires 4 repeats. Which means that after 4 * repeat delay you are guaranteed to have either picked something or had the event failed to find a cargo.
Trigger count and repeat count are another common point of confusion. Trigger count will alone do everything you need.
Trigger count says: 'This is the number of times the event can become true. It will become incomplete (and ready to trigger) again after it has become true.' Think of it as a semi-automatic gun; you're determining how many bullets there are in the clip but the trigger still needs to be pulled each time.
Repeat count says: 'Once the event becomes true, repeat its effects this number of times, at this fixed interval.' Think of it as a burst fire weapon that will fire X number of times each time the trigger is pulled once.
You're close but not quite correct. Both of them become incomplete and ready to trigger again. What is different between then is WHEN they will trigger again.
Repeat Count = Wait until the delay is over than then test again immediately. Then wait again. Do not trigger during the waiting time.
Trigger Count = Wait until the delay is over than then test again immediately. Then test every frame same as a normal event.
Both = Wait until the delay is over than then test again immediately. Then wait again. Do not trigger during the waiting time. If you run out of repeats, stop testing. If the event triggers a number of times equal to the trigger count, stop testing.
It's a small enough difference that with a 1 second delay most people don't notice that they aren't doing the same thing. Make the delay 10-20 seconds and use something like the Distance SEXPs as the trigger and you will very quickly see exactly how they differ.
Both counts actually have the correct name. The Repeat count is the number of times the game will
test to see if an event has happened again before it will stop testing. The Trigger count is the number of times that
test can actually come true before the game will stop testing.