• 🏆 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!

MUI Respawn

Status
Not open for further replies.
Level 18
Joined
May 11, 2012
Messages
2,103
Can someone check this "MUI" Respawn triggers to see is everything done correctly because sometimes this screwes up...



  • On Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
      • ((Dying unit) belongs to an enemy of Player 1 (Red)) Equal to False
    • Actions
      • Set HeroRespawn_MaxIndex = (HeroRespawn_MaxIndex + 1)
      • Set HeroRespawn[HeroRespawn_MaxIndex] = (Dying unit)
      • Set HeroRespawn_Owner[HeroRespawn_MaxIndex] = (Owner of HeroRespawn[HeroRespawn_MaxIndex])
      • Set HeroRespawn_Time[HeroRespawn_MaxIndex] = ((Level of HeroRespawn[HeroRespawn_MaxIndex]) x 5)
      • Set TempPlayerGroup = (Player group(HeroRespawn_Owner[HeroRespawn_MaxIndex]))
      • For each (Integer TempInt) from 1 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HeroRespawn_Owner[HeroRespawn_MaxIndex] Equal to Player[TempInt]
            • Then - Actions
              • Game - Display to TempPlayerGroup the text: (PlayerColors[TempInt] + ((Name of HeroRespawn_Owner[HeroRespawn_MaxIndex]) + ,|r |c00FDD017your hero has been killed!|r))
            • Else - Actions
      • Countdown Timer - Start HeroRespawn_Timer[HeroRespawn_MaxIndex] as a One-shot timer that will expire in ((Real((Level of HeroRespawn[HeroRespawn_MaxIndex]))) x 5.00) seconds
      • Countdown Timer - Create a timer window for (Last started timer) with title Respawn in:
      • Set HeroRespawn_TimerWindow[HeroRespawn_MaxIndex] = (Last created timer window)
      • Countdown Timer - Hide HeroRespawn_TimerWindow[HeroRespawn_MaxIndex]
      • Countdown Timer - Show HeroRespawn_TimerWindow[HeroRespawn_MaxIndex] for HeroRespawn_Owner[HeroRespawn_MaxIndex]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HeroRespawn_MaxIndex Equal to 1
        • Then - Actions
          • Trigger - Turn on On Respawn <gen>
        • Else - Actions
      • Custom script: call DestroyForce(udg_TempPlayerGroup)
      • Custom script: set udg_TempPlayerGroup = null

  • On Respawn
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer HeroRespawn_Loop) from 1 to HeroRespawn_MaxIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HeroRespawn_Time[HeroRespawn_Loop] Less than or equal to 0
            • Then - Actions
              • Game - Display to (All players) the text: Hero has Respawned
              • Sound - Play Respawn <gen>
              • Countdown Timer - Pause HeroRespawn_Timer[HeroRespawn_Loop]
              • Countdown Timer - Hide HeroRespawn_TimerWindow[HeroRespawn_Loop]
              • Countdown Timer - Destroy HeroRespawn_TimerWindow[HeroRespawn_Loop]
              • Set TempPlayerGroup = (Player group(HeroRespawn_Owner[HeroRespawn_Loop]))
              • Set TempPoint = (Center of Return Area <gen>)
              • Game - Display to TempPlayerGroup the text: |cff8080c0Your hero...
              • Special Effect - Create a special effect attached to the origin of HeroRespawn[HeroRespawn_Loop] using Abilities\Spells\Human\ReviveHuman\ReviveHuman.mdl
              • Special Effect - Destroy (Last created special effect)
              • Hero - Instantly revive HeroRespawn[HeroRespawn_Loop] at TempPoint, Show revival graphics
              • Selection - Select HeroRespawn[HeroRespawn_Loop] for HeroRespawn_Owner[HeroRespawn_Loop]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Item carried by HeroRespawn[HeroRespawn_Loop] of type Health Potion) is owned) Equal to False
                • Then - Actions
                  • Hero - Create Health Potion and give it to HeroRespawn[HeroRespawn_Loop]
                  • Item - Set charges remaining in (Last created item) to 10
                • Else - Actions
                  • Item - Set charges remaining in (Item carried by HeroRespawn[HeroRespawn_Loop] of type Health Potion) to ((Charges remaining in (Item carried by HeroRespawn[HeroRespawn_Loop] of type Health Potion)) + 3)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Item carried by HeroRespawn[HeroRespawn_Loop] of type Mana Potion) is owned) Equal to False
                • Then - Actions
                  • Hero - Create Mana Potion and give it to HeroRespawn[HeroRespawn_Loop]
                  • Item - Set charges remaining in (Last created item) to 10
                • Else - Actions
                  • Item - Set charges remaining in (Item carried by HeroRespawn[HeroRespawn_Loop] of type Mana Potion) to ((Charges remaining in (Item carried by HeroRespawn[HeroRespawn_Loop] of type Mana Potion)) + 3)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Item carried by HeroRespawn[HeroRespawn_Loop] of type Ankh) is owned) Equal to False
                • Then - Actions
                  • Hero - Create Ankh and give it to HeroRespawn[HeroRespawn_Loop]
                  • Item - Set charges remaining in (Last created item) to 5
                • Else - Actions
              • Custom script: call DestroyForce(udg_TempPlayerGroup)
              • Custom script: call RemoveLocation(udg_TempPoint)
              • Set HeroRespawn[HeroRespawn_Loop] = HeroRespawn[HeroRespawn_MaxIndex]
              • Set HeroRespawn[HeroRespawn_MaxIndex] = No unit
              • Set HeroRespawn_Owner[HeroRespawn_Loop] = HeroRespawn_Owner[HeroRespawn_MaxIndex]
              • Set HeroRespawn_Time[HeroRespawn_Loop] = HeroRespawn_Time[HeroRespawn_MaxIndex]
              • Set HeroRespawn_Time[HeroRespawn_MaxIndex] = 0
              • Set HeroRespawn_Timer[HeroRespawn_Loop] = HeroRespawn_Timer[HeroRespawn_MaxIndex]
              • Set HeroRespawn_TimerWindow[HeroRespawn_Loop] = HeroRespawn_TimerWindow[HeroRespawn_MaxIndex]
              • Set HeroRespawn_MaxIndex = (HeroRespawn_MaxIndex - 1)
              • Set HeroRespawn_Loop = (HeroRespawn_Loop - 1)
            • Else - Actions
              • Set HeroRespawn_Time[HeroRespawn_Loop] = (HeroRespawn_Time[HeroRespawn_Loop] - 1)
              • Game - Display to (All players) the text: (HeroRespawnTime[ + ((String(HeroRespawn_Loop)) + (] = + (String(HeroRespawn_Time[HeroRespawn_Loop])))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HeroRespawn_MaxIndex Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • Custom script: set udg_TempPlayerGroup = null
      • Custom script: set udg_TempPoint = null
Thanks for your time
 
Level 18
Joined
May 11, 2012
Messages
2,103
Well, the HeroRespawn_Time is fine, although the timer which shows the time gets screwed up by stopping counting down.
This one time it has been counting down to 0, and stopped on 5th second (freezed or something).
But it was removed normally.
So I guess something is wrong with timers.

Edit: Oh, I think I know what might be the problem!
The timer array variable is set to 1 in variable editor.
Do you think it has to be set to more than 1? Maybe like 100 or something?
Is this cause some performance issues?
 
Level 18
Joined
May 11, 2012
Messages
2,103
The problem may be that the timers you use are not created.

Yes, that was the problem.

Yes timers have to be set to a higher amount in the variable editor.

I have set the variable array to 100 because I don't know how many heroes will die how many times, but it won't go over 100 for sure.
But, will this cause performance issue?
 
Status
Not open for further replies.
Top