Do waits not work in for loops?

Squishinator

New Member
Reaction score
3
I have gotten them to work only sometimes, and if i cant do it then please explain any other way to gradually increase exp(not including an every x seconds trigger).
 

jig7c

Stop reading me...-statement
Reaction score
123
waits should work... waits are a bit tricky in WE...
 

the_ideal

user title
Reaction score
61
Just use periodic event.
Code:
    Events
        Time - Every 2.00 seconds of game time
    Conditions
    Actions
        Hero - Add 10 experience to (the hero), Hide level-up graphics

And when you want the xp not to add, turn the trigger off.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
well, i think that loops only works with waits under 1 sec or so

so to make it gradually increase exp, you need what the_ideal just posted
 

Tom Jones

N/A
Reaction score
437
Waits works fine with loops, however a problem can arise if you have many loops. The editor uses the same variable to iterate through loop, for example integer a, and if you have a loop with waits that uses this variable, and another loop without waits which also uses that variable is executed, the loop with the wait will mess up because integer a has been used as iterator in the loop without wait.
 

Squishinator

New Member
Reaction score
3
Just use periodic event.
Code:
    Events
        Time - Every 2.00 seconds of game time
    Conditions
    Actions
        Hero - Add 10 experience to (the hero), Hide level-up graphics

And when you want the xp not to add, turn the trigger off.

i tried that, but it never turned off. I did turn trigger on, wait 1 second, turn trigger off and it didnt turn off....

Also, i dont understand the for each integer a, b, whatever part of the loop and how they make a difference.
 

jig7c

Stop reading me...-statement
Reaction score
123
Waits works fine with loops, however a problem can arise if you have many loops. The editor uses the same variable to iterate through loop, for example integer a, and if you have a loop with waits that uses this variable, and another loop without waits which also uses that variable is executed, the loop with the wait will mess up because integer a has been used as iterator in the loop without wait.

how does someone go about fixing this mess Tom?
 

elmstfreddie

The Finglonger
Reaction score
203
how does someone go about fixing this mess Tom?

JASS, using local integers for your loops, or using custom variables in GUI.

but when you use custom variables in GUI, you have to give it an array and check which arrays aren't being used and it becomes yucky.
 

WilliamPa

Active Member
Reaction score
51
^^ i understood everything he said, two waiting loops with same integer cannot run at once.

Yes, it becames real tricky if you don't use JASS, but how about adding a private integer variable for the trigger?
 

Danis[h]

New Member
Reaction score
19
JASS, using local integers for your loops, or using custom variables in GUI.

but when you use custom variables in GUI, you have to give it an array and check which arrays aren't being used and it becomes yucky.

why would you use an array for it?

say, if you run a loop with an integer variable called x, it would run the first time and x would be =1
then the second time it runs x would be 2 and so forth..

Now if you use an array, you would use x[1], and the first time it runs x[1] = 1
and the second time it runs x[1] = 2 and so forth... So there wouldnt be any difference what-so-ever?...

Just make an integer variable for each of your loops. It isn't that hard to manage.
 

elmstfreddie

The Finglonger
Reaction score
203
The integer is the one that is changed to measure the loop, so if it didn't have an array it'd do the same thing Integer A does with a different name.

So, the first time the loop is ran, x[1] = 1, then 2, then 3, then 4, etc.
And whenever the next time it's ran, x[2] = 1, then 2, then 3, then 4,
that way x[1] can be equal to 5 while x[2] can be equal to 7, no interference.
 

elmstfreddie

The Finglonger
Reaction score
203
Different global variables.
It's like an integer variable called Integer A, and an integer variable called Integer B.
They apparently decided making two globals is more convenient than using locals hahaha :p
 

Light Alkmst

New Member
Reaction score
20
It's just 2 different variables to limited nesting.

Code:
loop a
     loop b
          put the exp gain per hero here if using array
          otherwise, nested loops won't be a good way to go
     endloop b
     wait goes here
endloop a
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top