• 🏆 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] Why doesn't this 2 works like they should?

Status
Not open for further replies.
Level 14
Joined
Jul 19, 2007
Messages
772
I got problems with this 2 triggers and can't get them to working.
First one is a trigger that revives Heroes, the timer even shows up for my enemies and sometimes they doesn't dissappears when the timer reaches 0, it just creates more and more timers, pls help.
  • Reviving Good Heroes
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Owner of (Triggering unit)) Not equal to Player 12 (Brown)
      • (Owner of (Triggering unit)) Not equal to Player 6 (Orange)
      • (Owner of (Triggering unit)) Not equal to Player 7 (Green)
      • (Owner of (Triggering unit)) Not equal to Player 8 (Pink)
      • (Owner of (Triggering unit)) Not equal to Player 9 (Gray)
      • (Owner of (Triggering unit)) Not equal to Player 11 (Dark Green)
    • Actions
      • Set PlayerNumber = (Player number of (Owner of (Triggering unit)))
      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: Your Hero will be r...
      • Countdown Timer - Start death[PlayerNumber] as a One-shot timer that will expire in 50.00 seconds
      • Countdown Timer - Create a timer window for death[PlayerNumber] with title Revived in:
      • Set deathtimer[PlayerNumber] = (Last created timer window)
      • Countdown Timer - Show deathtimer[PlayerNumber] for Player 1 (Red)
      • Player Group - Pick every player in (All players matching ((Matching player) Not equal to (Player(PlayerNumber)))) and do (Actions)
        • Loop - Actions
          • Countdown Timer - Hide deathtimer[PlayerNumber] for (Matching player)
      • Wait 50.00 seconds
      • Countdown Timer - Destroy deathtimer[PlayerNumber]
      • Hero - Instantly revive (Triggering unit) at GoodHeroSpawn, Show revival graphics
      • For each (Integer IntegerVariable) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to (Player(IntegerVariable))
            • Then - Actions
              • Camera - Pan camera for (Player(IntegerVariable)) to GoodHeroSpawn over 0.50 seconds
            • Else - Actions
The second trigger is a trigger that should give control to friendly players if a players leaves but for some reason it also gives control to enemies of that player, what's wrong? I'm getting crazy of this..
  • Player Leave the game
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
      • Player - Player 3 (Teal) leaves the game
      • Player - Player 4 (Purple) leaves the game
      • Player - Player 5 (Yellow) leaves the game
      • Player - Player 6 (Orange) leaves the game
      • Player - Player 7 (Green) leaves the game
      • Player - Player 8 (Pink) leaves the game
      • Player - Player 9 (Gray) leaves the game
      • Player - Player 10 (Light Blue) leaves the game
      • Player - Player 11 (Dark Green) leaves the game
      • Player - Player 12 (Brown) leaves the game
    • Conditions
      • Mb_Player_Index[(Player number of (Triggering player))] Not equal to 0
    • Actions
      • Sound - Play H08Captain03 <gen>
      • Set TempNr = (Player number of (Triggering player))
      • Game - Display to (All players) the text: ((((((|cff + ColorCodes[TempNr]) + (Name of (Triggering player))) + ) + (Proper name of No unit)) + <Empty String>) + |r has left the game.)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • OrderRemoveLeaver Equal to True
        • Then - Actions
          • Set a = Mb_Player_Index[TempNr]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • a Not equal to Mb_Index
            • Then - Actions
              • Set Mb_CreepKill[a] = Mb_CreepKill[Mb_Index]
              • Set Mb_HeroKill[a] = Mb_HeroKill[Mb_Index]
              • Set Mb_TotalKill[a] = Mb_TotalKill[Mb_Index]
              • Set Mb_Player[a] = Mb_Player[Mb_Index]
              • Set Mb_Player_Index[Mb_Player[a]] = Mb_Player_Index[Mb_Player[Mb_Index]]
            • Else - Actions
          • Multiboard - Change the number of rows for Multiboard to Mb_Index
          • Set Mb_Index = (Mb_Index - 1)
        • Else - Actions
          • Set PlayerName[TempNr] = ---> Left <---
          • Set c = TempNr
          • Set b = Mb_Index
          • Set i = Mb_TotalKill[c]
          • Set Mb_TotalKill[c] = Mb_TotalKill[b]
          • Set Mb_TotalKill[b] = i
          • Set i = Mb_HeroKill[c]
          • Set Mb_HeroKill[c] = Mb_HeroKill[b]
          • Set Mb_HeroKill[b] = i
          • Set i = Mb_CreepKill[c]
          • Set Mb_CreepKill[c] = Mb_CreepKill[b]
          • Set Mb_CreepKill[b] = i
          • Set i = Mb_Player[c]
          • Set Mb_Player[c] = Mb_Player[b]
          • Set Mb_Player[b] = i
          • Set Mb_Player_Index[Mb_Player[c]] = c
          • Set Mb_Player_Index[Mb_Player[b]] = b
      • Player - For (Triggering player), turn Shared units On toward (Player(Mb_Player[1]))
      • Player Group - Pick every player in PlayerGroup and do (Actions)
        • Loop - Actions
          • Player - For (Triggering player), turn Shared units On toward (Picked player)
      • Trigger - Run Multiboard update <gen> (ignoring conditions)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
The Hero Revive is very sloppy.
  • Set PlayerNumber = (Player number of (Owner of (Triggering unit)))
  • Wait 50.00 seconds
  • Countdown Timer - Destroy deathtimer[PlayerNumber]
If 2 heroes die within 50 seconds of each other, the variable "PlayerNumber" will get overwritten and the first hero will never respawn, nor will the timer window ever get removed.
The funny thing is that it would actually work without the variable (because "Triggering Unit" acts as a local).
So I would advise you to remove that variable and try again (it might still not work, but it will at least be better).

For hiding/showing, there's actually an action like this:
  • Countdown Timer - Hide (Last created timer window)
Do that first, then show the window for the triggering player. No need for the player group.


In the second trigger, I notice a lot of useless variables (a, b, c).
There's also only 1 mention of the variable "PlayerGroup", so I have no clue what it's set to.
Set it to the allies of (Triggering Player).
Don't forget to remove the player group leak.
 
Level 14
Joined
Jul 19, 2007
Messages
772
The Hero Revive is very sloppy.
  • Set PlayerNumber = (Player number of (Owner of (Triggering unit)))
  • Wait 50.00 seconds
  • Countdown Timer - Destroy deathtimer[PlayerNumber]
If 2 heroes die within 50 seconds of each other, the variable "PlayerNumber" will get overwritten and the first hero will never respawn, nor will the timer window ever get removed.
The funny thing is that it would actually work without the variable (because "Triggering Unit" acts as a local).
So I would advise you to remove that variable and try again (it might still not work, but it will at least be better).

For hiding/showing, there's actually an action like this:
  • Countdown Timer - Hide (Last created timer window)
Do that first, then show the window for the triggering player. No need for the player group.


In the second trigger, I notice a lot of useless variables (a, b, c).
There's also only 1 mention of the variable "PlayerGroup", so I have no clue what it's set to.
Set it to the allies of (Triggering Player).
Don't forget to remove the player group leak.
Thanks for advices but I actually don't dare touch these triggers, I'm very noobish in triggering and I'm afraid I'll do something wrong.. If anyone would help me fix the triggers, I would be happy..
 
Status
Not open for further replies.
Top