• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Timer help

Status
Not open for further replies.
Level 2
Joined
May 6, 2005
Messages
15
I have tried everything, but this just refuses to work. This trigger would be for an RPG map with multiple players.

I'm trying to set triggers to start a timer when a player's hero dies, and display that timer. My problem, though, is removing the timer when it expires. I can't just use destroy - last created timer window, because the last created timer window may not be the timer that is expiring. Here's roughly how I want this trigger to work, but I can't get the triggers to behave.

Event:
A unit dies
Conditions:
(((Triggering Unit) belongs to an ally of Player 2(blue)) Equal to True) and (((Triggering Unit) is A Hero) Equal to True)
Actions:
Start playerrevive[player number of (owner of(triggering unit))] as a one-shot timer that expires in 60 seconds
Create timer window for playerrevive[player number of (owner of(triggering unit))]
Wait 60 seconds
Instantly revive (triggering unit) at center of (location), hide revival graphics
Destroy timer window for playerrevive[player number of(owner of(triggering unit))]

The last part, in bold, is what I'm having a problem with. Up until this point, the shown variable options have been Timers and Timer Arrays. However, the DESTROY timer window only shows variables for Timer Windows and Timer Window Arrays. And I can't use (Last created timer) because the last created timer MAY NOT be the right timer. Does anyone know how to set a Timer Window to a Timer variable?

Edit: I realize the event and condition don't work. I just typed them in like that to give you an idea of what's triggering this trigger. I will fix them after I figure out how to get this to work.

Edit: Got bored and fixed the event and condition.
 
Level 2
Joined
May 6, 2005
Messages
15
That's what I had to do to make the timer work correctly in the first place. The problem isn't getting the timer to display correctly and count down, the problem is removing the timer after it's done. The destroy timer trigger variables are all TIMER WINDOW variables, and the create timer trigger variables are all TIMER variables
 
Level 2
Joined
May 6, 2005
Messages
15
Actually, I think I finally figured it out.

Event:
A unit dies
Conditions:
(((Triggering Unit) belongs to an ally of Player 2(blue)) Equal to True) and (((Triggering Unit) is A Hero) Equal to True)
Actions:
Start playerrevive[player number of (owner of(triggering unit))] as a one-shot timer that expires in 60 seconds
Create timer window for playerrevive[player number of (owner of(triggering unit))] with title (whatever)
Set Playerrevivewindow[(player number of (owner of(triggering unit)))] = (last created timer window)
Wait 60 seconds
Instantly revive (triggering unit) at center of (location), hide revival graphics
Destroy Playerrevivewindow[(player number of (owner of(triggering unit)))]

Does anyone know offhand if this will work?

Note to those reading this trying to figure out what the hell I just did: I am using variable arrays to cut down on the number of triggers I need to make. playerrevive[index] and playerrevivewindow[index] are the two variable arrays used in this trigger, the first is a TIMER ARRAY and the second is a TIMER WINDOW ARRAY. The trigger sets the variable's [index] to be the player number of the owner of the dying unit, so each player can trigger their own timer window opening and closing.
 
Status
Not open for further replies.
Top