• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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