How do you make a hero respawn in a random region each time?

Astal

New Member
Reaction score
1
I have respawn code that kinda works if someone could help me with that at the same time.

I need Gollum to spawn in 1 out of 8 regions when he dies or is captured. Also a problem with my respawn timers. The timer window doesnt go away after the hero respawns. Thanks guys

Trigger:
  • Revive Hero
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
    • Actions
      • Unit Group - Add (Dying unit) to RevivableHeroes
      • Set TempReal = 20.00
      • Countdown Timer - Start ReviveTimers[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in TempReal seconds
      • -------- Seperate --------
      • Countdown Timer - Create a timer window for (Last started timer) with title (Name of (Owner of (Dying unit)))
      • Countdown Timer - Show (Last created timer window) for (Owner of (Dying unit))
      • Set RevivableTimersWindows[(Player number of (Owner of (Dying unit)))] = (Last created timer window)


Trigger:
  • Revive Hero Timer
    • Events
      • Time - ReviveTimers[1] expires
      • Time - ReviveTimers[2] expires
      • Time - ReviveTimers[3] expires
      • Time - ReviveTimers[4] expires
      • Time - ReviveTimers[5] expires
      • Time - ReviveTimers[6] expires
      • Time - ReviveTimers[8] expires
      • Time - ReviveTimers[9] expires
      • Time - ReviveTimers[10] expires
      • Time - ReviveTimers[11] expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in RevivableHeroes and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for ReviveTimers[(Player number of (Owner of (Picked unit)))]) Less than 1.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Owner of (Picked unit)) is in PlayersRangers) Equal to True
                • Then - Actions
                  • Hero - Instantly revive (Picked unit) at (Center of Rangers Spawn <gen>), Show revival graphics
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Owner of (Picked unit)) is in PlayersOrcs) Equal to True
                    • Then - Actions
                      • Hero - Instantly revive (Picked unit) at (Center of Orc Trackers Spawn <gen>), Show revival graphics
                    • Else - Actions
                      • Hero - Instantly revive (Picked unit) at (Center of Gollum Spawn 1 <gen>), Show revival graphics
            • Else - Actions
 

FhelZone

Have a drink of a nice cold mellowberry juice!
Reaction score
103
Uhm... Have a trigger function to destroy a specific timer... Just look at the countdown timer triggers, I think you will find destroy timer in that category...
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
well, to revive your unit you use:
Trigger:
  • Hero - Instantly revive (Picked unit) at (Center of Rangers Spawn <gen>), Show revival graphics

(by the way it leaks a location)

just change the "(Center of Rangers Spawn)" to "(Random Point in Rangers Spawn)" and it will spawn in a random position.

however, this leaks, you should use a point variable to clean the leak.
like:
Trigger:
  • set TempPoint = (Random Point in Rangers Spawn)
    • Hero - Instantly revive (Picked unit) at TempPoint, Show revival graphics
    • custom script: call RemoveLocation (udg_TempPoint)
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Set each of your regions to an array variable, and use a random integer to pick one of those from the array:

Trigger:
  • Actions
    • Set Regions[1] = Spawn 1 <gen>
    • Set Regions[2] = Spawn 2 <gen>
    • Set Regions[3] = Spawn 3 <gen>
    • Set Regions[4] = Spawn 4 <gen>
    • Set TempPoint = (Random Point in Regions[(Random integer from 1 to 4)])
    • Hero - Instantly revive Hero at TempPoint, Show revival graphics
    • Custom script: call RemoveLocation(udg_TempPoint)
 

Astal

New Member
Reaction score
1
Set each of your regions to an array variable, and use a random integer to pick one of those from the array:

Trigger:
  • Actions
    • Set Regions[1] = Spawn 1 <gen>
    • Set Regions[2] = Spawn 2 <gen>
    • Set Regions[3] = Spawn 3 <gen>
    • Set Regions[4] = Spawn 4 <gen>
    • Set TempPoint = (Random Point in Regions[(Random integer from 1 to 4)])
    • Hero - Instantly revive Hero at TempPoint, Show revival graphics
    • Custom script: call RemoveLocation(udg_TempPoint)

where do you find the random integer, it doesnt come up in options
Trigger:
  • Set TempPoint = (Random Point in Regions[(Random integer from 1 to 4)])
 

Astal

New Member
Reaction score
1
Code:
Math - Random Number

when the variable is a point it wont let me pick math


ahh i see what u did there

thank you, now i just have to make a multiboard and tweak my abilities and stuff and the map will be done
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top