• 🏆 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] Hero Revival Timer

Status
Not open for further replies.
Level 11
Joined
Jul 5, 2010
Messages
779
guys i was working on revival system allmost 100% of the system works except the timer it shows. I make 2 triggers. The first one is for force 1 and second for force 2.when i make the first one it goes very good:
  • Events
    • Unit - A unit Dies
  • Conditions
    • ((Owner of (Killing unit)) controller) Not equal to User
    • ((Owner of (Triggering unit)) controller) Equal to User
    • ((Triggering unit) is A Hero) Equal to True
    • ((Owner of (Triggering unit)) is in FightingPvPGroup) Equal to False
  • Actions
    • Game - Display to (Player group((Owner of (Triggering unit)))) for 8.00 seconds the text: |cffffcc00You will ...
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of (Triggering unit)) Less than or equal to 40
      • Then - Actions
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Owner of (Triggering unit)) Equal to Player 1 (Red)
      • Then - Actions
        • Countdown Timer - Start TimerRed as a One-shot timer that will expire in 60.00 seconds
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
      • Then - Actions
        • Countdown Timer - Start TimerBlue as a One-shot timer that will expire in 60.00 seconds
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Owner of (Triggering unit)) Equal to Player 3 (Teal)
      • Then - Actions
        • Countdown Timer - Start TimerTeal as a One-shot timer that will expire in 60.00 seconds
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
      • Then - Actions
        • Countdown Timer - Start TimerPurple as a One-shot timer that will expire in 60.00 seconds
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
      • Then - Actions
        • Countdown Timer - Start TimerYellow as a One-shot timer that will expire in 60.00 seconds
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
      • Then - Actions
        • Countdown Timer - Start TimerOrange as a One-shot timer that will expire in 60.00 seconds
      • Else - Actions
    • Countdown Timer - Create a timer window for (Last started timer) with title (Name of (Triggering player))
    • Set RevivalTimerWindow[(Player number of (Owner of (Triggering unit)))] = (Last created timer window)
    • Countdown Timer - Show RevivalTimerWindow[(Player number of (Owner of (Triggering unit)))]
    • Wait 60.00 game-time seconds
    • Set ModeGroup = (Units owned by (Owner of (Triggering unit)) matching (((Matching unit) is A Hero) Equal to True))
    • Unit Group - Pick every unit in ModeGroup and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Picked unit) is dead) Equal to True
          • Then - Actions
            • Hero - Instantly revive (Picked unit) at (Center of DOBRI POCETOK <gen>), Show revival graphics
            • Unit - Set mana of (Picked unit) to 80.00%
            • Unit - Make (Picked unit) Vulnerable
            • Selection - Select (Picked unit) for (Owner of (Triggering unit))
            • Camera - Pan camera for (Owner of (Picked unit)) to (Center of DOBRI POCETOK <gen>) over 0.00 seconds
          • Else - Actions
    • Custom script: call DestroyGroup (udg_ModeGroup)
    • Countdown Timer - Destroy RevivalTimerWindow[(Player number of (Owner of (Triggering unit)))]
    • If (((Owner of (Triggering unit)) is in NOSAVING) Equal to True) then do (Player Group - Remove (Owner of (Triggering unit)) from NOSAVING) else do (Do nothing)
And when i put the same system for force 2 and change the Owner of triggering unit to the other 5 colors then when the hero dies 2 timers will be shown one doing right counting from 60 - 0 and on other it just stays on 0.
First i want just one timer. second to work to go from 60 - 0. Can you see the leak i made?
 
Level 11
Joined
Jul 5, 2010
Messages
779
so any problem?? because when i make 2 triggers 1 for Force 1 and one for Force 2 than when you play any class... when you die it shows 2 timers instead of one and one is working and other is not.

Edit: Can you remake this trigger and put it here?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
· You should create a timer array with size = number of players (6).
· Use variables insted of calling the same units/players/values over and over
· You could create a group for dead heroes, and pick units in that group, instead of looking units owned by the player matching (Is a Hero = True).
· A far as I know, destroying a timer without stopping it first leaks or bugs or something.

Why don't you revive when the timer stops, instead of using a Wait? I don't know... I feel it's better :p Doesn't require creating a timer everytime the hero dies, it's more flexible, more accurate... etc.

The same trigger, done in a "nearly" efficient way, would be something like:
  • Events
    • Unit - A unit Dies
  • Conditions
  • Actions
    • Set TUnit = Triggering Unit
    • Set TPlayer = Owner of TUnit
    • Set IntVar = Player Number of Player
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Owner of (Killing unit)) controller) Not equal to User
        • (TPlayer controller) Equal to User
        • (TUnit is A Hero) Equal to True
        • (TPlayer) is in FightingPvPGroup) Equal to False
      • Then - Actions
        • Set TForce = (Player Group(TPlayer))
        • Game - Display to TForce for 8.00 seconds the text: |cffffcc00You will ...
        • Custom script: call DestroYForce(udg_TForce)
        • Countdown Timer - Start Timer[IntVar] as a One-shot timer that will expire in 60.00 seconds
        • Countdown Timer - Create a timer window for Timer[IntVar] with title (Name of TPlayer)
        • Set RevivalTimerWindow[IntVar] = (Last created timer window)
        • Wait 60.00 game-time seconds
        • Set ModeGroup = (Units owned by (Owner of (Triggering unit)) matching (((Matching unit) is A Hero) Equal to True))
        • Unit Group - Pick every unit in ModeGroup and do (Actions)
          • Loop - Actions
            • Set TUnit = (Picked Unit)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (TUnit is dead) Equal to True
              • Then - Actions
                • Set TPlayer = Owner of TUnit
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • Player number of TPlayer Lower than or equal to 6
                  • Then - Actions
                    • Set TPoint = (Team1 Revival Point <gen>)
                  • Else - Actions
                    • Set TPoint = (Team2 Revival point <gen>)
                • Hero - Instantly revive TUnit at TPoint , Show revival graphics
                • Unit - Set mana of TUnit to 80.00%
                • Unit - Make TUnit Vulnerable
                • Selection - Select TUnit for TPlayer
                • Camera - Pan camera for TPlayer to TPoint over 0.00 seconds
                • Custom script: call RemoveLocation(udg_TPoint)
        • Custom script: call DestroyGroup (udg_ModeGroup)
        • Set TPlayer = (Owner of (Triggering Unit))
        • Set IntVar = Player Number of TPlayer
        • Countdown Timer - Stop RevivalTimerWindow[IntVar]
        • Countdown Timer - Destroy RevivalTimerWindow[IntVar]
        • If (TPlayer is in NOSAVING Equal to True) then do (Player Group - Remove TPlayer from NOSAVING) else do (Do nothing)
      • Else - Actions
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
It's made exactly as you see. Just create those variable types (Which -Kobas- specified) and do the same functions as they're showed. It's easy, and doing it by yourself will help you with oncoming triggers.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Made a mistake. I did it here in hive, not copy/paste from WC.

Set TUnit = Triggering Unit
Set TPlayer = Owner of TUnit
Set IntVar = Player Number of TPlayer

You have to understand than, after you set the varaibles, you no longer need (Triggering Unit) since you have "TUnit". You no longer need (Owner of Triggering Unit) since you have "TPlayer" and no longer need "Player number of Owner of Triggering Unit" since you hve "IntVar".

IntVar = Player number of TPlayer it's the same than "IntVar = (Player Number of (Owner of (Triggering Unit)))"

Be aware of the timer array. It's Timer[IntVar] You have to createa Timer with size = 6 (or the max players you use).

Timer[IntVar] is the same than : Timer[(Player Number of (Owner of (Triggering Unit)))].
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Create an If/Then/Else after "IntVar" is set. And if IntVar (Which is the player number) is greater than 6, then do your actions for that group, else, do the actions for players 1-6.

But there's no need to copy all the actions and else for each group... What's the difference between the Team1 and Team2 in the trigger?

Wich actions differ from one team to another?
 
Status
Not open for further replies.
Top