waits in for loops?

Beast

New Member
Reaction score
5
How exactly does it execute them, because it seems to do it weird. Basically I'm just making a trigger that is a for loop from 1 to 10 and moves a unit backward a little then waits .5 seconds or so. What happens is it moves the whole way(10x the distance since the loop executes 10 times) then just waits after for .5 seconds instead of waiting .5 seconds after each time the loop runs if that makes sense. Is this just how it functions and is there a clever way to get around this?
 

Cidzero

Imma firin mah lazer!!!1!1
Reaction score
39
wait what?...

All I caught on to that is you have a wait trigger and a for loop that runs 10 times...

Are you asking how to get it to wait each time the loop runs? if so, then just put the wait inside the for loop...
 

Beast

New Member
Reaction score
5
wait what?...

All I caught on to that is you have a wait trigger and a for loop that runs 10 times...

Are you asking how to get it to wait each time the loop runs? if so, then just put the wait inside the for loop...

Thats how I have it, but it doesn't wait for each time the loop runs for some reason, it executes it all 10 times then waits after the 10, seems really weird just thought it might be a qwerk with the worldedit.
 

Somatic

You can change this now in User CP.
Reaction score
84
-Edit- Your problem is you need to put the
Code:
Wait 0.5 Seconds
inside the loop like this :
Code:
For every Interger A from 1 to 10
<Do actions>
Wait 0.5 second


to do sliding effects, use a timer, Using a Wait no matter how low u set it, it will still be 0.24 second.

An alternate method :

Use a trigger with this event
Code:
Event : Every 0.02 second of game time.

This will make a better slide or using of timers

Code:
Event : Slide_Timer Expires

For methods of doing this, search for "Sliding Tutorials"
 

Beast

New Member
Reaction score
5
Well it doesn't really seem to work, for example if i put...

For 1 to 10000
wait 1 second

it just waits 1 second, when it should wait 10000 right?
 

Somatic

You can change this now in User CP.
Reaction score
84
post your trigger, there might be a mistake in there. Wrap it with a Code tag too =)
 

Terrabull

Veteran Member (Done that)
Reaction score
38
Using a Wait no matter how low u set it, it will still be 0.24 second.

This information is false, please don't spread misinformation. Waits at low intervals have unreliable timings, but it is not capped at any certain time.
 

Somatic

You can change this now in User CP.
Reaction score
84
-Terrabull-
I'm very sorry but thats true.

Please read this tutorial for an example of a sliding spell.

http://www.thehelper.net/forums/showthread.php?t=22135

and a quote from it is this

Waiting 0.20 seconds will give us time to start the effect withouth getting disturbed by dummy spells casting time which makes us unable to touch our casting unit. However you cannot wait less then 0.2 seconds with wait function which is the reason that we use 2 triggers for this spell.
 

Beast

New Member
Reaction score
5
Heres the code, when it runs it takes .2 seconds (approx) to go from making the flight height go up to make it go down. If I take the loop out entirely and replace it with wait 2 seconds then it looks right(except the unit doesn't move backwards).
Code:
Catapult
    Events
        Unit - A unit Is attacked
    Conditions
        (Unit-type of (Attacking unit)) Equal to Catapult
    Actions
        Unit - Add Storm Crow Form to (Triggering unit)
        Unit - Remove Storm Crow Form from (Triggering unit)
        Unit - Turn collision for (Triggering unit) Off
        Unit - Pause (Triggering unit)
        Animation - Change (Triggering unit) flying height to 600.00 at 300.00
        For each (Integer A) from 1 to 10, do (Actions)
            Loop - Actions
                Unit - Move (Triggering unit) instantly to ((Position of (Triggering unit)) offset by (-50.00, 0.00))
                Wait 0.20 seconds
        Animation - Change (Triggering unit) flying height to 0.00 at 300.00
        For each (Integer A) from 1 to 10, do (Actions)
            Loop - Actions
                Unit - Move (Triggering unit) instantly to ((Position of (Triggering unit)) offset by (-50.00, 0.00))
                Wait 0.20 seconds
        Unit - Unpause (Triggering unit)
        Unit - Turn collision for (Triggering unit) On
        Unit - Order (Triggering unit) to Move To (Center of EndZone[((Player number of (Owner of (Triggering unit))) - 7)])
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> I'm very sorry but that's true.

No, it's not. And now please stop posting that crap. Thank you.



Moving units like this is not a very good idea.
As the height depends on the terrain, every time you move it, the game will recalculate the elevation, which somewhat breaks the flying height change...

I'd suggest having a look at one of the many "jump" spells we have in the spells section.
 

Beast

New Member
Reaction score
5
> I'm very sorry but that's true.

No, it's not. And now please stop posting that crap. Thank you.



Moving units like this is not a very good idea.
As the height depends on the terrain, every time you move it, the game will recalculate the elevation, which somewhat breaks the flying height change...

I'd suggest having a look at one of the many "jump" spells we have in the spells section.

terrain won't be a problem as everything is flat. Also I just wanna keep it simple it can look a little jerky as long as it works right(which it doesn't).
 

Somatic

You can change this now in User CP.
Reaction score
84
-Acehart-

There is a new breakthrought? Is there any information regarding about setting wait time to low values? Thanks if there are any. Sorry fot eh mistake =X

-Beast-

That looked right... But i'm not sure what could be wrong. The wait is at the right place... The unit does slide or it just instantly moved?
 

Beast

New Member
Reaction score
5
-Acehart-

There is a new breakthrought? Is there any information regarding about setting wait time to low values? Thanks if there are any. Sorry fot eh mistake =X

-Beast-

That looked right... But i'm not sure what could be wrong. The wait is at the right place... The unit does slide or it just instantly moved?

It moves twice(1 for each loop). I tried it in a blank map(just something like for 1 to 50 display integer A wait 1 second and it works fine so I guess it should work. Not exactly sure why mine doesnt =(.
 

Beast

New Member
Reaction score
5
Code:
Catapult
    Events
        Unit - A unit Is attacked
    Conditions
        (Unit-type of (Attacking unit)) Equal to Catapult
    Actions
        Unit - Add Storm Crow Form to (Triggering unit)
        Unit - Remove Storm Crow Form from (Triggering unit)
        Unit - Turn collision for (Triggering unit) Off
        Unit - Pause (Triggering unit)
        Animation - Change (Triggering unit) flying height to 600.00 at 300.00
[B]        For each (Integer A) from 1 to 1000, do (Actions)
            Loop - Actions
                Wait 1.00 seconds[/B]
        Animation - Change (Triggering unit) flying height to 0.00 at 300.00
        Unit - Unpause (Triggering unit)
        Unit - Turn collision for (Triggering unit) On
        Unit - Order (Triggering unit) to Move To (Center of EndZone[((Player number of (Owner of (Triggering unit))) - 7)])

I just ran that and the unit came back to the ground unpaused and regained his collision after 1 second, its really weird.
 

vypur85

Hibernate
Reaction score
803
Code:
        For each [B](Integer A)[/B] from 1 to 1000, do (Actions)
            Loop - Actions
                Wait 1.00 seconds

It will wait 1000 seconds, providing that the Integer A is not interrupted. Try using a custom integer instead of the standard Integer A.

Code:
        For each [B]CustomVariable[/B] from 1 to 1000, do (Actions)
            Loop - Actions
                Game - Display to allplayers (CustomVariable) <-- Use this to check whether it's running or not
                Wait 1.00 seconds
This should work. But it may not be MUI in multiple casts. So try casting only once and see.
 

Beast

New Member
Reaction score
5
Haha I tried something like what you said he it just confused me more, but maybe this will help one of you. Heres what I ran

Code:
Catapult
    Events
        Unit - A unit Is attacked
    Conditions
        (Unit-type of (Attacking unit)) Equal to Catapult
    Actions
        Unit - Add Storm Crow Form to (Triggering unit)
        Unit - Remove Storm Crow Form from (Triggering unit)
        Unit - Turn collision for (Triggering unit) Off
        Unit - Pause (Triggering unit)
        Animation - Change (Triggering unit) flying height to 600.00 at 300.00
        For each (Integer A) from 1 to 1000, do (Actions)
            Loop - Actions
                Wait 1.00 seconds
                Game - Display to (All players) the text: (String((Integer A)))
        Animation - Change (Triggering unit) flying height to 0.00 at 300.00
        Unit - Unpause (Triggering unit)
        Unit - Turn collision for (Triggering unit) On
        Unit - Order (Triggering unit) to Move To (Center of EndZone[((Player number of (Owner of (Triggering unit))) - 7)])

when the trigger executed it worked fine up till the loop, then it displayed only the number 6, then did the rest of the trigger. Seems really random I have no idea whats happening.
 

Beast

New Member
Reaction score
5
OHHHHHHHH, I get it now. I tried it with a custom variable like you said and it works fine. I'm thinking there some other trigger that has a loop thats changing the value of integer A which this trigger is still executing. Meaning that even integer A and B are not locals! At least I'm pretty sure thats what it is.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top