[General] Help to make 3 columns of integer

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.
 
Level 11
Joined
Nov 15, 2007
Messages
800
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.
 
Top