so arrays are a bit confusing and i think you're a bit confused on em
an array is like a group of individual variables
so imagine you have these variables item1, item2, item3 and they each have their own item
item1 = mana pot
item2 = health pot
item 3 = boots of speed
equivalently you could make an array called item
so
item[1] = mana pot
item[2] = health pot
item[3] = boots of speed
now instead of having 3 separate variables you have one array which stores everything
at first glance there's no difference between the two, but using arrays lets you do other things much easier (like the trigger youre trying to make)
- more on arrays:
in programming, an array is signified by the symbols [ # ]
where # is called an index
the index points to an element in the array
in programming, indexes start at 0 rather than 1... no particular reason, thats just how it works. on the otherhand, if you do everything starting at 1 it doesnt really make any difference
the number of elements in an array is called the arrays size... so for an array with 5 elements, it has a size of 5
so here's an example of a size 5 array with items (just an illustration, not physically accurate and not how to create the example)
items[#]
[ 0 1 2 3 4 ]
[mana health boots shield weapon]
so items[2] = boots
and
items[4] = weapon
etc
so in your trigger your setting one element of 1 array to be a bunch of different things
what happens is
ItemType[1] = sword of judgement
and then 3 seconds later
ItemType[1] = Potion of Mana
and then 3 seconds later its something else
in effect the array only stores one variable instead of all the variables
what it should be is:
ItemType[1] = ...
ItemType[2] = ...
etc
(you also don't need the wait times)
here's how i would do your trigger
first off fix storing your items in the array
then in the 2nd screen shot you posted
set Integer = [Random integer number between 1 and <the total number of items in your array>]
Item - Create ItemType[Integer] at (Position of (Dying Unit))
that's literally all you'll have to do