• 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.

Making a Constant Array

Status
Not open for further replies.
Level 10
Joined
Jun 6, 2007
Messages
392
EDIT: sorry, wrong board, this was meant to be in warcraft help zone.



Hello!

I have lots of different heroes and abilities on my map. My goal is to make certain heroes to learn certain abilities at certain levels, so I thought it might be a good idea to store unit types and level-ability pairs into an array of some kind. The ideal structure is like this:

Code:
unit type 1 |level 1, ability 1
            |level 2, ability 2
            |     ...
-------------------------------
unit type 2 |level 3, ability 3
            |level 4, ability 4
            |level 5, ability 5
            |      ...
-------------------------------
...         |

So basically any number of ability-level pairs can be linked to a unit type, and all these <unit type>-<level-ability pair list> pairs are listed in an array. This would be easier in vJASS since it has structs, but I prefer using the original world editor. So, should I use hashtable for this or is there a better solution?
 
Last edited:

Br0

Br0

Level 4
Joined
May 4, 2012
Messages
102
You mean something like this? ;

Actions
Set unit[1] = Rifleman
Set abil[1] = Abolish Magic
Set abil[2] = Aerial Shackles
Set abil[3] = Aura of Blight
-------- --------
Set unit[2] = Footman
Set abil[4] = Barrage
-------- --------

You could combine those with integer arrays to make it for each different unit/hero at a certain level to learn the certain ability.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
I cannot seem to get it working. It keeps throwing me "syntax errors" so I guess it is not supported.

The syntax should be somewhat like this.
static int[] testarr = {0, 1, 2, 3};

However it does not like the field argument so I guess they are not supported as well in Galaxy.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
I cannot seem to get it working. It keeps throwing me "syntax errors" so I guess it is not supported.

The syntax should be somewhat like this.
static int[] testarr = {0, 1, 2, 3};

However it does not like the field argument so I guess they are not supported as well in Galaxy.

galaxy does not support constant arrays and you dont need to write them in galaxy to find out

just go to the script editor, make a new variable, click constant, and the array field will gray out
 
Status
Not open for further replies.
Top