What we will be covering here is reviving your heroes with experience, levels and stats intact. What we won't be covering because I have not worked it out yet. Is keeping your items when you die.
EDIT: it appears after further consultation with the shadow council, that items dropping on death (without the item being set to drop on death) is a bug in the data editor and hopefully will be fixed by release
Essentially this is an extremely simple thing to do in the data editor, alot of it comes down to what you want to happen as a player when the hero is revived. and revive behavior.
Please Note: this tutorial assumes you are already familiar with the data editor to the point where you can create heroes, buttons, actors e.t.c
Units section
OK lets assume you have a basic hero, with levels, stats, abilities, and Inventory. What you have most probably not realized has a use yet (I didn't until figuring this out) is under your heroes unit, the "Stats - Death Time" field, this determines how long your hero will be available for revival after it dies.
Most of you probably want the hero to be able to be revived at all times. so set this to -1.0
However if you wanted the player only to have 30 seconds to click that revive button, go ahead and make that 30.0
Secondly there is "Stats - Revive Delay" and "Stats - Revive Time" The former is how long the revive button is grayed out before you can click it to revive them, and the latter is how long it takes to revive the hero at it's base.
You will finally want to set a production cost for your hero. For this example I set mine to 2.
Buttons section
Who knows why but revive requires as many buttons as you have heroes. Lets say we have two for examples sake.
1. Create 3 Buttons, Revive Hero (for the Ability it's self) Hero 1 (For the first dead hero) and Hero 2 (For the second dead hero)
Abilities section
Ok, the meat of the revive resides here.
1. add object, call it "Revive Hero" and click suggest, Ability Type: Revive, Based On: CAbilRevive
2. Base Info+ : this is the base cost to revive a unit, here you can set how many charges the ability has (if you want a lives system :P ) and the cooldown of the ability. you can also set the static cost of reviving a unit here. for this example set Technology Resource Cost, Minerals, to 20 and the Cooldown:Time Use to 30.0
3. Base Info Cost Factor+: is how much the units cost is multiplied at it's base (level 0) for a revive. for this example my hero costs 2, and I set Minerals (under resource) to 5, 5x2 = 10 :D so. My unit at level 0 costs 30 minerals to revive so far, 20 base revive cost +10 based on the heroes level 0 worth.
4. Command Buttons+: This is where things just seem redundant, but we will play along. here you can see they have 20 fields layed out for you. Revive1-Revive20. Click the first entry and set "Default Button" to Hero1, click the second entry and set it to Hero2.
What this is for will become apparent when we set up the unit that revives our heroes.
5. Level Info+: this is exactly like Base Info+ however this adds it's costs to the units revive with every level of the unit. I did nothing here. (you could for examples sake. change Time Use, however this changes the cooldown of ALL slots of the ability meaning that if a level 5 hero raked up a 60 second revive then your level 0 heroes would have to wait 60 seconds before they could be revived.)
6. Level Unit Cost Factor+: Again exactly like it's counter part (Base Info Cost Factor+) however is added per level. so my character at level 1 = 20 base revive cost + 10 level0 + 10 level 1
7. Ability Vitals, this is how much or little the hero is revived with when they respawn, there are 3 settings.
Ignore: the unit revives on 1 in that field 1/200
Start: the unit revives with the amount it is created with when you first make the hero. eg 123/200
Maximum: the unit revives with that vital maxed eg 200/200
For the example mine are set to ignore.
8. Range, set this to something sane like 2 unlike the default 500.
Thats the ability created now how to add it?!
Command card
Grab yourself a structure you want to use as your revive building. For the example I am using Templar Archives, since it's kinda like a temple.
1. add the Hero Revive ability.
2. The command card: first of all, if your going to have multiple units reviveable at once, you should probably set up a sub menu.
Create a command button Buttons: Revive Hero, Command Type: Submenu, Commad Card: 2
3. change the command card to pane 2. Your about to understand why we needed a "Hero1" and a "Hero 2" button
Click in your first Slot, Buttons: Revive Hero, Command Type: Ability Command, Ability: Revive Hero, Ability Command: Hero1
Do the same for slot two except, Ability Command: Hero2
You see, while you CAN have them all "Hero 1" what will happen is that when your first hero dies both buttons will become the first dead hero meaning first of all that they all show up, and second of all you can't revive any other heros until the first has finished reviving.
So by having a seperate button for each slot, you are insuring that there is a slot for each hero that dies in turn. They still share a linked cooldown however -_-
End
You should now be able to revive your heroes with all their information intact. Happy failing!
You can also revive units with triggers with this on custom script: "UnitRevive ( unit );"
Where unit is the unit you want to revive, use EventUnit() for the triggering unit.
The items always drop when you die, no matter if you are reviving using triggers or a revive ability, but you can work around it till they fix that.
What I did was when a unit dies, I look for every unit that is an item in the same exact position as the dieing unit and hide them.
Then you wait for the respawn time, revive the unit, recreate every item you found earlier in the same point where the hero died on the hero inventory, then destroy the items on the ground.
The reason for hiding is because you can't manage the inventory of dead units.
Hmm, I seem to have a lil trouble using this. After the hero dies, I can click on my building (it's a pylon) and click the button to revive the hero. But the thing is, when I click it, all i see is a Revived Hero Complete alert, but no revived hero. What could I be doing wrong?
I don't believe it is added to GUI yet. It is not too hard to use the custom script function though; You just have to add the Custom Script action to the trigger, and type UnitRevive(EventUnit()); in the textfield in the bottom of the window.
It seems when using this script, the unit that is revived starts as invulnerable, and regains 100% life after 5 seconds. Is this correct?
This is a problem because im making a sort of a hero arena where you revive at a random location on the map. This means i have to pause the unit for 5 seconds before releasing it back to the fight. This gives the opponenets an advantage, as they can aim they're AoEstuns or whatever and fire them as soon as the hero comes back into play. :/
EDIT: Nevermind, i can just move the hero AFTER this effect has worn out and then make it vulnerable again.
I have two heroes and for some reason when I use this ability it always revives 1 of the 2. I mean, say Hero 1 dies, I press revive and it revives him. Now Hero 2 dies, I press revive and it revives her and Hero 1. Any idea why this would be happening?
The items always drop when you die, no matter if you are reviving using triggers or a revive ability, but you can work around it till they fix that.
What I did was when a unit dies, I look for every unit that is an item in the same exact position as the dieing unit and hide them. Then you wait for the respawn time, revive the unit, recreate every item you found earlier in the same point where the hero died on the hero inventory, then destroy the items on the ground.
The reason for hiding is because you can't manage the inventory of dead units.
Attachment is a screenshot of the trigger above.
I attempted to do it this way. My trigger looks identical to yours. However the custom script, UnitRevive(EventUnit()); doesn't seem to work.
The unit dies, and I even put a couple UI events to tell me that the trigger did get called.. but when the 5 seconds goes by, nothing happens. The unit never respawns. Any ideas?
Edit: I thought maybe somehow picking the inventory items might have screwed up "EventUnit" so I disabled everything but the respawn script.. still nothing.
This whole lot just got me confused ... I want to use the custom script to avoid having to make buildings, as I'm doing a RPG-thingie. Now... How do I script it so that it will:
post a message, informing the player that his unit is dead, then ressurect the dead hero, owned by player 1-4 at RegionXX (or Start Location) after 3 seconds.
Blablabla I'm new to this whole editing thing, I managed to learn the WCIII over a while and as soon as I had the triggering all sorted out, I rerolled SCII and here there is no proper revive standard. As I don't know custom scripts at all, I'm just stuck.
I've gotten pretty far but now I'm stuck again, at the last 2 lines.
- I figured it out after a while of mindless clicking... Just as I was about to give up I gave them all a go one last time, and boom there it was. Property.
What we will be covering here is reviving your heroes with experience, levels and stats intact. What we won't be covering because I have not worked it out yet. Is keeping your items when you die.
EDIT: it appears after further consultation with the shadow council, that items dropping on death (without the item being set to drop on death) is a bug in the data editor and hopefully will be fixed by release
Essentially this is an extremely simple thing to do in the data editor, alot of it comes down to what you want to happen as a player when the hero is revived. and revive behavior.
Please Note: this tutorial assumes you are already familiar with the data editor to the point where you can create heroes, buttons, actors e.t.c
Units section
OK lets assume you have a basic hero, with levels, stats, abilities, and Inventory. What you have most probably not realized has a use yet (I didn't until figuring this out) is under your heroes unit, the "Stats - Death Time" field, this determines how long your hero will be available for revival after it dies.
Most of you probably want the hero to be able to be revived at all times. so set this to -1.0 However if you wanted the player only to have 30 seconds to click that revive button, go ahead and make that 30.0
Secondly there is "Stats - Revive Delay" and "Stats - Revive Time" The former is how long the revive button is grayed out before you can click it to revive them, and the latter is how long it takes to revive the hero at it's base.
You will finally want to set a production cost for your hero. For this example I set mine to 2.
Buttons section
Who knows why but revive requires as many buttons as you have heroes. Lets say we have two for examples sake.
1. Create 3 Buttons, Revive Hero (for the Ability it's self) Hero 1 (For the first dead hero) and Hero 2 (For the second dead hero)
Abilities section
Ok, the meat of the revive resides here.
1. add object, call it "Revive Hero" and click suggest, Ability Type: Revive, Based On: CAbilRevive
2. Base Info+ : this is the base cost to revive a unit, here you can set how many charges the ability has (if you want a lives system :P ) and the cooldown of the ability. you can also set the static cost of reviving a unit here. for this example set Technology Resource Cost, Minerals, to 20 and the Cooldown:Time Use to 30.0
3. Base Info Cost Factor+: is how much the units cost is multiplied at it's base (level 0) for a revive. for this example my hero costs 2, and I set Minerals (under resource) to 5, 5x2 = 10 :D so. My unit at level 0 costs 30 minerals to revive so far, 20 base revive cost +10 based on the heroes level 0 worth.
4. Command Buttons+: This is where things just seem redundant, but we will play along. here you can see they have 20 fields layed out for you. Revive1-Revive20. Click the first entry and set "Default Button" to Hero1, click the second entry and set it to Hero2.
What this is for will become apparent when we set up the unit that revives our heroes.
5. Level Info+: this is exactly like Base Info+ however this adds it's costs to the units revive with every level of the unit. I did nothing here. (you could for examples sake. change Time Use, however this changes the cooldown of ALL slots of the ability meaning that if a level 5 hero raked up a 60 second revive then your level 0 heroes would have to wait 60 seconds before they could be revived.)
6. Level Unit Cost Factor+: Again exactly like it's counter part (Base Info Cost Factor+) however is added per level. so my character at level 1 = 20 base revive cost + 10 level0 + 10 level 1
7. Ability Vitals, this is how much or little the hero is revived with when they respawn, there are 3 settings. Ignore: the unit revives on 1 in that field 1/200
Start: the unit revives with the amount it is created with when you first make the hero. eg 123/200
Maximum: the unit revives with that vital maxed eg 200/200
For the example mine are set to ignore.
8. Range, set this to something sane like 2 unlike the default 500.
Thats the ability created now how to add it?!
Command card
Grab yourself a structure you want to use as your revive building. For the example I am using Templar Archives, since it's kinda like a temple.
1. add the Hero Revive ability.
2. The command card: first of all, if your going to have multiple units reviveable at once, you should probably set up a sub menu.
Create a command button Buttons: Revive Hero, Command Type: Submenu, Commad Card: 2
3. change the command card to pane 2. Your about to understand why we needed a "Hero1" and a "Hero 2" button
Click in your first Slot, Buttons: Revive Hero, Command Type: Ability Command, Ability: Revive Hero, Ability Command: Hero1
Do the same for slot two except, Ability Command: Hero2
You see, while you CAN have them all "Hero 1" what will happen is that when your first hero dies both buttons will become the first dead hero meaning first of all that they all show up, and second of all you can't revive any other heros until the first has finished reviving.
So by having a seperate button for each slot, you are insuring that there is a slot for each hero that dies in turn. They still share a linked cooldown however -_-
End
You should now be able to revive your heroes with all their information intact. Happy failing!
Awesome.
You can also revive units with triggers with this on custom script: "UnitRevive ( unit );" Where unit is the unit you want to revive, use EventUnit() for the triggering unit.
Ah nice you found it out.
I got my trigger version working pretty well too! Data version needs some Blizz-end fixes like item-dropping thing.
I think I might do my trigger version in a video tutorial...
We'd love that OneTwo.
The items always drop when you die, no matter if you are reviving using triggers or a revive ability, but you can work around it till they fix that.
What I did was when a unit dies, I look for every unit that is an item in the same exact position as the dieing unit and hide them. Then you wait for the respawn time, revive the unit, recreate every item you found earlier in the same point where the hero died on the hero inventory, then destroy the items on the ground.
The reason for hiding is because you can't manage the inventory of dead units.
Attachment is a screenshot of the trigger above.
@Barterr: Go
Yeah your trigger helped me a lot.
Hey! I didn't know we could hide units... I had my items moved to a secret spot. Well, this is interesting. I'll credit you in my video tutorial.
Hmm, I seem to have a lil trouble using this. After the hero dies, I can click on my building (it's a pylon) and click the button to revive the hero. But the thing is, when I click it, all i see is a Revived Hero Complete alert, but no revived hero. What could I be doing wrong?
Does anyone else have problems using the UnitRevive() function? Nothing happens when I use it.
Edit: My problem was that I hadn't set "Stats - Death Time". Working perfectly now - thanks!
I do not know how to use custom code properly, is there any way to revive a hero by built in actions (in the trigger editor)?
I don't believe it is added to GUI yet. It is not too hard to use the custom script function though; You just have to add the Custom Script action to the trigger, and type UnitRevive(EventUnit()); in the textfield in the bottom of the window.
@anachronism: Go
Oh, i didnt know there were a custom script as an action. Thought you'd had to make your own function. Ty! :)
It seems when using this script, the unit that is revived starts as invulnerable, and regains 100% life after 5 seconds. Is this correct?
This is a problem because im making a sort of a hero arena where you revive at a random location on the map. This means i have to pause the unit for 5 seconds before releasing it back to the fight. This gives the opponenets an advantage, as they can aim they're AoEstuns or whatever and fire them as soon as the hero comes back into play. :/
EDIT: Nevermind, i can just move the hero AFTER this effect has worn out and then make it vulnerable again.
I have two heroes and for some reason when I use this ability it always revives 1 of the 2. I mean, say Hero 1 dies, I press revive and it revives him. Now Hero 2 dies, I press revive and it revives her and Hero 1. Any idea why this would be happening?
I attempted to do it this way. My trigger looks identical to yours. However the custom script, UnitRevive(EventUnit()); doesn't seem to work.
The unit dies, and I even put a couple UI events to tell me that the trigger did get called.. but when the 5 seconds goes by, nothing happens. The unit never respawns. Any ideas?
Edit: I thought maybe somehow picking the inventory items might have screwed up "EventUnit" so I disabled everything but the respawn script.. still nothing.
@JTG2003: Go
One problem I discovered is that you can't have values for Stats - Revive Delay and Stats - Revive Time.
Check those out and make sure they're zero.
@eshestun: Go
Worked like a charm.
Thanks!
This whole lot just got me confused ... I want to use the custom script to avoid having to make buildings, as I'm doing a RPG-thingie. Now... How do I script it so that it will:
post a message, informing the player that his unit is dead, then ressurect the dead hero, owned by player 1-4 at RegionXX (or Start Location) after 3 seconds.
Blablabla I'm new to this whole editing thing, I managed to learn the WCIII over a while and as soon as I had the triggering all sorted out, I rerolled SCII and here there is no proper revive standard. As I don't know custom scripts at all, I'm just stuck.
I've gotten pretty far but now I'm stuck again, at the last 2 lines. - I figured it out after a while of mindless clicking... Just as I was about to give up I gave them all a go one last time, and boom there it was. Property.
@Benevolene: Go
Confirm, this tutorial works, and trigger for items also.
Dont forget to set hero death time in properties -1 or 10000
Yep, also confirmed, works and works well :)