What is the best way to "kill" a unit and then revive it later, assuming that unit has learned abilities that need to be retained? I know there is a heroic revival system of sorts in place, but it seemed over complicated for what I wanted. My current method is simply hiding the unit in question, spawning and then killing a dummy unit of the same type on top of it for death animation, then teleporting it to it's revival point to be unhidden later. My method also works because my game does not used damage as death is collision based. Is there a simpler/more efficient method for this?
My second question is marking a unit with a custom flag ie the previous example marking if a unit is "dead" or not. Would it be better to simply save the value as a boolean, or mark the unit with a behavior? I currently have a record holding values for all players and each player only has a single unit. Players[i].unit.isDead == false vs UnitHasBehavior(unit, "dead") == false. I know it is subtle, but I'm wanting to check conditions like this multiple times a second for multiple players.
Thanks for any help.
TLDR SOLUTION: Setting a unit's death time to -1 in the data editor allows you to use the revive unit function freely in the trigger editor. You may also need to change the unit revive type in data editor if you are not using premade units. Thanks TyaStarcraft.
Create a behavior, make it a damage response. if the unit takes fatal damage, prevent death; make it invulnerable, then pause it, stun it, make it invisible, uncontrollable, ect. Make it "look" gone. then bring it back later. You can set a death and respawn animation to play as well, to really make it look nice.
The inbuilt revive system is actually incredibly simple.
Set a unit's death time to -1.
That's it. The unit can now be revived whenever you please. To compliment this;
1) Make an effect-instant ability.
2) Set it to auto-cast and auto-cast initiailly on. Also set it's auto-cast filter to "player", "self" and "dead".
3) Give it a prepare time of, say, 30 seconds. This time would be the time to revive.
4) Add a modify effect onto the end of it. Tick the "revive" flag in the modify effect and set the vitals to "1" for life and (if you desire) energy.
Your unit will now revive itself after 30 seconds upon death. No triggers required. Total time to implement; about 60 seconds.
One problem I personally ran into with the built in hero revive system was from adding stats to a unit. Say I used a trigger to add 50 attribute points to a unit; he would lose those points when he revived.
I do like tya's revive system. You can use a similar one with the buff I mentioned above as well; when triggered, you can add a behavior to the dead unit which automatically "revives" him after X time, by removing the death buff, and restoring life/energy to the unit.
My current system is almost exactly what GlornII describes. What Tya is describing sounds really nice, however I don't actually plan to implement a damage as death is entirely collision based. Would it be worth it to try to scrap triggers and try to move to damage?
Basically there are friendlies (Players), hostiles (AI), and death markers. Friendly colliding with hostile, friendly dies and leaves a death marker at location. Friendly collides with other player's death marker, dead friendly respawns at level spawn. I'm currently using triggers to check collision quite rapidly which is working well, but I am worried about lag with many players/levels with many hostiles.
In theory I could have a hostile unit consonantly applying damage around itself that affects friendlies but not death markers, and the same for friendlies where it affects death markers and not hostiles. I would then probably still use triggers to detect friendly death to place marker and for detecting reviving when death marker dies.
Worth it to implement a system like this?
TLDR SOLUTION: Setting a unit's death time to -1 in the data editor allows you to use the revive unit function freely in the trigger editor. You may also need to change the unit revive type in data editor if you are not using premade units. Thanks TyaStarcraft.
What is the best way to "kill" a unit and then revive it later, assuming that unit has learned abilities that need to be retained? I know there is a heroic revival system of sorts in place, but it seemed over complicated for what I wanted. My current method is simply hiding the unit in question, spawning and then killing a dummy unit of the same type on top of it for death animation, then teleporting it to it's revival point to be unhidden later. My method also works because my game does not used damage as death is collision based. Is there a simpler/more efficient method for this?
My second question is marking a unit with a custom flag ie the previous example marking if a unit is "dead" or not. Would it be better to simply save the value as a boolean, or mark the unit with a behavior? I currently have a record holding values for all players and each player only has a single unit. Players[i].unit.isDead == false vs UnitHasBehavior(unit, "dead") == false. I know it is subtle, but I'm wanting to check conditions like this multiple times a second for multiple players.
Thanks for any help.
TLDR SOLUTION: Setting a unit's death time to -1 in the data editor allows you to use the revive unit function freely in the trigger editor. You may also need to change the unit revive type in data editor if you are not using premade units. Thanks TyaStarcraft.
The easiest way, is not to kill the unit.
Create a behavior, make it a damage response. if the unit takes fatal damage, prevent death; make it invulnerable, then pause it, stun it, make it invisible, uncontrollable, ect. Make it "look" gone. then bring it back later. You can set a death and respawn animation to play as well, to really make it look nice.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
The inbuilt revive system is actually incredibly simple.
Set a unit's death time to -1.
That's it. The unit can now be revived whenever you please. To compliment this;
1) Make an effect-instant ability.
2) Set it to auto-cast and auto-cast initiailly on. Also set it's auto-cast filter to "player", "self" and "dead".
3) Give it a prepare time of, say, 30 seconds. This time would be the time to revive.
4) Add a modify effect onto the end of it. Tick the "revive" flag in the modify effect and set the vitals to "1" for life and (if you desire) energy.
Your unit will now revive itself after 30 seconds upon death. No triggers required. Total time to implement; about 60 seconds.
One problem I personally ran into with the built in hero revive system was from adding stats to a unit. Say I used a trigger to add 50 attribute points to a unit; he would lose those points when he revived.
I do like tya's revive system. You can use a similar one with the buff I mentioned above as well; when triggered, you can add a behavior to the dead unit which automatically "revives" him after X time, by removing the death buff, and restoring life/energy to the unit.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
oops, somehow managed to double post. sorry!
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
My current system is almost exactly what GlornII describes. What Tya is describing sounds really nice, however I don't actually plan to implement a damage as death is entirely collision based. Would it be worth it to try to scrap triggers and try to move to damage?
Basically there are friendlies (Players), hostiles (AI), and death markers. Friendly colliding with hostile, friendly dies and leaves a death marker at location. Friendly collides with other player's death marker, dead friendly respawns at level spawn. I'm currently using triggers to check collision quite rapidly which is working well, but I am worried about lag with many players/levels with many hostiles.
In theory I could have a hostile unit consonantly applying damage around itself that affects friendlies but not death markers, and the same for friendlies where it affects death markers and not hostiles. I would then probably still use triggers to detect friendly death to place marker and for detecting reviving when death marker dies.
Worth it to implement a system like this?
TLDR SOLUTION: Setting a unit's death time to -1 in the data editor allows you to use the revive unit function freely in the trigger editor. You may also need to change the unit revive type in data editor if you are not using premade units. Thanks TyaStarcraft.