Most Voting Sessions or Hero Selections have a Timer to show the players how much time they have left, but it's purely cosmetic. While the actual work is done by the Wait trigger.
Anyways, I've come up with this design for a voting system, and I've got everything but the Timer working.
Thing is, I have absolutely positively no idea how to make one of these things...
I tried Start Timer - One Shot - etc etc.... I'd just like to know the basic code, could anyone enlighten me please?
You've already mentioned exactly how its done; a wait trigger. Most of the time an actual timer is not needed, its just an thread definition with a loop, a set dialog text action, and a 1 sec wait. Thats all it is to it and then you can also put the game setup actions rights after since its better not to have a whole bunch of extra triggers with events whenever you can avoid it.
He could also start a one shot time and have a while loop run with the condition that the timer is running, that sets the dialog items text to the remaining time of the timer.
this would be better because then he could trigger the other trigger at the end of the timer. also if he changes the length of time later on he only has to change one thing.
I really actually thought there was a separate Timer trigger, didn't even think of putting Wait and Set Text etc together...
I'm guessing those Timers they have in City of Tempest and Hero Attack are the same, but they just play a sound effect from SC2 with each passing second.
No, no, and no. Why on earth would you want to use 3 entire triggers with events for something that can fit in one single thread including everything after. The thing is with a loop too is if you use a while loop then you can set the time to change dynamicly with a global variable without every having to touch the entire setup. Using timers again means your adding extra shit like a seperate timer window, additional dialogs, or yet another trigger to keep track of the time ontop of what is needed simply because its noob friendly.
wtf fuck would he need 3 triggers. That's just bad coding if that is how you think of having to use timers.
What he would do is call the timer as a one shot for however long he needs it, and then just run a while loop, while the timer has greater that 0.0 secs left, that would update the dialog item text to the time left on the trigger. This means all he needs to change to change time length or mess with other things, is change the amount of time it's called for.
Yes while loops are nice, but with timers you can do real time, which means when he sets it up, he doesn't have to account for game speed (ex:45 secs of real time, takes 84 game time secs on faster). It's a much better way of doing it. And then he just has the event of the trigger he's calling after this one, be timer expires.
I usually like to disagree with willuwontu, but you're wrong. You can achieve having a timer in one thread. I assume that you think timers require a window and more dialogs but timers don't even require visuals if you wanted to. Just that Start Timer thingy.
By the way, willu, do you really think constant while loops do not cause a performance drop for being... constant...
Rollback Post to RevisionRollBack
Member since 2010. Made the -The Thing- [Revival] game. Nostalgic of the WC3 days.
Please reread what written as the timers that willuwontu suggests need at least two triggers; a trigger where its originally started, and a whole other one for when it ends. Even willuwontu says and i quote "And then he just has the event of the trigger he's calling after this one" ; that's again is more than 1, as both you said and I stated is all thats needed.
And no he is yet again mistaken, waits work for both real AND game speed that can be set it up for however you like.
If you actually read the original op, he is asking for its use in a dialog not just to keep time; yes i know i doesn't have to be shown but that's what is being asked so quit providing excuses irrelevant to whats acutally needed.
The sad part is that even willuwontu says you would need a while loop after starting the timer, while in reality you need JUST that while loop without the extra timer crap. Yes your right, his while loop will lag if he doesn't add in a wait, which yet again is the only think EVER needed to make this a proper threaded timer and since you never need to check/update faster than the fastest change in time IE every second.
Most Voting Sessions or Hero Selections have a Timer to show the players how much time they have left, but it's purely cosmetic. While the actual work is done by the Wait trigger.
Anyways, I've come up with this design for a voting system, and I've got everything but the Timer working. Thing is, I have absolutely positively no idea how to make one of these things... I tried Start Timer - One Shot - etc etc.... I'd just like to know the basic code, could anyone enlighten me please?
You've already mentioned exactly how its done; a wait trigger. Most of the time an actual timer is not needed, its just an thread definition with a loop, a set dialog text action, and a 1 sec wait. Thats all it is to it and then you can also put the game setup actions rights after since its better not to have a whole bunch of extra triggers with events whenever you can avoid it.
@hobbidude: Go
He could also start a one shot time and have a while loop run with the condition that the timer is running, that sets the dialog items text to the remaining time of the timer.
this would be better because then he could trigger the other trigger at the end of the timer. also if he changes the length of time later on he only has to change one thing.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
I really actually thought there was a separate Timer trigger, didn't even think of putting Wait and Set Text etc together...
I'm guessing those Timers they have in City of Tempest and Hero Attack are the same, but they just play a sound effect from SC2 with each passing second.
Thanks guys!
@willuwontu: Go
No, no, and no. Why on earth would you want to use 3 entire triggers with events for something that can fit in one single thread including everything after. The thing is with a loop too is if you use a while loop then you can set the time to change dynamicly with a global variable without every having to touch the entire setup. Using timers again means your adding extra shit like a seperate timer window, additional dialogs, or yet another trigger to keep track of the time ontop of what is needed simply because its noob friendly.
This is what i use in my maps... hope it helps..
@hobbidude: Go
wtf fuck would he need 3 triggers. That's just bad coding if that is how you think of having to use timers.
What he would do is call the timer as a one shot for however long he needs it, and then just run a while loop, while the timer has greater that 0.0 secs left, that would update the dialog item text to the time left on the trigger. This means all he needs to change to change time length or mess with other things, is change the amount of time it's called for.
Yes while loops are nice, but with timers you can do real time, which means when he sets it up, he doesn't have to account for game speed (ex:45 secs of real time, takes 84 game time secs on faster). It's a much better way of doing it. And then he just has the event of the trigger he's calling after this one, be timer expires.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
@hobbidude: Go
I usually like to disagree with willuwontu, but you're wrong. You can achieve having a timer in one thread. I assume that you think timers require a window and more dialogs but timers don't even require visuals if you wanted to. Just that Start Timer thingy.
By the way, willu, do you really think constant while loops do not cause a performance drop for being... constant...
Member since 2010. Made the -The Thing- [Revival] game. Nostalgic of the WC3 days.
@Vicboy: Go
Please reread what written as the timers that willuwontu suggests need at least two triggers; a trigger where its originally started, and a whole other one for when it ends. Even willuwontu says and i quote "And then he just has the event of the trigger he's calling after this one" ; that's again is more than 1, as both you said and I stated is all thats needed.
And no he is yet again mistaken, waits work for both real AND game speed that can be set it up for however you like.
If you actually read the original op, he is asking for its use in a dialog not just to keep time; yes i know i doesn't have to be shown but that's what is being asked so quit providing excuses irrelevant to whats acutally needed.
The sad part is that even willuwontu says you would need a while loop after starting the timer, while in reality you need JUST that while loop without the extra timer crap. Yes your right, his while loop will lag if he doesn't add in a wait, which yet again is the only think EVER needed to make this a proper threaded timer and since you never need to check/update faster than the fastest change in time IE every second.