• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[General] Help to make 3 columns of integer

Status
Not open for further replies.
Imo Nichilus gave the "correct" solution.

Other solutions include:
  • There is also the classic of "flattening" the multi dimentional array to one dimension with the power of math.
    • for 2D: y * Y_SIZE + x
    • for 3D: z * Y_SIZE * X_SIZE + y * Y_SIZE + x
  • Having one array per column
  • Using some lua or jass construction that basically does what Nichilus said.
 
Just for the sake of adding another option, you can use integer-to-string/string-to-integer alongside concatenate strings to reference sections of that integer/string. E.G.
  • Set integerA = (Random integer number between 1 and 10)
  • Set integerB = (Integer(((String(integerA)) + (String((Level of (Triggering unit)))))))
  • Item - Create ItemType[integerB] at (Position of (Triggering unit))
  • Set ItemDropCount[integerB] = ItemDropCount[integerB] + 1

I've done this before for using a unit's "Point Value" in the object editor to assign a bunch of extra data, though in this example it won't work if units can drop more than 10 items and units can be over level 10 since a level 11 unit dropping item 1 and a level 1 unit dropping item 11 would both return 111.
 
Status
Not open for further replies.
Back
Top