• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[Solved] Help with visibility regions

Status
Not open for further replies.
so i have 5 regions in my map on different places and and different times of the game, one has to be visible to all and the others fogged.

1. in my map all 12 player slots are taken , and neutral passive has some vendors that should not be visible to all, so i cant use the trigger
"Make neutral passive treat player A as neutral with shared vision"
2. The most logical thing I tried was with visbility regions...
this creates visibility for when you begin the game >
  • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Hills[HILL_Index]
      • Set Visibility_Region[(Integer A)] = (Last created visibility modifier)
and then after time X passed, it will move
  • relocate hill
    • Events
      • Time - Timer_MoveHill expires
    • Conditions
    • Actions
      • Animation - Play Hill_Unit's death animation
      • Wait 1.00 game-time seconds
      • Custom script: loop
      • Set RandomNum = (Random integer number between 1 and 5)
      • Custom script: exitwhen udg_HILL_Index != udg_RandomNum
      • Custom script: endloop
      • Set HILL_Index = RandomNum
      • Unit - Move Hill_Unit instantly to Hills_Locs[HILL_Index]
      • Unit Group - Remove all units from Hill_Current_Units
      • Game - Display to (All players) the text: The hill have reloc...
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Visibility - Destroy Hill_Visibility[(Integer A)]
          • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Hills[HILL_Index]
          • Set Visibility_Region[(Integer A)] = (Last created visibility modifier)
      • Sound - Play MapPing <gen>
      • Cinematic - Ping minimap for (All players) at Hills_Locs[HILL_Index] for 10.00 seconds
but the problem is... the previous visibility stays even though I destroy it.... help!
 
In the first loop you assign the last created visibility modifier into Visibilty_Region[ ], but in the second trigger you are destroying visibility modifier in Hill_Visibility[ ]
Ah thanks, I'm so distracted.
So I changed Hill_Visibility with Visbility_Region, and it's the same... is there any engine bug with these visibility modifiers?
It's like once created you cannot undo it...
 
Last edited:
Okay, these are my triggers.
The previous one does not get fogged and the next one does not get visibility now


  • visibility regions
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • For each (Integer B) from 1 to 12, do (Actions)
            • Loop - Actions
              • Visibility - Create an initially Disabled visibility modifier for (Player((Integer A))) emitting Visibility across Hills[1]
              • Set Visibility_Region[(Integer B)] = (Last created visibility modifier)
          • For each (Integer B) from 13 to 24, do (Actions)
            • Loop - Actions
              • Visibility - Create an initially Disabled visibility modifier for (Player((Integer A))) emitting Visibility across Hills[2]
              • Set Visibility_Region[(Integer B)] = (Last created visibility modifier)
          • For each (Integer B) from 25 to 36, do (Actions)
            • Loop - Actions
              • Visibility - Create an initially Disabled visibility modifier for (Player((Integer A))) emitting Visibility across Hills[3]
              • Set Visibility_Region[(Integer B)] = (Last created visibility modifier)
          • For each (Integer B) from 37 to 48, do (Actions)
            • Loop - Actions
              • Visibility - Create an initially Disabled visibility modifier for (Player((Integer A))) emitting Visibility across Hills[4]
              • Set Visibility_Region[(Integer B)] = (Last created visibility modifier)
          • For each (Integer B) from 49 to 60, do (Actions)
            • Loop - Actions
              • Visibility - Create an initially Disabled visibility modifier for (Player((Integer A))) emitting Visibility across Hills[5]
              • Set Visibility_Region[(Integer B)] = (Last created visibility modifier)
      • Set Hill_ValidIndexStart[1] = 1
      • Set Hill_ValidIndexStart[1] = 12
      • Set Hill_ValidIndexStart[2] = 13
      • Set Hill_ValidIndexStart[2] = 24
      • Set Hill_ValidIndexStart[3] = 25
      • Set Hill_ValidIndexStart[3] = 36
      • Set Hill_ValidIndexStart[4] = 37
      • Set Hill_ValidIndexStart[4] = 48
      • Set Hill_ValidIndexStart[5] = 49
      • Set Hill_ValidIndexStart[5] = 60
  • relocate hill
    • Events
      • Time - Timer_MoveHill expires
    • Conditions
    • Actions
      • Animation - Play Hill_Unit's death animation
      • Wait 1.00 game-time seconds
      • -------- ------------------------------------ --------
      • Custom script: loop
      • Set RandomNum = (Random integer number between 1 and 5)
      • Custom script: exitwhen udg_HILL_Index != udg_RandomNum
      • Custom script: endloop
      • Set HILL_Index = RandomNum
      • -------- ------------------------------------ --------
      • Unit Group - Remove all units from Hill_Current_Units
      • -------- ------------------------------------ --------
      • Game - Display to (All players) the text: The hill have reloc...
      • -------- ------------------------------------ --------
      • For each (Integer A) from 1 to 60, do (Actions)
        • Loop - Actions
          • Visibility - Disable Visibility_Region[(Integer A)]
      • For each (Integer A) from Hill_ValidIndexStart[HILL_Index] to Hill_ValidIndexEnd[HILL_Index], do (Actions)
        • Loop - Actions
          • Visibility - Enable Visibility_Region[(Integer A)]
      • -------- ------------------------------------ --------
      • Sound - Play MapPing <gen>
      • Cinematic - Ping minimap for (All players) at Hills_Locs[HILL_Index] for 10.00 seconds
      • Unit - Move Hill_Unit instantly to Hills_Locs[HILL_Index]
      • Animation - Play Hill_Unit's birth animation
      • Wait 1.00 game-time seconds
      • Animation - Play Hill_Unit's stand animation
 
Level 26
Joined
Sep 26, 2009
Messages
2,439
Ignoring everything else, this is definitely one of the issues:
  • Set Hill_ValidIndexStart[1] = 1
  • Set Hill_ValidIndexStart[1] = 12
  • Set Hill_ValidIndexStart[2] = 13
  • Set Hill_ValidIndexStart[2] = 24
  • Set Hill_ValidIndexStart[3] = 25
  • Set Hill_ValidIndexStart[3] = 36
  • Set Hill_ValidIndexStart[4] = 37
  • Set Hill_ValidIndexStart[4] = 48
  • Set Hill_ValidIndexStart[5] = 49
  • Set Hill_ValidIndexStart[5] = 60
 

Uncle

Warcraft Moderator
Level 67
Joined
Aug 10, 2018
Messages
6,953
This may work better, it looks like you want a 2d array:
  • Setup Hills
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set VariableSet Hill_Hashtable = (Last created hashtable)
      • Set VariableSet Hill_Region[1] = HillA <gen>
      • Set VariableSet Hill_Region[2] = HillB <gen>
      • Set VariableSet Hill_Region[3] = HillC <gen>
      • Set VariableSet ActiveUsers = (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)).)
      • -------- --------
      • -------- ActiveUsers is a Player Group that contains all of the Users actively playing the game from the start (you should remove Leavers!) --------
      • Player Group - Pick every player in ActiveUsers and do (Actions)
        • Loop - Actions
          • Set VariableSet Hill_PN = (Player number of (Picked player))
          • For each (Integer A) from 1 to 3, do (Actions)
            • Loop - Actions
              • Visibility - Create an initially Disabled visibility modifier for (Picked player) emitting Visibility across Hill_Region[(Integer A)]
              • Hashtable - Save Handle Of(Last created visibility modifier) as (Integer A) of Hill_PN in Hill_Hashtable.
  • Toggle Hills
    • Events
    • Conditions
    • Actions
      • -------- Disable old visibility: --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Hill_Index Not equal to 0
        • Then - Actions
          • Player Group - Pick every player in ActiveUsers and do (Actions)
            • Loop - Actions
              • Set VariableSet Hill_PN = (Player number of (Picked player))
              • Visibility - Disable (Load Hill_Index of Hill_PN in Hill_Hashtable.)
        • Else - Actions
      • -------- --------
      • Set VariableSet Hill_Index = (Random integer number between 1 and 3)
      • -------- --------
      • -------- Enable new visibility: --------
      • Player Group - Pick every player in ActiveUsers and do (Actions)
        • Loop - Actions
          • Set VariableSet Hill_PN = (Player number of (Picked player))
          • Visibility - Enable (Load Hill_Index of Hill_PN in Hill_Hashtable.)
Edit: Tested it and can confirm that it works fine on the latest version (1.35).
 
Last edited:
Ignoring everything else, this is definitely one of the issues:
well, what do you know. Am I an idiot or what?

fixed that. Same. Previous region is not hidden, next is not shown.

  • Set Hill_ValidIndexStart[1] = 1
  • Set Hill_ValidIndexEnd[1] = 12
  • Set Hill_ValidIndexStart[2] = 13
  • Set Hill_ValidIndexEnd[2] = 24
  • Set Hill_ValidIndexStart[3] = 25
  • Set Hill_ValidIndexEnd[3] = 36
  • Set Hill_ValidIndexStart[4] = 37
  • Set Hill_ValidIndexEnd[4] = 48
  • Set Hill_ValidIndexStart[5] = 49
  • Set Hill_ValidIndexEnd[5] = 60
[/hidden/]
 
This may work better, it looks like you want a 2d array:
  • Setup Hills
    • Events
      • Time - Elapsed game time is 0.20 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set VariableSet Hill_Hashtable = (Last created hashtable)
      • -------- --------
      • -------- ActiveUsers would be a Player Group that contains all of the Users actively playing the game from the start (it should remove Leavers) --------
      • Player Group - Pick every player in ActiveUsers and do (Actions)
        • Loop - Actions
          • Set VariableSet Hill_PN = (Player number of (Picked player))
          • For each (Integer A) from 1 to 5, do (Actions)
            • Loop - Actions
              • Visibility - Create an initially Disabled visibility modifier for (Picked player) emitting Visibility across Hill_Region[(Integer A)]
              • Hashtable - Save Handle Of (Last created visibility modifier) as (Integer A) of Hill_PN in Hill_Hashtable.
  • Toggle Hills
    • Events
    • Conditions
    • Actions
      • -------- Disable old visibility: --------
      • Player Group - Pick every player in ActiveUsers and do (Actions)
        • Loop - Actions
          • Set VariableSet Hill_PN = (Player number of (Picked player))
          • Visibility - Disable (Load Hill_Index of Hill_PN in Hill_Hashtable.)
      • -------- --------
      • Set VariableSet Hill_Index = (Random integer number between 1 and 5)
      • -------- --------
      • -------- Enable new visibility: --------
      • Player Group - Pick every player in ActiveUsers and do (Actions)
        • Loop - Actions
          • Set VariableSet Hill_PN = (Player number of (Picked player))
          • Visibility - Enable (Load Hill_Index of Hill_PN in Hill_Hashtable.)
Theoretically this should work.
I will try that in a few moments.
 
Level 26
Joined
Sep 26, 2009
Messages
2,439
You can use the same approach as I have used in your other threads - create a new map and try a very simple version of what you want to achieve there. In this case, just create a visibility modifier, assign it to (non-array) variable and later delete it. If it works, then the issue is in your trigger's logic.
You can also always use the 'Game - Text message' action as a kind of debug messages - for example print indices you compute in triggers and then compare the actual value to what you expected.
 
I just edited my post, I can confirm my triggers work on the latest version.
Yep. Remade your triggers and they work. Good job and thanks!
Will add you to credits for the map.
The only "problem" is that you generate a random number, which may be the same number. OR I think so. So I used my method, but it's not a big deal.


  • setup hills
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set HIll_Hashtable = (Last created hashtable)
      • Player Group - Pick every player in Players_All_Users and do (Actions)
        • Loop - Actions
          • Set TempInt = (Player number of (Picked player))
          • For each (Integer A) from 1 to 5, do (Actions)
            • Loop - Actions
              • Visibility - Create an initially Disabled visibility modifier for (Picked player) emitting Visibility across Hills[(Integer A)]
              • Hashtable - Save Handle Of(Last created visibility modifier) as (Integer A) of TempInt in HIll_Hashtable
  • Relocate The Hill
    • Events
      • Time - Timer_MoveHill expires
    • Conditions
    • Actions
      • -------- preparation --------
      • Unit Group - Remove all units from Hill_Current_Units
      • Animation - Play Hill_Unit's death animation
      • Wait 1.00 game-time seconds
      • -------- ------------------------------------ --------
      • -------- disable old visibility --------
      • Player Group - Pick every player in Players_Active and do (Actions)
        • Loop - Actions
          • For each (Integer A) from 1 to 5, do (Actions)
            • Loop - Actions
              • Set TempInt = (Player number of (Picked player))
              • Visibility - Disable (Load HILL_Index of TempInt in HIll_Hashtable)
      • -------- set the new location index to someting else different from the old --------
      • Custom script: loop
      • Set RandomNum = (Random integer number between 1 and 5)
      • Custom script: exitwhen udg_HILL_Index != udg_RandomNum
      • Custom script: endloop
      • Set HILL_Index = RandomNum
      • -------- enable new visibility --------
      • Player Group - Pick every player in Players_Active and do (Actions)
        • Loop - Actions
          • For each (Integer A) from 1 to 5, do (Actions)
            • Loop - Actions
              • Set TempInt = (Player number of (Picked player))
              • Visibility - Enable (Load HILL_Index of TempInt in HIll_Hashtable)
      • -------- ------------------------------------ --------
      • Game - Display to (All players) the text: The hill have reloc...
      • -------- ------------------------------------ --------
      • -------- finishing --------
      • Sound - Play MapPing <gen>
      • Cinematic - Ping minimap for (All players) at Hills_Locs[HILL_Index] for 10.00 seconds
      • Unit - Move Hill_Unit instantly to Hills_Locs[HILL_Index]
      • Animation - Play Hill_Unit's birth animation
      • Wait 1.00 game-time seconds
      • Animation - Play Hill_Unit's stand animation




 

Uncle

Warcraft Moderator
Level 67
Joined
Aug 10, 2018
Messages
6,953
Yep. Remade your triggers and they work. Good job and thanks!
Will add you to credits for the map.
The only "problem" is that you generate a random number, which may be the same number. OR I think so. So I used my method, but it's not a big deal.


  • setup hills
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set HIll_Hashtable = (Last created hashtable)
      • Player Group - Pick every player in Players_All_Users and do (Actions)
        • Loop - Actions
          • Set TempInt = (Player number of (Picked player))
          • For each (Integer A) from 1 to 5, do (Actions)
            • Loop - Actions
              • Visibility - Create an initially Disabled visibility modifier for (Picked player) emitting Visibility across Hills[(Integer A)]
              • Hashtable - Save Handle Of(Last created visibility modifier) as (Integer A) of TempInt in HIll_Hashtable
  • Relocate The Hill
    • Events
      • Time - Timer_MoveHill expires
    • Conditions
    • Actions
      • -------- preparation --------
      • Unit Group - Remove all units from Hill_Current_Units
      • Animation - Play Hill_Unit's death animation
      • Wait 1.00 game-time seconds
      • -------- ------------------------------------ --------
      • -------- disable old visibility --------
      • Player Group - Pick every player in Players_Active and do (Actions)
        • Loop - Actions
          • For each (Integer A) from 1 to 5, do (Actions)
            • Loop - Actions
              • Set TempInt = (Player number of (Picked player))
              • Visibility - Disable (Load HILL_Index of TempInt in HIll_Hashtable)
      • -------- set the new location index to someting else different from the old --------
      • Custom script: loop
      • Set RandomNum = (Random integer number between 1 and 5)
      • Custom script: exitwhen udg_HILL_Index != udg_RandomNum
      • Custom script: endloop
      • Set HILL_Index = RandomNum
      • -------- enable new visibility --------
      • Player Group - Pick every player in Players_Active and do (Actions)
        • Loop - Actions
          • For each (Integer A) from 1 to 5, do (Actions)
            • Loop - Actions
              • Set TempInt = (Player number of (Picked player))
              • Visibility - Enable (Load HILL_Index of TempInt in HIll_Hashtable)
      • -------- ------------------------------------ --------
      • Game - Display to (All players) the text: The hill have reloc...
      • -------- ------------------------------------ --------
      • -------- finishing --------
      • Sound - Play MapPing <gen>
      • Cinematic - Ping minimap for (All players) at Hills_Locs[HILL_Index] for 10.00 seconds
      • Unit - Move Hill_Unit instantly to Hills_Locs[HILL_Index]
      • Animation - Play Hill_Unit's birth animation
      • Wait 1.00 game-time seconds
      • Animation - Play Hill_Unit's stand animation




Thank you, and yes, I kept it simple for my own sake :p I figured you'd understand how to adapt it to your needs.
 
Thank you, and yes, I kept it simple for my own sake :p I figured you'd understand how to adapt it to your needs.
Hey, i've a weird problem with the map here
So this is my map, now that I uploaded it officially The Kings of the Hill v1.02

The problem is that only the center Hill remains visible while the others turn on and off as expected. And I don't know why.

Can someone check why this is happening?
 

Uncle

Warcraft Moderator
Level 67
Joined
Aug 10, 2018
Messages
6,953
yeah maybe. I don't know how to test
Do you have any units there, maybe dummy units, or maybe some kind of shared vision with a computer player?

If you disable all of the vision modifiers in your hill trigger and it's still visible then you know it's coming from a difference source.

Also, I'm pretty sure you can check the Object Manager to find any vision related actions being used.
 
Last edited:
Do you have any units there, maybe dummy units, or maybe some kind of shared vision with a computer player?

If you disable all of the vision modifiers in your hill trigger and it's still visible then you know it's coming from a difference source.

Also, I'm pretty sure you can check the Object Manager to find any vision related actions being used.
ah yes, I found the poroblem now. It was a visibility modifier for when the players pick heroes.

The thread is solved.
 
Status
Not open for further replies.
Top