• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Count down timer triggers problem

Status
Not open for further replies.
Level 2
Joined
Jul 18, 2008
Messages
19
Hallo. I want to make a countdown timer to count down time until a hero is revived. I am using 1 trigger to start the timer, show it, and revive a each hero, and 1 to destroy a timer window. The problem is that when 1 hero dies just a few seconds after another, only one timer window is deleted when the timer expires, even after both heroes are revived. I use a trigger to set a timer window variable to last created window, and then destroy it, but it seams not working. Let me show you my Triggers. There are 2 Heroes.

Hero 01 Respawn:

Events:
-Unit - A unit owned by Player 1 (Red) Dies

Conditions:
-(Owner of (Dying unit)) Equal to Player 1 (Red)
-((Dying unit) is A Hero) Equal to True

Actions:
-Countdown Timer - Create a timer window for TimerHero01 with title Reviving in:
-Countdown Timer - Show TimerHeroWindow01 for Player 1 (Red)
-Countdown Timer - Hide TimerHeroWindow01 for Player 2 (Blue)
-Countdown Timer - Start TimerHero01 as a One-shot timer that will expire in 10.00 seconds
-Wait 10.00 seconds
-Hero - Instantly revive (Dying unit) at (Center of Region 003 <gen>), Show revival graphics


Hero 01 Timer Finish

Events:
-Time - TimerHero01 expires

Conditions:

Actions:
-Set TimerHeroWindow01 = (Last created timer window)
-Countdown Timer - Destroy (Last created timer window)


Hero 02 Respawn:

Events:
-Unit - A unit owned by Player 2 (Blue) Dies

Conditions:
-(Owner of (Dying unit)) Equal to Player 2 (Blue)
-((Dying unit) is A Hero) Equal to True

Actions:
-Countdown Timer - Create a timer window for TimerHero02 with title Reviving in:
-Countdown Timer - Show TimerHeroWindow02 for Player 2 (Blue)
-Countdown Timer - Hide TimerHeroWindow02 for Player 1 (Red)
-Countdown Timer - Start TimerHero02 as a One-shot timer that will expire in 10.00 seconds
-Wait 10.00 seconds
-Hero - Instantly revive (Dying unit) at (Center of Region 002 <gen>), Show revival graphics


Hero 02 Timer Finish

Events:
Time - TimerHero02 expires

Conditions:

Actions:
-Set TimerHeroWindow02 = (Last created timer window)
-Countdown Timer - Destroy (Last created timer window)

Variables Used:

TimerHero01
Type: Timer

TimerHero02
Type: Timer

TimerHeroWindow01
Type: Timer Window

TimerHeroWindow02
Type: Timer Window

I hope you understand my problem...

Edit: The problem is that only lastly created window is destroyed, like there is no:
-Set TimerHeroWindow01 = (Last created timer window) and,
-Set TimerHeroWindow02 = (Last created timer window) actions!
 
Level 22
Joined
Jan 10, 2005
Messages
3,426
It's because of your Timer Finish triggers.

The ''Set TimerHeroWindow01 = (Last created timer window)'' action should be in your Respawn trigger, right after you create the timer.

Your Timer Finish trigger doesn't recognize the right ''Last created timer window'', because a timer hasn't been created in that trigger.

And change the ''Last created timer window'' in ''Countdown Timer - Destroy (Last created timer window)'' to a variable of the timer (a variable you set in the Respawn trigger).
 
Level 2
Joined
Jul 18, 2008
Messages
19
I am sorry, I allready fixed all my problems with that. Somehow it works. I placed -Set TimerHeroWindow02 = (Last created timer window) after -Countdown Timer - Create a timer window for TimerHero02 with title Reviving in:, and deleted the one after, an somehow it works. (I have done that for other hero too). And can you explain me how to use that trigger Tags 'cause I'm a noob.
 
Status
Not open for further replies.
Top