• 🏆 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!

[Solved] Having trouble with an ability that only works during the night

Status
Not open for further replies.
Level 8
Joined
Mar 15, 2007
Messages
230
I'm having trouble with an ability that is supposed to only work during the night. It's based on Endurance Aura and in the day time at level one, it has no effect. At nighttime, it goes to level two, and increases the unit's attack speed and movement speed. This much works. The problem is that when it's day again, the ability won't go back down to level one. Here are my triggers:

Activate Gift
Events
Game - The in-game time of day becomes Less than 6.00
Game - The in-game time of day becomes Greater than or equal to 18.00
Conditions
Actions
Unit Group - Pick every unit in (Units of type Vampire Lord (Empire)) and do (Actions)
Loop - Actions
Unit - Set level of Gift of the Nightborne (Vampire Lord) for (Picked unit) to 2

Deactivate Gift
Events
Game - The in-game time of day becomes Greater than or equal to 6.00
Conditions
(In-game time of day) Less than 18.00
Actions
Unit Group - Pick every unit in (Units of type Vampire Lord (Empire)) and do (Actions)
Loop - Actions
Unit - Set level of Gift of the Nightborne (Vampire Lord) for (Picked unit) to 1

It should also be important to note that to test this ability, I'm using another ability that temporarily changes it to nighttime.
Any help is much appreciated. Thanks in advance.
 
Level 14
Joined
Feb 7, 2020
Messages
387
I'm having trouble with an ability that is supposed to only work during the night. It's based on Endurance Aura and in the day time at level one, it has no effect. At nighttime, it goes to level two, and increases the unit's attack speed and movement speed. This much works. The problem is that when it's day again, the ability won't go back down to level one. Here are my triggers:

Activate Gift
Events
Game - The in-game time of day becomes Less than 6.00
Game - The in-game time of day becomes Greater than or equal to 18.00
Conditions
Actions
Unit Group - Pick every unit in (Units of type Vampire Lord (Empire)) and do (Actions)
Loop - Actions
Unit - Set level of Gift of the Nightborne (Vampire Lord) for (Picked unit) to 2

Deactivate Gift
Events
Game - The in-game time of day becomes Greater than or equal to 6.00
Conditions
(In-game time of day) Less than 18.00
Actions
Unit Group - Pick every unit in (Units of type Vampire Lord (Empire)) and do (Actions)
Loop - Actions
Unit - Set level of Gift of the Nightborne (Vampire Lord) for (Picked unit) to 1

It should also be important to note that to test this ability, I'm using another ability that temporarily changes it to nighttime.
Any help is much appreciated. Thanks in advance.
  • Huntress Time of Day Activate
    • Events
      • Game - The in-game time of day becomes Equal to 18.00
      • Game - The in-game time of day becomes Equal to 6.00
    • Conditions
    • Actions
      • Custom script: bj_wantDestroyGroup=true
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (In-game time of day) Greater than or equal to 17.59
              • (In-game time of day) Less than or equal to 5.59
        • Then - Actions
          • Unit Group - Pick every unit in (Units in (Playable map area) owned by (Owner of huntressUnit)) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to Huntress (Eliminator)
                • Then - Actions
                  • Set VariableSet playerNumber = (Player number of (Owner of (Picked unit)))
                  • Unit - Set level of Glaive Net (Huntress) for playerHero[playerNumber] to 2
                  • Unit - Set level of Spectral Owl (Huntress) for playerHero[playerNumber] to 2
                  • Unit - Set level of Way of the Huntress (Huntress) for playerHero[playerNumber] to 2
                • Else - Actions
        • Else - Actions
          • Unit Group - Pick every unit in (Units in (Playable map area) owned by (Owner of huntressUnit)) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to Huntress (Eliminator)
                • Then - Actions
                  • Set VariableSet playerNumber = (Player number of (Owner of (Picked unit)))
                  • Unit - Set level of Glaive Net (Huntress) for playerHero[playerNumber] to 1
                  • Unit - Set level of Spectral Owl (Huntress) for playerHero[playerNumber] to 1
                  • Unit - Set level of Way of the Huntress (Huntress) for playerHero[playerNumber] to 1
                • Else - Actions
This is an old and janky trigger I have laying around but it does work. I remember battling what the exact values should be for it to function; not sure if my hacky use of 5.59 or 17.59 are necessary. I'd try listening for the event being set to an exact value. I also run this trigger on hero revive for the specific unit.
 
Last edited:
Level 8
Joined
Mar 15, 2007
Messages
230
Thanks, Planetary. It works great now, except for one thing: the ability where the unit changes day into night (Tyranny of the Sun) now has no effect on the passive. I created a new trigger that is supposed to adjust the ability level when Tyranny of the Sun is cast (this part works) and resets it when the ability runs out and it is day time (this part does not work).
  • Activate on Tyranny
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Tyranny of the Sun (Vampire Lord)
    • Actions
      • Unit Group - Pick every unit in (Units of type Vampire Lord (Empire)) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Gift of the Nightborne (Vampire Lord) for (Picked unit) to 2
          • Wait 35.00 game-time seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (In-game time of day) Greater than or equal to 6.00
              • (In-game time of day) Less than or equal to 17.58
            • Then - Actions
              • Unit - Set level of Gift of the Nightborne (Vampire Lord) for (Picked unit) to 1
            • Else - Actions
 
Level 8
Joined
Mar 15, 2007
Messages
230
The problem is that once the item ability wears off during the day, my hero still retains the attack speed and movement speed bonuses as if it were still night.
 
Level 14
Joined
Feb 7, 2020
Messages
387
Thanks, Planetary. It works great now, except for one thing: the ability where the unit changes day into night (Tyranny of the Sun) now has no effect on the passive. I created a new trigger that is supposed to adjust the ability level when Tyranny of the Sun is cast (this part works) and resets it when the ability runs out and it is day time (this part does not work).

Try reordering it like this:
  • Activate on Tyranny
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Tyranny of the Sun (Vampire Lord)
    • Actions
      • Unit - Set level of Gift of the Nightborne (Vampire Lord) for (Picked unit) to 2
      • Wait 35.00 game-time seconds
      • Unit Group - Pick every unit in (Units of type Vampire Lord (Empire)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (In-game time of day) Greater than or equal to 6.00
              • (In-game time of day) Less than or equal to 17.58
            • Then - Actions
              • Unit - Set level of Gift of the Nightborne (Vampire Lord) for (Picked unit) to 1
            • Else - Actions
Enumerated units don't survive wait steps, I think. If that doesn't work, I suspect there is no spell effect for that item so you'll need to do the 0.00 game time event I mentioned earlier.
 
Status
Not open for further replies.
Top