HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

timer arrays

12-08-2002, 11:57 PM#1
Unindel
do they even work? i probably should have tested to see if they do, but, thinking they would, i went ahead and made a whole map around them. and then i go to test, nothing is working. so, i started disabling one thinga fter another, and then said what the hell, and just tried out somethin like:

start timer[0] as a one-shot timer that will expire in 5.00 seconds

and then a trigger with
event: timer[0] expires

action: display text to all users: sdfhsdfhsdjkfhsk

and nothing is wokring. can anyone please help me???
12-09-2002, 12:11 AM#2
Mr.123
It works. If you don't want to go into custom text, then you'll need a timer variable for each element of the array. Kind of defeats the purpose. Blame blizzard for this oversight.

timer[0] = timer0
timer[1] = timer1
timer[2] = timer2
...
timer[n] = timern

If you don't mind custom text, you can do this:

loop
exit when i > 10
set udg_SpeedBoostTimerArray[i] = CreateTimer()
set i = i + 1
endloop

That's roughly the syntax. Just make a loop in the trigger and convert into custom text. Manually put in CreateTimer().
12-09-2002, 12:13 AM#3
Electromancer
What kinda array is it? I didnt find a countdown variable, so im not sure about it, i might be able to help if you tell me that much. But for now why dont you just make a few timers, it seems easier for one shot timers, and you could always do a run trigger not checking conditions trigger if you wanted it to use it multiple times. Just look into things other than arrays.
12-09-2002, 03:59 AM#4
Unindel
well, ok, heres what im tryin to do:

i have a trigger that everytime a unit uses an object, a unit of type "bomb" thats based on the militia is made at the point of the unit. now when this bomb is created its stored in a unit array, so:
bomb[0]=first bomb
bomb[1]=2nd bomb

i have an integer called bombcountup that goes up everytime bomb is made so taht the next one is stored.

then i have a timer array called bombcountdown. what i do is in the trigger that makes the bomb (shortened)

create bomb at position of (hero manipulating item)
set bomb[bombcountup]=last created unit
start bombcountdown[bombcountup] as a one-shot timer that will expire in 5 seconds.
set bombcountup = bombcountup + 1

ok, and then in a seperate trigger, what im TRYING to do, but i sorta doubt it would work:

event: bombcountdown[TriggerExecutionCount(This Trigger)] expires

action:
unit - explode bomb[TriggerExecutionCount(This Trigger)]


Theres a lot more events, such as things like calculating spread of bomb, activating doodads to show fire, and exploding units in the way, but thats in essence what i want, the rest i can fix.

I'm not afraid to go into custom text, since i'm already in there with the 2nd trigger, (thats just the gui representation of what i have).

Edit: The reason I posted about the timer[0] thing is just to ask if i was just being stupid and somehow missed something with getting timer arrays to work directly. I decided to make a seperate trigger like that to see if it worked at all directly, and it didn't.
12-09-2002, 11:23 PM#5
Mr.123
Not sure why you're still not able to get timers to work correctly. Dig up my warcart map from the map downloads section. I have 8 timers in an array called SpeedBoostTimers or something like that. The timers work in that map.
12-10-2002, 01:17 AM#6
Unindel
cant find it, whats it called?
12-10-2002, 08:09 PM#7
Guest
How do I implent custom text (what program?)?
12-10-2002, 08:57 PM#8
Jeltz
warcrft III world edit :ggani: The trigger editor can convert triggers to custom text.
12-10-2002, 11:41 PM#9
Mr.123
Unindel:

Search for 'Warcart'. It's from a few months back.
12-11-2002, 04:38 AM#10
Unindel
k, found it, thanks. question though, does the event call have to be in the same trigger that has the create timer? ie, you have the "set udg_SpeedBoostTtimerArray[1] = CreateTimer()" in same trigger as "call TriggerRegisterTimerExpireEventBJ( gg_trg_Speed_Boost_End, udg_SpeedBoostTimerArray[1] )"

does it have to be this way?
12-11-2002, 05:39 AM#11
Unindel
function Trig_Set_up_Timer_Arrays_Actions takes nothing returns nothing
local integer j = 0
local integer i = 0
loop
exitwhen j > 1000
set udg_testing[j] = CreateTimer()
set j = j + 1
endloop

loop
exitwhen i > 1000
call TriggerRegisterTimerExpireEventBJ( gg_trg_TestingArray, udg_testing[i] )
set i = i + 1
endloop
endfunction

that isn't working, any idea why?
12-11-2002, 05:40 AM#12
Unindel
was workin a bit ago, but then i changed somethin and i cant remember what, and now its not.
12-11-2002, 06:17 PM#13
BoddoZerg
Hmm, I didnt' know you could actually make arrays of timers. Thanks a lot for this thread, timer arrays will be incredibly useful for what I am doing.
12-11-2002, 09:51 PM#14
Unindel
np, timer arrays are really useful!

mr.123> if you can't tell from that trigger what im doing wrong, could I send you the map and maybe you look at it?
12-12-2002, 02:05 AM#15
Mr.123
I have this feeling that War3 doesn't like 1000 timers but doesn't warn you about it. It just silently ignores them...

Try with a lower number, like 5 or 10. I really don't have much time nowadays to help debug :(. Work/commute took almost 14 hrs today....argggggg.
timer arrays - Wc3C.net