Okay, you may have noticed that heroes tend to drop their items on death even if 'drops on death' is turned off in the item data.
To fix this:
Make a trigger that goes off when a unit dies; condition: unit is [your hero].
Use the add region action to create a positive circular region with a size of 0.01 at the location of triggering unit. Then pick each unit in the region with unit type item, add them to a unit group variable (global array or local) and move each picked unit to some place in a corner of the map. (It may be hackish, but afaik there's no 'unit type group' so you will need to keep an example of each item on hand)
Then use the wait action to sit out the revive time; after this, respawn the hero.* Then pick each unit in the unit group you just made and for each picked unit, spawn one unit type of picked unit into the hero's inventory and remove it. Finally empty out your unit group if it's a global array variable.
For this to work, it is important that 'drops on death' is turned ON in the item data. If it is off, you may get the behaviour I experienced where everything works fine the first time and then the second time you die it leaves your items on the ground.
'Triggering player' doesn't always survive a wait action. You will need to assign your triggering player a (local) variable before the wait and refer to him/her as said variable after the wait.
it works, but then it causes another bug..... because you are using triggers to revive heros....... all thier attributes/levels are forgetton. so while this fix works, ..it just leads to another bug.
Okay, you may have noticed that heroes tend to drop their items on death even if 'drops on death' is turned off in the item data.
To fix this:
Make a trigger that goes off when a unit dies; condition: unit is [your hero]. Use the add region action to create a positive circular region with a size of 0.01 at the location of triggering unit. Then pick each unit in the region with unit type item, add them to a unit group variable (global array or local) and move each picked unit to some place in a corner of the map. (It may be hackish, but afaik there's no 'unit type group' so you will need to keep an example of each item on hand)
Then use the wait action to sit out the revive time; after this, respawn the hero.* Then pick each unit in the unit group you just made and for each picked unit, spawn one unit type of picked unit into the hero's inventory and remove it. Finally empty out your unit group if it's a global array variable.
For this to work, it is important that 'drops on death' is turned ON in the item data. If it is off, you may get the behaviour I experienced where everything works fine the first time and then the second time you die it leaves your items on the ground.
Thanks a lot dude!
@TheNiceGuy: Go
it works, but then it causes another bug..... because you are using triggers to revive heros....... all thier attributes/levels are forgetton. so while this fix works, ..it just leads to another bug.
@Jinxxx123:
This is a bit dated. There have been new ways found to revive heroes w/ triggers and keep thier items and such.
http://forums.sc2mapster.com/development/tutorials/5020-video-triggers-hero-revival/#p15
Thats a link to another tutorial that covers hero revive w/ all their stats and level intact as well as items.