• 🏆 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!

[Trigger] Help with a countdown timer

Status
Not open for further replies.
Level 1
Joined
Nov 25, 2012
Messages
3
Hey guys, I'm trying to make a leaderboard appear for the player of when his hero dies. I'm using a leaderboard because it will only show for the player of the dying unit and it appears below the multiboard.

The problem is, is that I can't get it to countdown from 20 to 1 for the respawn timer, and changing the time on the leaderboard...

How do I make a working countdown timer?

  • Actions
    • Game - Display to (All players) for 20.00 seconds the text: (S_PlayerColourCodes[(Player number of (Owner of (Dying unit)))] + ((Name of (Owner of (Dying unit))) + |r has died.))
    • Leaderboard - Create a leaderboard for (Player group((Owner of (Dying unit)))) titled Respawn in 21 secon...
    • Set LB_RespawnTimer[(Player number of (Owner of (Dying unit)))] = (Last created leaderboard)
    • Leaderboard - Change the title of LB_RespawnTimer[(Player number of (Owner of (Dying unit)))] to Respawn in 20 secon...
    • Set I_LB_RespawnTime[(Player number of (Owner of (Dying unit)))] = 20
    • For each (Integer I_LB_RespawnTime[(Player number of (Owner of (Dying unit)))]) from I_LB_RespawnTime[(Player number of (Owner of (Dying unit)))] to 1, do (Actions)
      • Loop - Actions
        • Leaderboard - Change the title of LB_RespawnTimer[(Player number of (Owner of (Dying unit)))] to (Respawn in + ((String(I_LB_RespawnTime[(Player number of (Owner of (Dying unit)))])) + seconds...))
        • Set I_LB_RespawnTime[(Player number of (Owner of (Dying unit)))] = (I_LB_RespawnTime[(Player number of (Owner of (Dying unit)))] - 1)
        • Wait 1.00 seconds
    • Leaderboard - Destroy LB_RespawnTimer[(Player number of (Owner of (Dying unit)))]
    • Hero - Instantly revive (Dying unit) at P_Regions[1], Show revival graphics
    • Camera - Pan camera for (Player((Player number of (Owner of (Dying unit))))) to (Position of U_Hero[(Player number of (Owner of (Dying unit)))]) over 0.00 seconds
    • Selection - Select U_Hero[(Player number of (Owner of (Dying unit)))] for (Owner of (Dying unit))
Thanks, remiX
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
"Dying Unit" won't be remembered by the trigger after using a wait. Use "Triggering Unit" instead (as a rule of thumb: always use "Triggering Unit", unless it's clearly not what you want).
And instead of "(Owner of (Triggering Unit))", use "Triggering Player" (I'm assuming this is a generic unit-event by the way).
Also, using a 1-second wait 20 times will result in a wait-time that is probably somewhere between 18 and 24 seconds.

You need to create another trigger with the event "every X seconds of game-time" (X depends on the accuracy you want, if 19-21 seconds is good enough, then X = 1.00 should suffice).
Turn the trigger on if a hero dies, turn it off when there are no dead heroes.
 
Level 1
Joined
Nov 25, 2012
Messages
3
Sorry for the late reply.

Yeah, it's a generic unit-event (When a unit dies, condition: dying unit = hero)

I was thinking of making another trigger and turning it on when a hero dies but I thought there was an easier way.

Will I need to make a trigger for each player or only one?
 
Level 1
Joined
Nov 25, 2012
Messages
3
You can use a countdown timer instead of an integer and set the title to the remaining time of the timer. When it expires, ressurect the target and destroy the timer.

Hmm. I'll try that out and see how it goes, thanks :)
 
Status
Not open for further replies.
Top