| 12-14-2003, 09:14 AM | #1 |
Simple Question Is there a way to refer to all items in a "Item Type" Array If so, how? |
| 12-14-2003, 02:34 PM | #2 |
Use a loop to see if an Item is in an array. heres and example on it. Actions For each (Integer A) from 1 to 10, do (Actions) Loop - Actions Item - Create Item_type[(Integer A)] at (Center of (Playable map area)) Loops will repeat an action while rasing the (Integer A) +1 after each time untill it reaches it max 10 and then will exit its loop. |
| 12-14-2003, 02:58 PM | #3 |
It depends on WHAT and WHY your refering to the items in the array. And it also depends on whether the array will be a fixed size in the map or if it can change in size during play. If its a fixed size then its easy, and COOLer has the correct idea, but let me elaborate on it. For this trigger we will assume that there are 10 items in the array. ItemArray is the variable in this Trigger: Code:
Event
Unit picks up an item [color=red]Or what ever your event is...[/color]
Condition
Actions
Do loop for integer A from 1 - 10
If
Conditions
Item being manipulated is equal to ItemArray[integer a]
Then actions
[color=blue]Your actions here for if the item IS in the array[/color]
Skip remaing actions [color=red]This is to make it so the trigger doesn't keep running after it already found a match.[/color]
Else actions
Do Nothing
[color=blue]Your actions here for if the item is NOT in the array. [/color][color=red]You will note this is NOT in the loop, if it was then the actions listed here would run 9 different times.[/color]If the number of items in the array IS changing then you need a second variable, and integer variable, to keep track of how many are in the array and do the loop the same, but replace "10" with the variable... If the number of items in the array increases AND decreases, then it becomes a little more complicated. If this is the case then let me know and I will gladly show you what you will need in that case. |
| 12-14-2003, 04:11 PM | #4 |
I could not say it better my self . Arrays and loops come in really handy for parsing strings. |
| 12-14-2003, 08:35 PM | #5 |
Thanks guys :D No the array stays the same size thought the whole game, Thanks |
