Is there a way to Loop a Unit Variable?

staind25

TH.net Regular
Reaction score
7
I've never used the Loop actions before but I finally found a use for them, but noticed they're only for Integers. Integer variables won't work for my situation because I need to tie a variable to a specific UNIT, specifically, a unit being attacked. This variable has multiple arrays: one array for each player.

Anyways, I'm in the process of setting the variable to a specific array. The goal is...if array 0 is NOT empty, check array 1. If array 1 is NOT empty, check array 2...and so on, until it finds an empty array. I figure this COULD work in a loop...but got stuck with the whole integer thing. Is there a way around this?


Additional info:
The alternative to the loop is a very long list of if/then/else statements which I'd rather avoid if I can. I'd essentially have to have if/then/else/if/then/else 12 times...it'd be ridiculous and probably really slow for the machine to calculate.


Thanks much!
 

hunterrravyn

TH.net Regular
Reaction score
19
Depending on your situations
Trigger:
  • Trigger
    • Actions
      • Loop for whatever
        • Loop Actions:
          • set unit[For Loop Whatever] = Bla
 

staind25

TH.net Regular
Reaction score
7
Lol, I must be missing something REALLY obvious...the only Loop actions I see are:

Trigger:
  • For each (Integer A) from 1 to 10, do (Actions)
    • Loop - Actions


And other loops that REQUIRE integers...

Where did I miss that general "loop" that you have listed there?

I swear I've seen that before and now I can't find it...
 

hunterrravyn

TH.net Regular
Reaction score
19
No you didnt miss anything, i just was doing it "freehand" unless your talking about Loop for integer

But if you storeing them in an array you can use

set unit[For Loop Integer A] = Value
 

staind25

TH.net Regular
Reaction score
7
Ohhh I get it. Thank you very much! Apologies for my ignorance...this is the first time I've used these functions in the editor. I'm somewhat familiar with loops, etc. from a little bit of programming I've done, but I'm by no means an expert.
 

hunterrravyn

TH.net Regular
Reaction score
19
That's no problem, if your know programing and intrested in a new one for warcraft III, then Jass is it. There is plenty of tutorials around the web on the the helper and the hive.
 

staind25

TH.net Regular
Reaction score
7
Yeah I've considered learning JASS, but I'm not sure my WC3 "programming" days will be numerous enough to spend the time it takes to learn a programming language that, essentially, is only useful for WC3. In the fall of this year, I'm off to a university to study computer science...I doubt I'll still have time for this.

While I'm at it though...I haven't tested it yet, but I assume just doing Set (variable)[For loop integer A] = (unit) doesn't know to store something in an "empty" value like I want it...how do I accomplish this? Like I say, I need it so that one unit isn't overwriting another unit.

Thanks again. I wish I could give you like 100 rep, haha.
 
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