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

Hero Revival Tutorial

Level 5
Joined
Dec 30, 2006
Messages
93
Introduction

Welcome to Billy2's Hero Revival Tutorial,

In this tutorial we shall be continuing on from my other tutorial http://www.hiveworkshop.com/forums/f283/tutorial-hero-selections-84923/, may i suggest that you complete that tutorial first before starting this one, just so you have something to work on.

Lets get started.

This is effective to use in a Hero Arena map.


Regions

You will firstly want to place a region in the Map Interface like this Region.jpg.
Variables

Open up the Trigger Editor and make a variable with the variable name as Hero_Revival, the variable type as Unit and the array of 2. (It should look like this Variables.jpg). As you see i have made mine with a Array of 2, all this means is that it has two of same variable type under the same name except for a different index. After it matches what i have click ok. Then make another variable with the name Revival_Point, the variable type as Point and the array of 2. (It should look like this Variable 2.jpg). Again i have put a array of two but this time is jugdeing that we have 2 teams 1 array for 1 team 1 and 1 array for team 2, you see?

Triggers

Simple triggers here, ill tell and teach you how to clear up these leaks
Make a New Category by clicking the icon or hold Ctrl+G then a new trigger or hold Ctrl+T and name the trigger Set Player 1 Revival.

  • Events
    • Unit - A unit enters Hero Arena Team 1 Enter <gen>
  • Conditions
    • (Owner of (Entering unit)) Equal to Player 1 (Red)
  • Actions
    • Set Hero_Revival[1] = (Entering unit)
    • Trigger - Turn off (This trigger)
And then another trigger called Set Player 2 Revival.
  • Events
    • Unit - A unit enters Hero Arena Team 1 Enter <gen>
  • Conditions
    • (Owner of (Entering unit)) Equal to Player 2 (Blue)
  • Actions
    • Set Hero_Revival[2] = (Entering unit)
    • Trigger - Turn off (This trigger)
What we are doing here is when the hero is picked from the choice of the hero selections it enters this region and when it does the unit entering must match the conditions which is basically the unit that is entering the specified region is owned by player 1 red and then player 2 blue. The action just calls upon our variable to store the unit entering the region for later use and then turns the trigger off so it doesnt keep having to restore the unit when it enters that region. Notice the index? 1 in this tutorial is red and 2 is blue.
Okay, now make another trigger called Player 1 Hero Killed.

  • Events
    • Unit - A unit Dies
  • Conditions
    • (Dying unit) Equal to Hero_Revival[1]
  • Actions
    • Wait 10.00 seconds
    • Set Revival_Point[1] = (Center of Hero Arena Team 1 Enter <gen>)
    • Hero - Instantly revive Hero_Revival[1] at Revival_Point[1], Hide revival graphics
    • Custom script: call RemoveLocation(udg_Revival_Point[1])
And then a trigger called Player 2 Hero Killed.
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Dying unit) Equal to Hero_Revival[2]
  • Actions
    • Wait 10.00 seconds
    • Set Revival_Point[2] = (Center of Hero Arena Team 2 Enter <gen>)
    • Hero - Instantly revive Hero_Revival[2] at Revival_Point[2], Hide revival graphics
    • Custom script: call RemoveLocation(udg_Revival_Point[2])
All we are doing here is telling the trigger to fire when a unit dies and if the dying unit is the unit stored in the variable we wait 10 seconds, then it sets the Variable Revival_Point[1] or Revival_Point[2](if it matches the conditions) to the speicified regions and then revives the unit we stored, instantly at the region we stored inside a variable, then all we do is destroy the variable so it doesnt cause a Location Leak(but dont worry it will be called upon again if a unit dies and the dying unit matches the conditions).

Well thats all there is too it, so congratulations you have just made a Hero Revival System which revives two teams, but remember if you want to revive more heros which are owned by more players just change the index of the variable called Hero_Revival to the number of players you want, then just make another trigger like you did but instead change the conditions of the unit being set to the player you want and change Set Hero_Revival[1] = (Entering unit) or Set Hero_Revival[2] = (Entering unit) the index of the player you want, keep it so Red is [1], blue is [2], teal is [3] etc... and just change the trigger where the unit dies to... i think you will know what to do for that.

Well this has been another successful tutorial by Billy2 here at the Hiveworkshop.com.

Feel free to add me if you are unsure of anything my email is [email protected].

All the best,
Billy2
 
Level 22
Joined
Feb 26, 2008
Messages
891
I agree.
These trigger, while they do work and they would get the job done, are horribly inefficient compared to what could be accomplished, especially using JASS.
It would be possible to make one trigger to take care of any number of players.

All that red text could be a bit annoying, too....

So, for now, this tutorial is Graveyarded.
 
Top