HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Countdown Timer Failing

05-01-2006, 08:53 PM#1
Karawasa
Here is the code:

Trigger:
Naga Dies
Collapse Events
Unit - A unit Dies
Collapse Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Unit-type of (Triggering unit)) Equal to Naga Crusher
(Unit-type of (Triggering unit)) Equal to Sea Revenant
(Unit-type of (Triggering unit)) Equal to Naga Witch
(Unit-type of (Triggering unit)) Equal to Sea Giant
((Triggering unit) is an illusion) Equal to False
Collapse Actions
Countdown Timer - Start Naga_Timer[(Player number of (Owner of (Triggering unit)))] as a One-shot timer that will expire in 30.00 seconds
Countdown Timer - Create a timer window for Naga_Timer[(Player number of (Owner of (Triggering unit)))] with title Respawn In:
Countdown Timer - Show (Last created timer window) for (Owner of (Dying unit))
Set Naga_Timer_Window[(Player number of (Owner of (Triggering unit)))] = (Last created timer window)
Game - Display to (All players) for 5.00 seconds the text: |c009B9B00A Naga ha...
Wait 30.00 game-time seconds
Countdown Timer - Destroy Naga_Timer_Window[(Player number of (Owner of (Triggering unit)))]
Hero - Instantly revive (Triggering unit) at ((Owner of (Triggering unit)) start location), Show revival graphics

The problem is that when the window comes up, there are no numbers within the window. Thus, you don't get to see Naga_Timer. The hero does revive and the window is destroyed properly though. I haven't tested it multiplayer so I don't know if everything is in working order for that. Please look it over and help me out.

I have tried setting player number owner of triggering unit before hand too, and it doesn't work. It should be noted that when Naga_Timer is not an array, it works fine. Problem is, when another unit dies it is restarted :(. So I need the array :(.
05-01-2006, 09:00 PM#2
Captain Griffen
Side point - you need to hide the timer window for all, then show it for a specific player. Its default is shown to all.

Can't think what the problem might be.
05-01-2006, 09:20 PM#3
Karawasa
Well I decided that all players should see the timer so they know when the person is coming back.

But anyway, same problem :(.
05-01-2006, 09:32 PM#4
Vuen
Try starting the timer after creating the window for it. If that doesn't work, try destroying the timer and recreating it instead of re-using it.
05-01-2006, 09:34 PM#5
Karawasa
It doesn't even work the first time though so recreating it won't matter. I will try starting timer after creating window for it though.

Edit: That fails as well :(.

Important: After more testing I now know that, it works whenever a Naga owned by Player 1 dies. It starts the timer properly. However, when a naga dies that is owned by an enemy of Red, say Gray, it creates the window but no timer.
05-01-2006, 11:44 PM#6
Darthfett
As I said on the other site...

Quote:
Originally Posted by Darthfett
It could be that the timer window is right, but the timer window's array isn't the right size. Make sure it's set to the number of players, and that you didn't accidentally leave it at 1.

Just in-case you check this site first.
05-01-2006, 11:49 PM#7
Karawasa
HAHA, smart man. Mucho rep!

I have two variables. Timer_Window and Timer. Timer_Window array size should be number of players, what about Timer? Should that be as well?
05-02-2006, 02:01 AM#8
Vuen
All that does is it initializes extra timers; the array is already big enough to hold the references. If recreating the timers each time as I mentioned above didn't fix the problem, then that won't fix it either.
05-02-2006, 03:15 AM#9
emjlr3
array size does nothing, ive never set an array size and have never had a problem with it
05-02-2006, 09:23 AM#10
iNfraNe
Err, yes setting array sizes does something. Like when you have a group array and you want to add a unit to a group in the array, this requires the group to have been created. Same stuff with timers, if you dont create the timer (by setting the array length, blizzard will automaticly create it for you) you cannot start it, since the function doesnt create a timer for you:
Collapse JASS:
function StartTimerBJ takes timer t, boolean periodic, real timeout returns timer
    set bj_lastStartedTimer = t
    call TimerStart(t, timeout, periodic, null)
    return bj_lastStartedTimer
endfunction
05-02-2006, 01:24 PM#11
Soultaker
The reason why the numbers are not showing at the timer might be because you haven't setted the Timers in the Timer Array to other timers. You would have to do like this in your Intialization Trigger for that to work.
Code:
Actions
    Set Timer_Array[1] = Timer01
    Set Timer_Array[2] = Timer02

If you just use a normal timer array, then all the timers except the first one will not be shown (maybe not created.. dunno)

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.

Hope you fix your problem :)

- Soultaker

Edit: Edited it to make more sense.
05-02-2006, 02:04 PM#12
vile
Wtf soultaker, what you said has nothing to do with this thread..
05-02-2006, 02:30 PM#13
Soultaker
Quote:
Originally Posted by vile
Wtf soultaker, what you said has nothing to do with this thread..

Eh, it does have something to do with this thread.. The reason that the numbers are not showing is properly because he hasn't set the "Naga_Timer"[1], [2], ... to other timers.

But gotta admit that I didn't write it very clear what my point was. I'll edit that now :)

Btw. Isn't "(Triggering unit)" a global variable? Which you then shouldn't use after a wait action. Might just be me..

- Soultaker
05-02-2006, 02:38 PM#14
iNfraNe
No triggering unit is local and the problem is fixed anyway.