| 05-02-2006, 12:33 PM | #1 |
I have a number of countdown timers in an array, and the number of possible timers at one time is 50+ something and I need to have a trigger with event - timer expires. Problem is the only event available (atleast in GUI) is specific timer expires which would require 50+ triggers... I could just place all the events in the same trigger, but then there isen't (again atleast not in GUI) any way of telling wich timer expired. |
| 05-02-2006, 01:12 PM | #2 |
You should also know that you can't use timer arrays unless you set the timer variable to a timer each. Fx. Trigger: Actions
![]() Set Timer_Array[1] = Timer01
![]() Set Timer_Array[2] = Timer02If you just use a normal timer array, then all the timers except the first one cannot be created. It will simply never start. Now, you can either use 12 diffrent timers and a timer array, or you could use an integer timer which you would set down every 1 sec. I use both systems in my maps, and they work fine. I like the integer system works best, simply because it's so easy to configure and use. Btw. You can set the interval at which it counts up/down after your own wish. - Soultaker Edited by Blade.dk. Reason: Trigger tags are good. |
| 05-02-2006, 01:59 PM | #3 |
Soultaker, thats just a long and frustrating way. There is a trick for this, just use this in the timer expiration function: JASS:
local timer t = GetExpiredTimer()
local integer i=0
loop
exitwhen t == udg_YourTimerArray[i] or i > 50
set i=i+1
endloop
then "t" is your corresponding timer. |
| 05-02-2006, 02:43 PM | #4 |
Thanks! But do i have to write timer expire events for all 50 timers aswell? If there's a better way i'd like to know. |
| 05-02-2006, 02:45 PM | #5 |
When you create your trigger, just loop the same way, adding an event for each timer. |
| 05-02-2006, 03:20 PM | #6 |
hmmm can you use locals in the inittrig function? It doesnt seem to like it... My JASS skills are not so good, so could u give an example of that last thing? |
| 05-02-2006, 03:26 PM | #7 |
You can definitely use locals in the InitTrig functions. You can also use bj_ForLoopAIndex if for some reason you don't like declaring locals. |
| 05-02-2006, 06:26 PM | #8 |
Make sure the locals are at the top of the function, and post what error it's giving you here if that doesn't help. |
