• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

How to hide and unhide units in an area?

Status
Not open for further replies.
This works fine:

  • Hide
    • Events
      • Player - Player 1 (Red) types a chat message containing hide as An exact match
    • Conditions
    • Actions
      • Set HideGroup = (Units in Region 000 <gen>)
      • Unit Group - Pick every unit in HideGroup and do (Actions)
        • Loop - Actions
          • Unit - Hide (Picked unit)
  • Unhide
    • Events
      • Player - Player 1 (Red) types a chat message containing unhide as An exact match
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HideGroup and do (Actions)
        • Loop - Actions
          • Unit - Unhide (Picked unit)
Hidden units are omitted from many triggers, which is probably the reason you are facing some difficulties.
 
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing hide as An exact match
    • Conditions
    • Actions
      • Set hg = (Units in Region 000 <gen>)
      • Unit Group - Pick every unit in hg and do (Actions)
        • Loop - Actions
          • Unit - Hide (Picked unit)
          • Wait 5.00 seconds
          • Trigger - Run Untitled Trigger 001 Copy <gen> (checking conditions)
  • Untitled Trigger 001 Copy
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in hg and do (Actions)
        • Loop - Actions
          • Unit - Unhide (Picked unit)
 
Not sure why that doesn't work but do this instead, it works fine and does what you need:

  • Hide
    • Events
      • Player - Player 1 (Red) types a chat message containing hide as An exact match
    • Conditions
    • Actions
      • Set HideGroup = (Units in Region 000 <gen>)
      • Unit Group - Pick every unit in HideGroup and do (Actions)
        • Loop - Actions
          • Unit - Hide (Picked unit)
          • Countdown Timer - Start UnhideTimer as a One-shot timer that will expire in 5.00 seconds
  • Unhide
    • Events
      • Time - UnhideTimer expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HideGroup and do (Actions)
        • Loop - Actions
          • Unit - Unhide (Picked unit)
 
@matin45 The reason the units do not get hidden is because waits do not work in the loops from "pick all units" and "pick all players". Actions that come after the wait will never happen.

Another solution would have been to run a trigger inside the loops. Then the trigger will call the wait and the other actions after it.

  • Hide
    • Events
      • Player - Player 1 (Red) types a chat message containing hide as An exact match
    • Conditions
    • Actions
      • Set HideGroup = (Units in Region 000 <gen>)
      • Unit Group - Pick every unit in HideGroup and do (Actions)
        • Loop - Actions
          • Unit - Hide (Picked unit)
          • Trigger - Run UnHide <gen> (not checking conditions)
  • UnHide
    • Events
    • Conditions
    • Actions
      • Wait 5.00 seconds
      • Unit - Unhide (Picked unit)
 
Last edited:
No need to start a timer or a wait for each unit in the group... just do what matin tried but with the wait and trigger execution outside the loop....

  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing hide as An exact match
    • Conditions
    • Actions
      • Set hg = (Units in Region 000 <gen>)
      • Unit Group - Pick every unit in hg and do (Actions)
        • Loop - Actions
          • Unit - Hide (Picked unit)
      • Wait 5.00 seconds
      • Trigger - Run Untitled Trigger 001 Copy <gen> (checking conditions)
  • Untitled Trigger 001 Copy
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in hg and do (Actions)
        • Loop - Actions
          • Unit - Unhide (Picked unit)
 
Status
Not open for further replies.
Back
Top