• 🏆 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] Revive Heroes Help

Status
Not open for further replies.
Level 4
Joined
Aug 9, 2007
Messages
33
Im making a hero survival and i need my heroes to revive in a certain spot when timer goes down. I made my timer variablee and region and stuff. Take alook at my trigger and tell me why its not working!

Trigger 1:
  • Events
    • Unit - A unit Dies
  • Conditions
    • ((Triggering unit) is A Hero) Equal to True
  • Actions
    • Countdown Timer - Start Timer2 as a One-shot timer that will expire in 30.00 seconds
    • Countdown Timer - Create a timer window for (Last started timer) with title Hero Revive
This part works fine

Trigger 2:
  • Events
    • Time - Timer2 expires
  • Conditions
    • ((Triggering unit) is A Hero) Equal to ((Triggering unit) is dead)
  • Actions
    • Hero - Instantly revive (Matching unit) at (Center of Region 004 <gen>), Show revival graphics
Timer2 is my timer variable and Region 004 is my region where i want them to revive.
 
Level 3
Joined
Nov 11, 2007
Messages
39
Try this, its not leak free, but i think it should work.


  • Hero Revive
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Custom script: local unit Revive_Hero
      • Custom script: set Revive_Hero = GetTriggerUnit()
      • Countdown Timer - Start ResTimer as a One-shot timer that will expire in 30.00 seconds
      • Countdown Timer - Create a timer window for (Last started timer) with title Hero Revive
      • Wait 30.00 seconds
      • Custom script: Custom script: call ReviveHeroLoc( Revive_Hero, GetRectCenter(YourLocationHere()), true )
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
This does not work because your condition is wrong.
"Triggering Unit" means the unit that made the trigger to work (the event in other words) and your event has nothing to do with a unit right ?
I would suggest you to make a unit variable and set the players hero's to it.
A trigger for example:

  • Unknown
    • Events
      • Events You Want
    • Conditions
      • Conditions You Want
    • Actions
      • Unit - Create A_Unit for A_Player at Some_Place facing Default building facing degrees
      • Set Heros[1] = (Last created unit)
Then make for each player a diffrent timer (this will make it easier to see what hero to revive), and when the timer ends you revive the Heros[x].

Another easier way but maybe will make problems, is to just do - Hero dies , wait x seconds and then revive him.
The timer will be just to show the player when he will be revived and have nothing to do with the trigger.

  • Unknown
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to Heros[1]
        • Then - Actions
          • Countdown Timer - Start TimeOnTimers[1] as a One-shot timer that will expire in 10.00 seconds
          • Countdown Timer - Create a timer window for TimeOnTimers[1] with title Red's hero revives ...
          • Set Timers[1] = (Last created timer window)
          • Wait 10.00 seconds
          • Countdown Timer - Destroy Timers[1]
          • Hero - Instantly revive Heros[1] at Some_Place, Hide revival graphics
        • Else - Actions
Also here I would suggest you to make diffrent timers to prevent bugs when heros die at same/close time.
 
Status
Not open for further replies.
Top