HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Clearing Timer windows

03-09-2004, 12:34 PM#1
Whitehorn
I've tried, god knows I've tried, but if two people have got timers running (hero restoration countdowns), only 1 gets cleared, and eventualy the top of the screen gets filled with blank timers... Obviously something is stopping them form clearing when more than 1 is present, but I've set each trigger to specify each player's timer and window with array variables.

The restoration works.
The hero timer appears, deisplays the correct time, sounts down and restores the hero.
But... as I said if there's multiple timer windows, they dont disapear.

Code:
Then - Actions
    Set restorecount[(Player number of (Owner of (Dying unit)))] = (restorecount[(Player number of (Owner of (Dying unit)))] + (Hero level of (Dying unit)))
    Countdown Timer - Start Timer[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in (Real(restorecount[(Player number of (Owner of (Dying unit)))])) seconds
    Countdown Timer - Create a timer window for Timer[(Player number of (Owner of (Dying unit)))] with title (Name of (Owner of (Dying unit)))
    Wait (Real(restorecount[(Player number of (Owner of (Dying unit)))])) seconds
    Countdown Timer - Destroy TimerWindow[(Player number of (Owner of (Dying unit)))]
    Camera - Apply North Spawn  <gen> for (Owner of (Triggering unit)) over 0.00 seconds
    Hero - Instantly revive (Dying unit) at (Center of HQ North  <gen>), Show revival graphics
03-09-2004, 01:46 PM#2
RaeVanMorlock
I'm getting so tired of saying this...

Quote:
Anytime you use the wait statement, you create the possibility for a variable to be over-written. In other words, variables (including event variables) aren't defined to the trigger that uses them.

Also, why would you even use a wait statement when you can detect the destruction of the timer?

If you still need help, I'll post the code later.
03-09-2004, 02:21 PM#3
Kamux
You can split it up in two triggers and delete the wait. On the second trigger just add the event: a timer expires.
03-09-2004, 03:11 PM#4
Whitehorn
Aye, I figured it out..

Code:
Kill Timer
    Events
        Unit - A unit Begins reviving
    Conditions
    Actions
        Set TimerWindow[(Player number of (Triggering player))] = (Last created timer window)
        Countdown Timer - Destroy (Last created timer window)