• 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.

Compact Hero Selector help!!

Status
Not open for further replies.
Level 7
Joined
Jan 23, 2011
Messages
351
You can set Region[] and HeroRegion[], variables and then using one trigger with all your regions(if you use the Trigger - Add Event action on your initialization with a loop for each Region[integer A] is less frustating)

Then in the trigger, you check Is Unit in Region
Loop integer A
Is Triggering Unit in Region[integer A] then
Create HeroRegion[integer A]
Other actions
custom script: exitwhen true
Endif
Endloop
 
Level 6
Joined
Apr 20, 2016
Messages
215
You can set Region[] and HeroRegion[], variables and then using one trigger with all your regions(if you use the Trigger - Add Event action on your initialization with a loop for each Region[integer A] is less frustating)

Then in the trigger, you check Is Unit in Region
Loop integer A
Is Triggering Unit in Region[integer A] then
Create HeroRegion[integer A]
Other actions
custom script: exitwhen true
Endif
Endloop
Idk Codes can you teach me how to make a code in the trigger editor
 
Level 4
Joined
Dec 24, 2010
Messages
67
He meant this:

  • Melee Initialization
    • Events
      • Unit - A unit enters Region 000 blademaster <gen>
      • Unit - A unit enters Region 001 farseer <gen>
      • Unit - A unit enters Region 002 taurenchieftain <gen>
      • Unit - A unit enters Region 003 shadowhunter <gen>
    • Conditions
    • Actions
      • Set TempUnit = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Region 000 blademaster <gen> contains TempUnit) Equal to True
        • Then - Actions
          • Game - Display to (All players) for 5.00 seconds the text: Hero = Blademaster
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Region 001 farseer <gen> contains TempUnit) Equal to True
        • Then - Actions
          • Game - Display to (All players) for 5.00 seconds the text: Hero = FarSeer
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Region 002 taurenchieftain <gen> contains TempUnit) Equal to True
        • Then - Actions
          • Game - Display to (All players) for 5.00 seconds the text: Hero = TaurenChieft...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Region 003 shadowhunter <gen> contains TempUnit) Equal to True
        • Then - Actions
          • Game - Display to (All players) for 5.00 seconds the text: Hero = ShadowHunter
        • Else - Actions
I wouldn't recommend it though. GUI unit-in-regions detection is buggy.
I'll attach the map so you can test it yourself.

Notice that if the unit is entering from bottom and right side of the region, it is not detected.
 

Attachments

  • BuggyHeroSelection.w3x
    13.3 KB · Views: 42
Level 8
Joined
Jan 28, 2016
Messages
486
I wouldn't recommend it though. GUI unit-in-regions detection is buggy.
I'll attach the map so you can test it yourself.

Notice that if the unit is entering from bottom and right side of the region, it is not detected.

Tried the map and that bug is a nightmare. I vaguely recall something about the game detecting units based on the top-right corner of the area they occupy and might be the reason behind this bug, but this is all speculation. I'm curious to see if anyone has any information in regards to this bug.

By the way, I was thinking of setting up the triggers like so:
  • Map Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set HeroSelectRegion[1] = Area 1 <gen>
      • Set HeroSelectRegion[2] = Area 2 <gen>
      • Set HeroSelectRegion[3] = Area 3 <gen>
      • Set HeroSelectRegionMax = 3
  • Region Hero Select
    • Events
      • Unit - A unit enters Area 1 <gen>
      • Unit - A unit enters Area 2 <gen>
      • Unit - A unit enters Area 3 <gen>
    • Conditions
    • Actions
      • Set TempUnit = (Triggering unit)
      • For each (Integer TempInteger) from 1 to HeroSelectRegionMax, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (HeroSelectRegion[TempInteger] contains TempUnit) Equal to True
              • (TempUnit is alive) Equal to True
              • (TempUnit is A Hero) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: (String(TempInteger))
            • Else - Actions
 
Status
Not open for further replies.
Top