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).
 
waits should work... waits are a bit tricky in WE...
 
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.
 
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
 
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.
 
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.
 
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?
 
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.
 
^^ 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?
 
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.
 
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.
 
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
 
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 The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top