HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Hero Resurrection

08-29-2003, 01:32 PM#1
Navi
I"m sure this must have been addressed but the threads I find don't seem to finish it.

I want the resurrect ultimate to work on heroes for my map.
The obvious problem is the heroes don't leave corpses so there is no target for resurrect to work upon.

I can save the dying hero and swap in some temp unit and instantly kill it to make a target corpse but when res brings the corpse back to life it's the temp unit. I would really like to instantly swap that temp unit with my stored hero but I'm not sure how to trigger it.

I was trying to use Unit - Finishes Reviving but I'm getting the feeling that Reviving might be what happens at an alter which is different from what happens to a unitcorpse to unit from res.

Any help would be welcome. :)
08-29-2003, 05:24 PM#2
Panto
Units being resurrected count as summons for some reason, so you'd want
Quote:
Events:
A Unit is Summoned
Conditions:
Unit being Summoned is equal to Your mother.
where Your mother is the unit you want to replace with your stored hero.
08-29-2003, 06:00 PM#3
Navi
Great info! Thanks.
Seems to be rather simple now that I know that!

If this works I'll post it all up so others can see how it's done.
08-29-2003, 07:19 PM#4
Vraq
Quote:
The obvious problem is the heroes don't leave corpses so there is no target for resurrect to work upon.
Can't you just bring the Heroes up in the Object Editor and change their "Combat - Death Type" fields to "Can raise, does decay"?

I've never tried it on Heroes so I don't know if it actually works or not. Just a thought.
08-29-2003, 08:06 PM#5
Navi
Surprisingly that doesn't work. That's what I first tried.
I'm not sure how that particular attribute applies to heros.
Raise might mean "you can raise the hero using an alter".

But all I know for sure is that resurrect seems to need a corpse to target. When standard units die they leave a corpse which is tied to the original unit. A hero does not leave a corpse and if you create a corpse for resurrect to target it would need to be connected to the hero somehow.

Does anyone know when to use "Can raise, does decay" for a hero?
08-30-2003, 05:11 AM#6
Navi
I got it working. Here is my first draft.

First I make a custom unit for each player: p1corpse, p2corpse, etc. On this unit be sure to set Combat - Death Type = Can raise, does decay. (it doesn't work if it's set to doesn't decay for some reason)

Make a custom modification of Resurrect and set the Data - Number of corpses raises = 1
Use this spell where you would normally use res.

Make a trigger for each player as such:
p1HeroCorpse
Events
Unit - A unit owned by Player 1 (Red) Dies
Conditions
(Unit-type of (Dying unit)) Equal to Squire
Actions
Set DeadHeroes[1] = (Dying unit)
Unit - Create a p1herocorpse corpse for Player 1 (Red) at (Position of (Dying unit))
*repeat for each player*

Create an integer array DeadHeros size equal to one more than the max number of players you will have:

Create a whichplayer Integer variable


Make another trigger:
HeroRes
Events
Unit - A unit owned by Player 1 (Red) Spawns a summoned unit
Conditions
Actions
If ((Unit-type of (Summoned unit)) Equal to p1herocorpse) then do (Set whichplayer = 1) else do (Do nothing)
If ((Unit-type of (Summoned unit)) Equal to p2herocorpse) then do (Set whichplayer = 2) else do (Do nothing)
Hero - Instantly revive DeadHeroes[whichplayer] at (Position of (Summoned unit)), Show revival graphics
Unit - Remove (Summoned unit) from the game

To bring back a weakened hero rather than one full of life use a trigger like:
ReviveReduce
Events
Unit - A unit Finishes reviving
Conditions
Actions
Unit - Set life of (Triggering unit) to 25.00%
Unit - Set mana of (Triggering unit) to 25.00%


It all works like this. When a hero dies it sets off the p1HeroCorpse trigger for that player which saves the hero into the correct player slot and then quickly brings in the custom corpse unit for that player and kills it to create a corpse for your hero. When the res spell "summons" this corpse the HeroRes trigger swaps the custom corpse unit with the hero saved. Then the ReviveReduce lowers the stats of the hero.

Notes: Revive is what an alter does to a hero. When the are being "built" in an alter that's reviving. Resurrection "summons" a unit associated with a target(s) corpse.

I hope this makes sense I'm rather tired while typing this all up. :)
08-30-2003, 06:43 AM#7
Panto
That makes sense to me, from glancing through it.

I appreciate your willingness to follow through and post the results of your question to the forum. Such behavior will make it much easier to aid people with the same question in the future.