I am trying to do arithmetic in an array index and it does not work. I'm assuming an index is an integer.
The array variable is a unit type if it matters and I'm trying to add 1 to an integer in the index of said array.
Any suggestions?
None.
Can you show the trigger and variables your doing it with so we have a better idea of what you mean?
None.
I have two global variables one is called unitArray[20] and is a unit type array.
The second one is unitArrayIndex and is an integer type.
The trigger is
Event - Any unit construction is completed
Local Variables - None
Conditions - None
Actions - Set unitArray[(unitArrayIndex + 1)] = (Triggering progress unit)
None.
Perhaps modifying a variable OUTSIDE of the array index (Lets call it ArrayIndex
), and then using that variable instead? Just a thought.
None.
What is the arry by default? if it 20 by default then it wont add anything because its already at its max.
I'll play around with this in GE and see what I come up with.
Edit: is unitArrayIndex an array?
Post has been edited 2 time(s), last time on May 3 2010, 8:22 pm by ZeroAme.
None.
Perhaps modifying a variable OUTSIDE of the array index (Lets call it ArrayIndex
), and then using that variable instead? Just a thought.
After playing around for awhile I eventually came up with this and it does work.
It's just odd that you can't do arithmetic in an array index.
What is the arry by default? if it 20 by default then it wont add anything because its already at its max.
I'll play around with this in GE and see what I come up with.
Edit: is unitArrayIndex an array?
unitArrayIndex is not an array and it's default is 0
The array is defaulted to a 20 slot array with 0 (assuming) in each slot.
Even though I solved my problem I would like to figure out why this does not work.
None.