• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Help with the sleep question

Status
Not open for further replies.
Level 13
Joined
Feb 18, 2009
Messages
1,381
You could create a dummy unit which appears a daybreak, can cast "sleep" all the time, and then remove it at night.
 
Yep, create a Sleep spell out of the default Sleep spell and set its duration to 0 (this lasts forever);
then, use this trigger:
  • Trigger0
  • Events
    • Game - The in-game time of day becomes Equal to 6.00
  • Conditions
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in (Playable Map Area)) and do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • (Owner of (Picked unit)) Equal to Player 1 (Red) //Player comparison -> Use whatever for your comparison
          • Then - Actions
            • Set Point1 = (Position of (Picked unit))
            • Unit - Create 1 dummy for (Neutral Hostile) at Point1 facing default building degrees
            • Unit - Order (Last created unit) to Undead Dreadlord - Sleep (Picked unit)
            • Unit - Add a 2.00 seconds generic expiration timer to (Last created unit)
            • Custom script: call RemoveLocation (udg_Point1)
          • Else - Actions
and then

  • Trigger
  • Events
    • Game - The in-game time of day becomes Equal to 18.00
  • Conditions
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in (Playable Map Area)) and do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • ((Picked unit) has buff Sleep) Equal to True //Boolean comparison
          • Then - Actions
            • Unit - Remove Sleep buff from (Picked unit) //Unit - Remove specific buff
          • Else - Actions
 
Level 4
Joined
Oct 26, 2008
Messages
72
Thanks for your answers :grin:
But, I think I need shorter triggers because:
There area about 20 polar bears sleeping (the map is ALWAYS in day), when a unit from the Player 1 enters in a region, all that polar bears wake up and attack that unit.
That's is that I need :wink:
 
  • Trigger1
  • Events
    • Unit - A unit enters (region1)
  • Conditions
    • (Owner of (Triggering unit)) Equal to Player 1 (Red) //Player Comparison
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in (region1)) and do (Actions)
      • Loop - Actions
        • Unit - Remove Sleep buff from (Picked unit)
  • Trigger2
  • Events
    • Unit - A unit dies
    • Unit - A unit leaves (region1)
  • Conditions
    • (Owner of (Triggering unit)) Equal to Player 1 (Red)
  • Actions
    • Set Temp_Group = (Units in (region1) matching ((Owner of (Matching unit)) Equal to Player 1 (Red)) and ((Matching unit) is alive) Equal to True))
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (Number of units in Temp_Group) Equal to 0
      • Then - Actions
        • Set AnotherGroup = (Units in (region1) matching ((Unit-type of (Matching unit)) Equal to Polar Bear)
        • Unit Group - Pick every unit in (AnotherGroup) and do (Actions)
          • Loop - Actions
            • Set Point1 = (Position of (Picked unit))
            • Unit - Create 1 dummy for (Player 1 (Red)) at Point1 facing default building degrees
            • Unit - Order (Last created unit) to Undead Dreadlord - Sleep (Picked unit)
            • Unit - Add a 2.00 seconds generic expiration timer to (Last created unit)
            • Custom script: call RemoveLocation (udg_Point1)
        • Custom script: call DestroyGroup (udg_AnotherGroup)
    • Custom script: call DestroyGroup (udg_Temp_Group)
 
Status
Not open for further replies.
Top