As blackhornet mentioned, you have problems with the 'wait'. Personaly i hate the use of 'wait'.
But that is not all.
Using globals for variables that have to be reset is also cumbersome. Use locals, and trust that they will be reset.
Not that i exactly know when you want to reset them. And that is because you use 'loopindex' in a nested loop. The repeat also sets the system expression 'loopindex'. So, which 'loopindex' do you want to use ? That one from the 'for' or that one from the 'repeat'. You have to name your loops, so you can use 'loopindex("name").
For the same reason i have no idea (and so does the system) which loopindex is used in setting the bullet angle.
Back to the 'wait'.
The main problem with the 'wait' is this: You give a variable a value. Then you postpone the action that is gonna use it. But before it can be used, you give it a new value. And the previous value is lost.
You actual have to store the states of that variable until they are used. Then they can be lost.
Say, i have 4 kinds of whine. I give you a bucket. Now i fill your bucket whit whine, and tell you to bring it to a client in 5 minutes. Then i empty your bucket. Pour in another whine, and tell you to bring it to another client in 5 minutes. How you gonna manage that? You can not serve the first client no more.
You will ask me for more buckets.
More buckets stand for a variable that can hold many values. And that is in fact an array. Or: An array is 1 variable that can hold more then 1 value on places that can be addressed with an index. (bucket 1,bucket 2, bucket 3 ......)
Again. Not that i know what you precisly want. But here is an example that should teach you how to make exactly what you want.
https://drive.google.com/open?id=0B1SSu ... XByNTY2UXc