• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Hero Revival System Needs Help

Status
Not open for further replies.
Level 12
Joined
Jun 28, 2008
Messages
688
I have set up a hero revival system that will revive a dying hero (their level) seconds later. The variable "Hunter" (unit variable) has an array of 5 (as there is only 5 heros on the map) and is set accordingly at map initialization.

I have 15 regions on the map that act as respawn points, and are set to the region variable with an array of 15 "RezLoc" at map initialization.

This is the activating trigger:

  • HeroRez
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set DeadHero = (Triggering unit)
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of DeadHero) Equal to (Player((Integer A)))
            • Then - Actions
              • Set RezPoint = (Center of RezLoc[(Random integer number between 1 and 15)])
              • Wait (Real((Hero level of DeadHero))) seconds
              • Hero - Instantly revive Hunter[(Integer A)] at RezPoint, Hide revival graphics
              • Custom script: call RemoveLocation(udg_RezPoint)
            • Else - Actions
              • Do nothing
My problem is that if two heros die within the alotted time of eachother, one of them will not respawn. I've actually never used the Loop Integer A action, so my problem probably lies there. Help would be greatly appreciated.
 
Level 4
Joined
Sep 24, 2004
Messages
49
It's because the "DeadHero" Variable is a global
When you set it to something - it gets over written
DeadHero = Hero[1]
then.. Hero[3] dies before Hero[1] is revived
DeadHero = Hero[3]; and NOT Hero[1]


Try -

  • HeroRez
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Custom script: local unit DeadHero = GetTriggerUnit()
      • Custom script: local location RezPoint = udg_RezLoc[GetRandomInt(1, 15)]
      • Wait (Real((Hero level of (Triggering unit)))) seconds
      • Custom script: call ReviveHeroLoc( DeadHero, RezPoint, false )
      • Custom script: call RemoveLocation(RezPoint)
Don't hold me to it - haven't tested that: but in theory - Should Work
 
Last edited:
Level 9
Joined
May 27, 2006
Messages
498
  • Rez
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Wait (Real((Hero level of (Triggering unit)))) seconds
      • Set TempPoint = (Center of RezRect[(Random integer number between 1 and 15)])
      • Hero - Instantly revive (Triggering unit) at TempPoint, Hide revival graphics
      • Custom script: call RemoveLocation(udg_TempPoint)
Is enough. And yes, it does work for all units.
 

Attachments

  • TriggeringUnitMUITest.w3x
    21.8 KB · Views: 50
Level 4
Joined
Sep 24, 2004
Messages
49
  • Rez
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Wait (Real((Hero level of (Triggering unit)))) seconds
      • Set TempPoint = (Center of RezRect[(Random integer number between 1 and 15)])
      • Hero - Instantly revive (Triggering unit) at TempPoint, Hide revival graphics
      • Custom script: call RemoveLocation(udg_TempPoint)
Is enough.
Lol. I always thought that you can't use "Trigger Unit" and Event Responses after waits - but: I guess you can; Dunno where I picked that up from....
 
Status
Not open for further replies.
Top