Help with a countdown trigger!

Da_HP_Geek

New Member
Reaction score
8
I suppose that this trigger leaks, and is it MUI? I can't see if it works for other than myself...

Trigger:
  • Revive Initialization
    • Events
      • Unit - A unit owned by Player 1 (Red) Dies
      • Unit - A unit owned by Player 2 (Blue) Dies
      • Unit - A unit owned by Player 3 (Teal) Dies
      • Unit - A unit owned by Player 4 (Purple) Dies
      • Unit - A unit owned by Player 5 (Yellow) Dies
      • Unit - A unit owned by Player 6 (Orange) Dies
      • Unit - A unit owned by Player 7 (Green) Dies
      • Unit - A unit owned by Player 8 (Pink) Dies
      • Unit - A unit owned by Player 9 (Gray) Dies
      • Unit - A unit owned by Player 10 (Light Blue) Dies
    • Conditions
      • And - All (Conditions) are true
        • 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
          • (Owner of (Triggering unit)) Not equal to Player 11 (Dark Green)
          • (Owner of (Triggering unit)) Not equal to Player 12 (Brown)
        • Then - Actions
          • Countdown Timer - Create a timer window for ReviveTimer[(Player number of (Owner of (Triggering unit)))] with title ((Name of (Owner of (Triggering unit))) + revives in)
          • Set ReviveTimerWindow[(Player number of (Owner of (Triggering unit)))] = (Last created timer window)
          • Countdown Timer - Start ReviveTimer[(Player number of (Owner of (Triggering unit)))] as a One-shot timer that will expire in 30.00 seconds
          • Countdown Timer - Show ReviveTimerWindow[(Player number of (Owner of (Triggering unit)))]
          • Game - Display to (Player group((Owner of (Dying unit)))) the text: |Cffff0000Your hero...
        • Else - Actions
 

Komaqtion

You can change this now in User CP.
Reaction score
469
First, either use this event:
Trigger:
  • Unit - A unit Dies


And leave these conditions as they are:
Trigger:
  • (Owner of (Triggering unit)) Not equal to Player 11 (Dark Green)
    • (Owner of (Triggering unit)) Not equal to Player 12 (Brown)


Or use your events and remove those two conditions :D

But this should still work for others too :D And no leaks ;)
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
Code:
Game - Display to (Player group((Owner of (Dying unit)))) the text: |Cffff0000Your hero...
is a leak. instead of using (Player group((Owner of (Dying unit)))) use a playergroup variable.
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
creating a player group is just the same as creating a unit group. by creating a group you use memory and by not destroying it after it was used you lose that memory.
only exceptions are (all players) because this player group is already made, destroying it would cause bugs.

(if you dont know how to destroy playergroups with GUI its "call DestroyForce (udg_xxx))
 

Da_HP_Geek

New Member
Reaction score
8
I removed all that stuffs with the message, but now I got an other problem... The count down timer only works for player 1...

Trigger:
  • Revive Initialization
    • Events
      • Unit - A unit Dies
    • Conditions
      • And - All (Conditions) are true
        • 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
          • (Owner of (Triggering unit)) Not equal to Player 11 (Dark Green)
          • (Owner of (Triggering unit)) Not equal to Player 12 (Brown)
        • Then - Actions
          • Countdown Timer - Create a timer window for ReviveTimer[(Player number of (Owner of (Triggering unit)))] with title ((Name of (Owner of (Triggering unit))) + revives in)
          • Set ReviveTimerWindow[(Player number of (Owner of (Triggering unit)))] = (Last created timer window)
          • Countdown Timer - Start ReviveTimer[(Player number of (Owner of (Triggering unit)))] as a One-shot timer that will expire in 30.00 seconds
          • Countdown Timer - Show ReviveTimerWindow[(Player number of (Owner of (Triggering unit)))]
        • Else - Actions
 

Komaqtion

You can change this now in User CP.
Reaction score
469
First, remove the if, and move the conditions with "((Triggering unit) is A Hero) Equal to True" :D

Also, how did you test if it works for more than player 1 ??
 

Da_HP_Geek

New Member
Reaction score
8
Well, I see the other players name, but not the countdown when I am player 1. Just my own, and when I am an other player, it still jsut work for player 1...
 

deebee

New Member
Reaction score
15
Trigger:
  • Revive Initialization
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Owner of (Triggering unit)) Not equal to Player 11 (Dark Green)
      • (Owner of (Triggering unit)) Not equal to Player 12 (Brown)
    • Actions
      • Countdown Timer - Create a timer window for ReviveTimer[(Player number of (Owner of (Triggering unit)))] with title ((Name of (Owner of (Triggering unit))) + revives in)
      • Set ReviveTimerWindow[(Player number of (Owner of (Triggering unit)))] = (Last created timer window)
      • Countdown Timer - Start ReviveTimer[(Player number of (Owner of (Triggering unit)))] as a One-shot timer that will expire in 30.00 seconds
      • Countdown Timer - Show ReviveTimerWindow[(Player number of (Owner of (Triggering unit)))]


You can just do that as well. What is the size of those Timer arrays?
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
Just a note on leaks. All Players does not leak. Also, do not try to call DestroyForce on it, or you will be in trouble. That is all.
 

LordXavier

TH.net Regular
Reaction score
16
it is MPI. has leaks (others already pointed them out). another thing, in my opinion (just makes it look nicer in game) you should put the
Trigger:
  • Countdown Timer - Show
before the
Trigger:
  • Countdown Timer - Start
 

Da_HP_Geek

New Member
Reaction score
8
Like this then?

Trigger:
  • Revive Initialization
    • Events
      • Unit - A unit Dies
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Triggering unit) is A Hero) Equal to True
          • (Owner of (Triggering unit)) Not equal to Player 11 (Dark Green)
          • (Owner of (Triggering unit)) Not equal to Player 12 (Brown)
    • Actions
      • Countdown Timer - Create a timer window for ReviveTimer[(Player number of (Owner of (Triggering unit)))] with title ((Name of (Owner of (Triggering unit))) + revives in)
      • Set ReviveTimerWindow[(Player number of (Owner of (Triggering unit)))] = (Last created timer window)
      • Countdown Timer - Show ReviveTimerWindow[(Player number of (Owner of (Triggering unit)))]
      • Countdown Timer - Start ReviveTimer[(Player number of (Owner of (Triggering unit)))] as a One-shot timer that will expire in 30.00 seconds


But its still something wrong, it wont cool down... Shall I do one for each player?
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, are you sure the array of the timer has a size of 12 ??? :S
 

Da_HP_Geek

New Member
Reaction score
8
U mean the ReviveTimerWindow? But why would it make any diffrence if I had 12 arrays, cause I only use it one time... So 1 for each player?
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Yepp, one for each player... And you still use 12 (Yes, 1 at a time but player 1 uses the first, and pleyer 2 the second so it becomes more)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top