As requested, I have released a new tutorial on hero revival. This is the system that I will be using in my (still in progress) RPG. It involves using Blizzard's system for campaign heroes, combined with a trigger for some extra stuff.
Part 1:
Right click the video and click watch on youtube to get widescreen/fullscreen. Subsequent parts in the descriptions...
EDIT - SOME FIXES:
Apparently it's firing multiple times, and bugging out for ranged attackers. Someone has mentioned a fix is to:
- change the event to be "Unit Takes Damage". Leave the rest, it should still work fine.
- To prevent multiple fires, make a boolean variable (array of size of number of players, all initially false) and then whenever this trigger runs, check that it's false for the player right away (first action is if-then-else), then if it is (aka 'Then' block), set the variable to be 'true' for that player and do the regular revival actions... and THEN after 20 seconds (aka at the end of this trigger), set it back to false for the player.
First of all, thanks for all the awsome tutorials! I learned a lot about the editor, thanks to you.
Secondly, I have implemented the new revival and it works, but I have a problem:
All units ingame are heros, but I only want to revive player-controlled units. It's certainly possible to remove the Valerian behaviour by using triggers, but whenever I see the slightest possibility to do something via the data editor I'd rather do that. Can you (or anyone else of course) help me out here? Maybe a validator could do the trick?
My Players are always number 1-9, all other slots are comps and shouldn't be revived...
Anyway, your dilemma is sort of interesting... what I would do is just add an if-then-else action somewhere RIGHT after the death/spirit animation plays. In the condition for it, check if Controller of Player (Triggering Player) == User. Then move the rest of the actions under the 'Then' part. So that way it looks like the unit is dead and faded out and all, but then if it's CPU it'll never respawn.
I don't really think there is a data solution for this... ^
Gotta say this saved me tons of time and helped me out. It was, however, confusing because it wasn't working right until I found this unlinked post and fixed the system.
My revised version of your trigger:
ReviveHeroEventsUnit-AnyUnittakesFatalorNon-FatalAnydamage(fromAnyeffects)LocalVariablesNoMultipleFires=false<Boolean[6]>DieingHero=(Triggeringunit)<Unit>KillingHero=(Damagingunit)<Unit>Actor=NoActor<Actor>GoldAmountTotal=0<Integer>GoldAmountLost=0<Integer>GoldAmountTransfered=0<Integer>ConditionsAndConditions((UnittypeofDieingHero)isHero)==true(DieingHerohasValerian02a-Incapacitated)==trueActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfNoMultipleFires[(OwnerofDieingHero)]==falseThenVariable-SetNoMultipleFires[(OwnerofDieingHero)]=trueVariable-SetGoldAmountTotal=(Player(OwnerofDieingHero)Vespene)Actor-CreateactormodelProtossSpiritDeathatpoint(PositionofDieingHero)Actor-Sendmessage"AnimPlay Death Death"toactor(Lastcreatedactor)Variable-SetActor=(Lastcreatedactor)Unit-TurnDieingHeroHighlightablestateOffUnit-TurnDieingHeroCursorstateOffUnit-TurnDieingHeroSelectablestateOffUnit-TurnDieingHeroStatusBarstateOffUnit-TurnDieingHeroTooltipsstateOffActor-Sendmessage"SetMinimapVisibility"toactor(ActorforDieingHero)General-If(Conditions)thendo(Actions)elsedo(Actions)If(DieingHeroisselectedbyplayer(OwnerofDieingHero))==trueThenUnitSelection-Deselectallunitsforplayer(OwnerofDieingHero)ElseUI-Display(((Text(Nameof(UnittypeofDieingHero))withcolor(Color((Currentplayer(OwnerofDieingHero)color))))+" has been killed by ")+((Text(Nameofplayer(OwnerofKillingHero))withcolor(Color((Currentplayer(OwnerofKillingHero)color))))for(Allplayers)toSubtitleareaGeneral-Wait3.0GameTimesecondsUnit-MoveDieingHeroinstantlytoTerranHeroRevive(NoBlend)Actor-Sendmessage"Destroy"toactorActorUnit-SetDieingHeroLife(Percent)to100.0Variable-SetGoldAmountLost=(GoldAmountTotal/4)Variable-SetGoldAmountTransfered=(GoldAmountLost/3)Player-Modifyplayer(OwnerofDieingHero)Vespene:SubtractGoldAmountLostUI-Display("You will revive in 20 seconds. You ..."+(("<c val="f2d560">"+(Text(GoldAmountLost)))+" gold!"))for(Playergroup((OwnerofDieingHero)))toSubtitleareaGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Controllerofplayer(OwnerofKillingHero))!=ComputerThenUI-Display("You recieved "+(("<c val="f2d560">"+(Text(GoldAmountTransfered)))+(" gold and "+("<c val="47d852">"+((Text((DieingHeroBounty(XP)(Default)))withAnyPrecisiondecimalplaces)+" experience!")))))for(Playergroup((OwnerofKillingHero)))toSubtitleareaPlayer-Modifyplayer(OwnerofKillingHero)Vespene:AddGoldAmountTransferedElseGeneral-Wait17.0GameTimesecondsUnit-TurnDieingHeroHighlightablestateOnUnit-TurnDieingHeroCursorstateOnUnit-TurnDieingHeroSelectablestateOnUnit-TurnDieingHeroStatusBarstateOnUnit-TurnDieingHeroTooltipsstateOnActor-Sendmessage"SetMinimapVisibility 1"toactor(ActorforDieingHero)Camera-Panthecameraforplayer(OwnerofDieingHero)toTerranHeroReviveover1.0secondswithExistingVelocity%initialvelocity,10%deceleration,andDoNotusesmartpanningUnitSelection-SelectDieingHeroforplayer(OwnerofDieingHero)Variable-SetNoMultipleFires[(OwnerofDieingHero)]=falseElse
This heals your hero before you can see him to full. It also subtracts 25% of your gold and transfers a third of that amount to the killing player.
After testing some more I noticed that it was and could sometimes STILL fire multiple times. Usually when being attacked by a ranged and melee @ the same time. So changing the "No Multiple Fires" variable to a global variable and then adding the variable check in the base trigger condition did the trick. No more multi-fires!
Here you go ppl:
ReviveHeroEventsUnit-AnyUnittakesFatalorNon-FatalAnydamage(fromAnyeffects)LocalVariablesDieingHero=(Triggeringunit)<Unit>KillingHero=(Damagingunit)<Unit>Actor=NoActor<Actor>GoldAmountTotal=0<Integer>GoldAmountLost=0<Integer>GoldAmountTransfered=0<Integer>ConditionsAndConditions((UnittypeofDieingHero)isHero)==true(DieingHerohasValerian02a-Incapacitated)==trueNoMultipleFires[(OwnerofDieingHero)]==falseActionsVariable-SetNoMultipleFires[(OwnerofDieingHero)]=trueVariable-SetGoldAmountTotal=(Player(OwnerofDieingHero)Vespene)Actor-CreateactormodelProtossSpiritDeathatpoint(PositionofDieingHero)Actor-Sendmessage"AnimPlay Death Death"toactor(Lastcreatedactor)Variable-SetActor=(Lastcreatedactor)Unit-TurnDieingHeroHighlightablestateOffUnit-TurnDieingHeroCursorstateOffUnit-TurnDieingHeroSelectablestateOffUnit-TurnDieingHeroStatusBarstateOffUnit-TurnDieingHeroTooltipsstateOffActor-Sendmessage"SetMinimapVisibility"toactor(ActorforDieingHero)General-If(Conditions)thendo(Actions)elsedo(Actions)If(DieingHeroisselectedbyplayer(OwnerofDieingHero))==trueThenUnitSelection-Deselectallunitsforplayer(OwnerofDieingHero)ElseUI-Display(((Text(Nameof(UnittypeofDieingHero))withcolor(Color((Currentplayer(OwnerofDieingHero)color))))+" has been killed by ")+((Text(Nameofplayer(OwnerofKillingHero))withcolor(Color((Currentplayer(OwnerofKillingHero)color))))for(Allplayers)toSubtitleareaGeneral-Wait3.0GameTimesecondsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfOrConditions(OwnerofDieingHero)==(Player1fromPlayers=Terran)(OwnerofDieingHero)==(Player2fromPlayers=Terran)ThenUnit-MoveDieingHeroinstantlytoTerranHeroRevive(NoBlend)ElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfOrConditions(OwnerofDieingHero)==(Player1fromPlayers=Protoss)(OwnerofDieingHero)==(Player2fromPlayers=Protoss)ThenUnit-MoveDieingHeroinstantlytoProtossHeroRevive(NoBlend)ElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfOrConditions(OwnerofDieingHero)==(Player1fromPlayers=Zerg)(OwnerofDieingHero)==(Player2fromPlayers=Zerg)ThenUnit-MoveDieingHeroinstantlytoZergHeroRevive(NoBlend)ElseActor-Sendmessage"Destroy"toactorActorUnit-SetDieingHeroLife(Percent)to100.0Variable-SetGoldAmountLost=(GoldAmountTotal/4)Variable-SetGoldAmountTransfered=(GoldAmountLost/3)Player-Modifyplayer(OwnerofDieingHero)Vespene:SubtractGoldAmountLostUI-Display("You will revive in 20 seconds. You ..."+(("<c val="f2d560">"+(Text(GoldAmountLost)))+" gold!"))for(Playergroup((OwnerofDieingHero)))toSubtitleareaGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Controllerofplayer(OwnerofKillingHero))!=ComputerThenUI-Display("You recieved "+(("<c val="f2d560">"+(Text(GoldAmountTransfered)))+(" gold and "+("<c val="47d852">"+((Text((DieingHeroBounty(XP)(Default)))withAnyPrecisiondecimalplaces)+" experience!")))))for(Playergroup((OwnerofKillingHero)))toSubtitleareaPlayer-Modifyplayer(OwnerofKillingHero)Vespene:AddGoldAmountTransferedElseGeneral-Wait17.0GameTimesecondsUnit-TurnDieingHeroHighlightablestateOnUnit-TurnDieingHeroCursorstateOnUnit-TurnDieingHeroSelectablestateOnUnit-TurnDieingHeroStatusBarstateOnUnit-TurnDieingHeroTooltipsstateOnActor-Sendmessage"SetMinimapVisibility 1"toactor(ActorforDieingHero)General-If(Conditions)thendo(Actions)elsedo(Actions)IfOrConditions(OwnerofDieingHero)==(Player1fromPlayers=Terran)(OwnerofDieingHero)==(Player2fromPlayers=Terran)ThenCamera-Panthecameraforplayer(OwnerofDieingHero)toTerranHeroReviveover1.0secondswithExistingVelocity%initialvelocity,10%deceleration,andDoNotusesmartpanningElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfOrConditions(OwnerofDieingHero)==(Player1fromPlayers=Protoss)(OwnerofDieingHero)==(Player2fromPlayers=Protoss)ThenCamera-Panthecameraforplayer(OwnerofDieingHero)toProtossHeroReviveover1.0secondswithExistingVelocity%initialvelocity,10%deceleration,andDoNotusesmartpanningElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfOrConditions(OwnerofDieingHero)==(Player1fromPlayers=Zerg)(OwnerofDieingHero)==(Player2fromPlayers=Zerg)ThenCamera-Panthecameraforplayer(OwnerofDieingHero)toZergHeroReviveover1.0secondswithExistingVelocity%initialvelocity,10%deceleration,andDoNotusesmartpanningElseUnitSelection-SelectDieingHeroforplayer(OwnerofDieingHero)Variable-SetNoMultipleFires[(OwnerofDieingHero)]=false
Hey,
Mine works fine, BUT its only works ones if my hero dies twice he wont respawn the second time....where do i change how often he can respawn?? cant seem to find it...
As requested, I have released a new tutorial on hero revival. This is the system that I will be using in my (still in progress) RPG. It involves using Blizzard's system for campaign heroes, combined with a trigger for some extra stuff.
Part 1:
Right click the video and click watch on youtube to get widescreen/fullscreen. Subsequent parts in the descriptions...
Map DL link: Link Removed: http://www.mediafire.com/?qwvgns857w2fno4
EDIT - SOME FIXES:
Apparently it's firing multiple times, and bugging out for ranged attackers. Someone has mentioned a fix is to:
- change the event to be "Unit Takes Damage". Leave the rest, it should still work fine.
- To prevent multiple fires, make a boolean variable (array of size of number of players, all initially false) and then whenever this trigger runs, check that it's false for the player right away (first action is if-then-else), then if it is (aka 'Then' block), set the variable to be 'true' for that player and do the regular revival actions... and THEN after 20 seconds (aka at the end of this trigger), set it back to false for the player.
@OneTwoSC: Go
First of all, thanks for all the awsome tutorials! I learned a lot about the editor, thanks to you.
Secondly, I have implemented the new revival and it works, but I have a problem:
All units ingame are heros, but I only want to revive player-controlled units. It's certainly possible to remove the Valerian behaviour by using triggers, but whenever I see the slightest possibility to do something via the data editor I'd rather do that. Can you (or anyone else of course) help me out here? Maybe a validator could do the trick?
My Players are always number 1-9, all other slots are comps and shouldn't be revived...
@Obatztrara: Go
Added some fixes in the original post...
Anyway, your dilemma is sort of interesting... what I would do is just add an if-then-else action somewhere RIGHT after the death/spirit animation plays. In the condition for it, check if Controller of Player (Triggering Player) == User. Then move the rest of the actions under the 'Then' part. So that way it looks like the unit is dead and faded out and all, but then if it's CPU it'll never respawn.
I don't really think there is a data solution for this... ^
Gotta say this saved me tons of time and helped me out. It was, however, confusing because it wasn't working right until I found this unlinked post and fixed the system.
My revised version of your trigger:
This heals your hero before you can see him to full. It also subtracts 25% of your gold and transfers a third of that amount to the killing player.
After testing some more I noticed that it was and could sometimes STILL fire multiple times. Usually when being attacked by a ranged and melee @ the same time. So changing the "No Multiple Fires" variable to a global variable and then adding the variable check in the base trigger condition did the trick. No more multi-fires!
Here you go ppl:
Hey, Mine works fine, BUT its only works ones if my hero dies twice he wont respawn the second time....where do i change how often he can respawn?? cant seem to find it...
how would you add lives to this?