4- Polishing Up << Oh my gosh we're about to do that. Aren't you excited?
Heroes need to re-spawn. Otherwise you will have a LAME map. Note that I won't be going over items in this tutorial (and probably not at all) BUT the method I will show you too revive heroes will work with items, if you choose to add them. I learned the basics from OneTwo SC's tutorials. He's awesome and has some great tutorials on youtube too. Anyway...
1- Find your unit in the data editor and set the field 'death time' to something super high like 9999. This is how long the hero is 'saved'. After that many seconds, the hero data is deleted and therefore the unit cant respawn.
2- Go to the trigger editor and make a new trigger called "respawn hero". For events, put unit dies. For conditions, put in "unit type classification check". Set the first option to 'unit type of unit (triggering unit)". Then set the attribute in the next field to be 'hero'. Basically that means it checks the triggering unit to see if its a hero or not, and only proceeds if it is. Obviously units will die that are not heroes and we don't want to run this trigger for them.
3-Under 'local variables' make 2 of them. One should be called "killedUnit" (EXACTLY the same spelling to avoid confusion later. use NO SPACES). . Set the type to unit and the initial value to triggering unit. The 2nd local variable should be called 'temp_group' of type unit group.
4- The first action should be 'set variable'. Set the killed unit to triggering unit (just in case the initial value thing doesnt work). Add the action to show a message and put in something like ' Your hero died cuz you suck at the game. Respawning in 15 seconds'.
5- Add the action 'pick each unit in unit group'. Set the unit group to 'units in region matching condition'. Set the region to 'convert circle to region' with the center being 'position of unit (killedUnit) and radius 0.1. Click on the part where it says something like 'excluded- missiles, hidden '. Find 'items' in that field and set it to 'required'.
6- Now hit ok and add a new action in the pick unit and do actions section. 'add unit to unit group'. Set the unit to picked unit and the group to 'temp group'. Add the action 'show/hide unit' and hide the picked unit.
Right. Things have changed since I wrote this. You no longer have to use the revive script- there is a built-in trigger action called "Revive Unit" that works fine. You can ingore the bit about the custom script and instead just use "Revive Unit".
7- Add the action to wait X seconds. (this time make it the next action instead of being inside the pick unit area) This is how long it takes for the hero to respawn. Add in the action "custom script'. Now before you do anything, go back to the variable 'KilledUnit'. Press Control + D on your keyboard to view the internal code for the trigger. This should make everything look like code and confuse you, don't worry. We just want to see what the internal ID is for the variable. Make sure that ID is "KilledUnit" and if not, rename it to that. Then hit Ctrl + D to revert to the standard view. Now go back to you custom code action and in the box at the bottom of the screen type this:
8- Now add in 'move unit instnatly'. set the unit to killed unit and the point to player spawn points [owner of unit(KilledUnit)]. This means the hero is moved from where he died to his spawn location.
9- Add in another 'pick each unit in unit group' action, but set the unit group to 'temp group'. Add an action to the show unit (picked unit). Add the action 'create inventory item'. Set the unit type to 'unit type of unit(picked unit)" and set the last field to 'killed unit'. Now use the action 'remove unit from game' and set the unit to 'picked unit' Update #2
1 More thing has changed. With the last patch, Blizzard enabled the functionality of the "Unit: Revive Type" field (under the unit in the data editor). Whenever you revive your unit, it will be revived as the type specified in this field. Make sure, you use the correct unit type here; resetting the field to default should automatically do this. When copying or duplicating a unit, it sometimes preserves the revive type of the old unit.
10- Ta-da. Your hero re spawns. :D Test it out to make sure it works.
Thats everything we NEED to do. How about some extras?
I hate to say it but most DOTA maps are unoriginal, boring, stereotype maps. And I realized I might be helping people create MORE of those!! So I'm adding a section to this about some ideas for stuff you can add in to 'spice it up' a bit. They wont be as detailed in instructions as previous sections. Don't you dare waste all this time and make a boring map after going through all this work. >.<
'inhibitors' (Leage of Legends, anybody?)
Anybody who plays league of legends will know what these are. For those who dont...Leage of Legends is a professional DOTA game. Each lane has an inhibitor inside the base. 2 lanes X 2 bases = 4 inhibitors for our map. The way they work is this- if your teams inhibitor is destroyed, the other team's CPU controlled units gain the upper hand. They start spawning 'super minions' which are beefed up versions of standard units. This is a feature that helps end games instead of making them long and drawn out. If your team can make it all the way into the enemy base, take out the towers guarding the inhibitors, AND destory them, the game is as good as won.
How to make them (general guide)
You want to make a new unit called the inhibitor and place them on the map. Make a trigger for each of them with the event unit dies ( inhibitor #1). obviously for inhibitor #2's trigger it should be the one that triggers the event. For the actions, you'll want to set a global variable to true. (make 1 variable for each inhibitor). Now duplicate the periodic spawn trigger you made waaayyy back in part 1 of this monster tutorial series. In the conditions of the copy, you want to check that global variable for that variable to see if its true. Then you should modify what units spawn and make it so something cool spawns but only in the lane of the corresponding inhibitor.
More to Come in this section
I plan on adding some more to the 'spicing it up' section at a later date. Feel free to post suggestions for what other things to add to this section or PM me. As always, Post any questions you have and send me a PM if I don't respond within a day (I don't check the tutorials every day).
I'm so sad....*sniffle* this is end of the road for the tutorial......
You now have all the tools required to build an amazing DOTA map. But what I've shown you here in this series IS NOT ENOUGH. You need to build on and use the knowledge learned from this to 'finish' the map. If you haven't noticed yet, we have been creating just part of each main section in DOTA maps- we made 1 hero, 1 ability, a basic respawn system, 1 or 2 buttons on our selection dialogs, etc...You need to add your own heroes and abilities. Hopefully this tutorial helps at least somebody make a DOTA map or at the very least learn the editor a bit better.
Like I said, send me suggestions on what to add to this tutorial. The section at the end is not done yet. Pm me any questions, comments, advice, etc or post it here. As always vote up at the top and let me know how I'm doing with my tutorials. :D
I'm sorry for posting in such an old topic, but Im new to the forums so...
anyways; I implemented a hero respawn trigger using the valerian-immortality-behavior-thingy, but the behavior kept going off at 10%hp instead of at the very last hit =/ So I was happy to find this tutorial here. I have one bug however... One of my heroes end up reverting to its parent unit type. I converted a marine to a hero, but he revives as a standard marine...