• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

respawn timer

Status
Not open for further replies.
Level 9
Joined
Apr 19, 2011
Messages
447
Your map is for Single Player?
If it's multiplayer, then tell me how many players are supposed to be playing.

I'll make your trigger, it's easy. ;)

EDIT: I decided to make both ways.



In order to make this work, you need to create the following variables:
- HERO: A Unit variable. You have to asign it to your hero.
- TIMER: A Timer variable.
- Timer_Window: A Timer Window variable.
- Spawn: A point variable.

  • Start Timer
    • Events
      • Unit - A unit owned by Player 1 (red) Dies
    • Conditions
      • (Triggering unit) Equal to HERO
    • Actions
      • Countdown Timer - Create a timer window for TIMER with title Respawn in:
      • Set Timer_Window = (Last created timer window)
      • Countdown Timer - Start TIMER as a One-shot timer that will expire in [YOUR RESPAWN TIME] seconds
      • Countdown Timer - Mostrar Timer_Window
This trigger will start the timer when your hero dies, showing a window titled "Respawn in:". You must put in [YOUR RESPAWN TIME] how much seconds will take the hero to respawn.

  • End Timer
    • Events
      • Time - TIMER expires
    • Conditions
    • Actions
      • Countdown Timer - Hide Timer_Window
      • Countdown Timer - Destroy Timer_Window
      • Set Spawn = [YOUR SPAWN LOCATION]
      • Hero - Instantly revive HERO at Spawn, Show revival graphics
      • Custom script: call RemoveLocation(udg_Spawn)
This trigger hides the timer when it reaches its end, and revives your hero in the respawn location.


For the multiplayer way, you could make copies of the above trigger, and set them to for each of the player, but I think that with some arrays you can make things shorter:

In order to make this work, you need to create the following variables:
- HERO: A Unit array, with a size equivalent to the number of players. You have to asign HERO[1] to the hero of Player 1, HERO[2] to the hero of Player 2...
- TIMER: A Timer array, with a size equivalent to the number of player.
- Timer_Window: A Timer Window array, with the same size as the other two arrays.
- Spawn: A point variable.

  • Start Timer
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Triggering unit) Equal to HERO[1]
          • (Triggering unit) Equal to HERO[2]
          • (Triggering unit) Equal to HERO[3]
          • (Triggering unit) Equal to HERO[4]
          • (Triggering unit) Equal to HERO[5]
          • (Triggering unit) Equal to HERO[6]
          • (Triggering unit) Equal to HERO[7]
          • (Triggering unit) Equal to HERO[8]
    • Actions
      • Countdown Timer - Create a timer window for TIMER[(Player number of (Owner of (Triggering unit)))] with title (( + ((String((Player number of (Owner of (Triggering unit))))) + ) Respawn in:))
      • Set Timer_Window[(Player number of (Owner of (Triggering unit)))] = (Last created timer window)
      • Countdown Timer - Start TIMER[(Player number of (Owner of (Triggering unit)))] as a One-shot timer that will expire in [YOUR RESPAWN TIME] seconds
      • Countdown Timer - Mostrar Timer_Window[(Player number of (Owner of (Triggering unit)))]
This trigger will start whenever a unit dies, and will check if it's one of the heros. If it is, will start the respawn timer for the owner of the dying hero. The title of the window will be like "(X) Respawn in:", where X is the number of the player which hero has died.

  • End Timer X
    • Events
      • Time - TIMER[X] expires
    • Conditions
    • Actions
      • Countdown Timer - Hide Timer_Window[X]
      • Countdown Timer - Destroy Timer_Window[X]
      • Set Spawn = [SPAWN LOCATION OF PLAYER X]
      • Hero - Instantly revive HERO[X] at Spawn, Show revival graphics
      • Custom script: call RemoveLocation(udg_Spawn)
This is almost the same thing as for single player, but this time it uses arrays. You'll have to create as many triggers like this as players you have, and change the X of each of them for the numbers of the players. Maybe all those triggers can be compressed in one single trigger, but I don't know how to do it.

I don't know of any way to make it better. I would make it like this. I didn't tested it, but it should work. Tell me if you find any problem, and I will help you find the issue.


Hope it helped.

Regards
 
Last edited:
Level 9
Joined
Apr 19, 2011
Messages
447
Oops... XD
I was editing my own post when you posted!
Anyway, check the edit. I didn't knew if your map was for Single Player or for Multiplayer, and I wanted to give you an answer, so I made both ways. XD

I hope this is what you were looking for. Tell me if you find any problem.

Regards
 
Level 18
Joined
May 11, 2012
Messages
2,103
I stuck at this: Countdown Timer - Create a timer window for TIMER[(Player number of (Owner of (Triggering unit)))] with title (( + ((String((Player number of (Owner of (Triggering unit))))) + ) Respawn in:))

What is the trigger for that? cant find it (( + ((String((Player number of (Owner of (Triggering unit))))) + ) Respawn in:)) fast reply
and what does MONSTRAR TIMER means? that doesn't even show there. And Timer(X)?
 
Last edited:
Level 9
Joined
Apr 19, 2011
Messages
447
Okay, let's see:

(( + ((String((Player number of (Owner of (Triggering unit))))) + ) Respawn in:))

You can make this with the "Concatenate String" function. Just concatenate three strings to do this.

And... sorry for the "Mostrar". I'm spanish, and I have to translate the triggers before posting them. XD
I forgot that part. It's "Show". :)

And I wrote Timer(X) as a generic timer. I suppose you're referring to the "End Timer X" trigger. All the X in that trigger are just generic values. What I mean, is that you have to create 8 copies of that trigger (one for each player) and, in the first one replace the X with 1, in the second one replace the X with 2...

Regards
 
Level 18
Joined
May 11, 2012
Messages
2,103
(( + ((String((Player number of (Owner of (Triggering unit))))) + ) Respawn in:))

I know that I need to concatenate th triggers but idk how you get that (( + (( and + ) respawn in:))

I only managed to create ((String((Player number of (Owner of (Triggering unit))))) + ) Respawn in:)

nd now the timer doesn't even shows :<I
 
Last edited:
Level 9
Joined
Apr 19, 2011
Messages
447
If you select "Concatenate String", you get two strings, right?
Well, if you select one of those strings, and set it as a "Concatenate String" too, you'll get the three needed strings.

And I can't figure out why the timer isn't showing. I have just tested my own system, and it works.
Look, I've attached a test map I've made for you. I think that it's the best way to show you how to do it. And I'm pretty sure that if it works for me, it'll work for you.

Regards
 

Attachments

  • Respawn System.w3x
    19.5 KB · Views: 62
Level 18
Joined
May 11, 2012
Messages
2,103
Here it is

  • Start Timer
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Set HeroInteger[1] = (Team number of Player 1 (Red))
          • Set HeroInteger[2] = (Team number of Player 2 (Blue))
          • Set HeroInteger[3] = (Team number of Player 3 (Teal))
          • Set HeroInteger[4] = (Team number of Player 4 (Purple))
          • Set HeroInteger[5] = (Team number of Player 5 (Yellow))
          • Set HeroInteger[6] = (Team number of Player 6 (Orange))
          • Set HeroInteger[7] = (Team number of Player 7 (Green))
          • Set HeroInteger[8] = (Team number of Player 8 (Pink))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Triggering unit) Equal to Hero[HeroInteger[1]]
                  • (Triggering unit) Equal to Hero[HeroInteger[2]]
                  • (Triggering unit) Equal to Hero[HeroInteger[3]]
                  • (Triggering unit) Equal to Hero[HeroInteger[4]]
                  • (Triggering unit) Equal to Hero[HeroInteger[5]]
                  • (Triggering unit) Equal to Hero[HeroInteger[6]]
                  • (Triggering unit) Equal to Hero[HeroInteger[7]]
                  • (Triggering unit) Equal to Hero[HeroInteger[8]]
            • Then - Actions
              • Countdown Timer - Start TimerRespawn[HeroInteger[(Team number of (Owner of (Triggering unit)))]] as a One-shot timer that will expire in 120.00 seconds
              • Countdown Timer - Create a timer window for TimerRespawn[HeroInteger[(Team number of (Owner of (Triggering unit)))]] with title ((( + (String(HeroInteger[(Team number of (Owner of (Triggering unit)))]))) + Respawn in:)
              • Set TimerWindowRespawn[HeroInteger[(Team number of (Owner of (Triggering unit)))]] = (Last created timer window)
              • Countdown Timer - Show TimerWindowRespawn[HeroInteger[(Team number of (Owner of (Triggering unit)))]]
            • Else - Actions
        • Else - Actions
 
Status
Not open for further replies.
Top