• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Array Variables?

Status
Not open for further replies.
Level 6
Joined
Oct 4, 2011
Messages
226
Hi I enjoy making abilities and items and such, but I dont know how to do some things. Such as making spells leak proof aswell as bug proof. I do use a couple custom script codes to remove points and stuff I need to learn how to use array variables also. So if anyone can help me, then thanks. :ogre_hurrhurr:
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Hi I enjoy making abilities and items and such, but I dont know how to do some things. Such as making spells leak proof aswell as bug proof. I do use a couple custom script codes to remove points and stuff I need to learn how to use array variables also. So if anyone can help me, then thanks. :ogre_hurrhurr:

An array variable is basically a variable with an index. You can see each index as a new variable.

So instead of creating two variables such as:

Variable1
Variable2

You simply create 1 variable with an array such as:
Variable[1]
Variable[2]

You can then loop through the index or do any other kind of mathematics with the index.
It's really simple.
 
Level 4
Joined
Aug 5, 2011
Messages
99
to fill up the variables use set variable action...
  • arrays
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set anIntegerArray[1] = 50
      • Set anIntegerArray[2] = 3
      • Set anIntegerArray[3] = 64
then to loop throught em, simple use a for loop using the for loop integer variable as an index.

  • loop
    • Events
      • Player - Player 1 (Red) types a chat message containing test as An exact match
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: (String(anIntegerArray[(Integer A)]))
also, you can change the size of the array when u create it.
 
Level 6
Joined
Oct 4, 2011
Messages
226
Nah not for temporary locations. But thanks. I'm learning array's for GUI abilities. I will try your test method also helekiller. + rep. +rep hashije also thanks for reassuring my hypothesis.
 
Status
Not open for further replies.
Top