Would this make sense?

trb92

Throwing science at the wall to see what sticks
Reaction score
142
No, that's not how you declare arrays. To do what you want, you would type this out.

JASS:
local unit array TehUnit
local integer i = 0
loop
exitwhen i>6
set TehUnit<i> = GetTriggerUnit()
endloop</i>


Since in Jass arrays start at 0, this will set it to index 0, 1, 2, 3, 4, 5, which is still 6 array indexes set to GetTriggerUnit() (Whyever you want this, that's how you'd do it).
 

PurgeandFire

zxcvmkgdfg
Reaction score
508
You don't have to put the array index size.

You can just have:
JASS:
    local unit array TehUnit


If you want...

Just make sure you don't declare your variables directly.

I suggest you read Daelin's tut, it explains a lot of basics needed to know.
 

Joker(Div)

Always Here..
Reaction score
86
Why do you need 6 variables for GetTriggerUnit() Anyway? The native will always return the same unit. Giving it 6 instances is pointless.
 

PurgeandFire

zxcvmkgdfg
Reaction score
508
Why do you need 6 variables for GetTriggerUnit() Anyway? The native will always return the same unit. Giving it 6 instances is pointless.

I think he just wanted to clarify how to use and create local array variables.

So he used that as an example.
 

SFilip

Gone but not forgotten
Reaction score
634
> You don't have to put the array index size.
To be more precise - you mustn't, otherwise it's a syntax error. Jass arrays don't have a size.
 

trb92

Throwing science at the wall to see what sticks
Reaction score
142
> You don't have to put the array index size.
To be more precise - you mustn't, otherwise it's a syntax error. Jass arrays don't have a size.

Oh, well... My mistake, never actually used a local array, thought I knew how to though.
 

Insane!

Shh I didn't edit this, go away.
Reaction score
122
Ohh sorry???

EDIT
JASS:
local integer i = 0


sorry for me being a noob, but does this set it to zero?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top