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

Status
Not open for further replies.
Level 8
Joined
Jul 10, 2018
Messages
383
  • HeroDead
    • 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
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • ((Owner of (Triggering unit)) slot status) Not equal to Has left the game
    • Actions
      • Countdown Timer - Start HeroREST[(Player number of (Triggering player))] as a One-shot timer that will expire in 30.00 seconds
      • Countdown Timer - Create a timer window for (Last started timer) with title ((Name of (Triggering player)) + Resurrection:)
      • Set HeroW[(Player number of (Triggering player))] = (Last created timer window)
      • Player Group - Pick every player in (All players matching ((Matching player) Not equal to (Triggering player))) and do (Actions)
        • Loop - Actions
          • Countdown Timer - Hide (Last created timer window) for (Picked player)
      • Player - Add -10000 to (Owner of (Triggering unit)) Current gold
      • Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: You lost |c0061FFFF...
      • Wait 30.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((This trigger) is on) Equal to True
        • Then - Actions
          • Countdown Timer - Destroy HeroW[(Player number of (Triggering player))]
          • Hero - Instantly revive Heroes[(Player number of (Triggering player))] at (Center of StartRegion <gen>), Show revival graphics
          • Camera - Pan camera for (Triggering player) to (Center of StartRegion <gen>) over 0.00 seconds
          • Selection - Select (Triggering unit) for (Triggering player)
        • Else - Actions
          • Do nothing
Now for some reason some players don't respawn/revive when dead but that doesn't happen when i'm playing it on solo i respawn each time.
 
Level 14
Joined
Feb 7, 2020
Messages
387
I'm pretty sure Triggering Player will not interact with a unit event; it is listening for a player event. So your Player Number of Triggering Player is technically not doing anything (I think it might always default to 0 when it doesn't fetch a proper event, which is why it always works for you--since player 1's slot index is 0).

You're looking for this to determine your arrays:

upload_2020-4-8_7-14-59.png
 
Level 8
Joined
Jul 10, 2018
Messages
383
I'm pretty sure Triggering Player will not interact with a unit event; it is listening for a player event. So your Player Number of Triggering Player is technically not doing anything (I think it might always default to 0 when it doesn't fetch a proper event, which is why it always works for you--since player 1's slot index is 0).

You're looking for this to determine your arrays:

View attachment 351936
it work sometimes for other
and sometimes it doesn't LUL
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Edit:
Nevermind, I see the issue. Triggering Player is treated like a global variable, meaning it can change between triggers. So during that 30 second Wait the Triggering Player can be changed to someone else entirely, in this trigger or in a different trigger.

Triggering Unit is treated like a local variable and won't get lost during the Wait. So like Planetary said, use "Owner of triggering unit" instead.

And why aren't you using a generic Event? You can filter out the unwanted players in the conditions.
  • Example
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Owner of (Triggering unit)) Not equal to Neutral Hostile
    • Actions
      • -------- DO STUFF --------
 
Status
Not open for further replies.
Top