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

[Trigger] Day and Night Abilities

Status
Not open for further replies.
Level 10
Joined
Jun 1, 2008
Messages
485
See [thread=32827]this Tutorial [/thread]

I quote what you search.

IV. Only day/night passive abilities (not MUI!)

To those who don’t know what they are, these are passive abilities that have effects only at day (or at night).
In this example, we will make an aura that decreases nearby enemies’ armor by 1/2/3 at night!
The trigger part is not hard. The trick must be made in the object editor:
1. We need 2 (!) hero abilities. The first one will be a dummy “learning-ability” (based on Channel, and the second will make the effect (in this case, based on Devotion Aura).
2. The ability based on Channel is the main trick here. It has an option “Visible”, that makes its icon to appear if the hero learns the ability. If it’s not ticked, the icon will not appear, and will not take up space. Configure this ability (Icon - research, Hotkey - Learn, Tooltip – Learn (Extended) fields for sure), as it’ll be the ability that appears on the hero’s “learnable abilities” list. Make it look like a normal ability! Add THIS ability to the hero’s ability list (in the object editor of course).
3. Here it comes to the second ability, the one that appears on the hero’s “in-game ability-list”. This one must reduce armor, so we base it on Devotion Aura. Now for configuration:
 If you want your ability to have N levels, make this ability to have N+1 levels, as it must have a level that does no effect (when it’s day). Let’s declare level 1 to be the one that makes no effect. In this example, our ability must look like this:
Level 1 – Data – Armor Bonus 0.00
Level 2 – Data – Armor Bonus -1.00
Level 3 – Data – Armor Bonus -2.00
Level 4 – Data – Armor Bonus -3.00
 Set the icon, tooltip texts, targets allowed fields and such. An example:
Level 1 – Text – Tooltip – Normal – Extended It’s day! – No effect
Level 2 – Text – Tooltip – Normal – Extended Reduces armor by 1.
Level 3 – Text – Tooltip – Normal – Extended Reduces armor by 2.
Level 4 – Text – Tooltip – Normal – Extended Reduces armor by 3.
4. Now that we have both abilities, we arrived to the trigger part. We need 3 triggers. One for storing the learning hero into a variable, one for detecting day, and one for detecting night. When the hero learns the ability based on Channel (that disappears), we add the normal ability (with 4 levels) to the hero. At day, we want the ability to have no effect, so if it’s day, we set its level to 1. At night, we must set it back to its normal level. Here, the first ability will store the information about the exact level of the passive ability, as it was only learned by the hero, but its level hasn’t been modified. But remember, the passive ability has N+1 levels, because level 1 makes no effect, so we have to add 1 to the level of the “dummy-learning-ability”.
Here, ‘DayNight Passive’ is the ability based on Channel, and ‘DayNight Passive (for ability)’ is the normal one that makes the effect.
  • DayNightLearn
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to DayNight Passive
    • Actions
      • Set DayNightHero = (Triggering unit)
      • Unit - Add DayNight Passive (for ability) to DayNightHero
      • 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 18.00
        • Then - Actions
          • Unit - Set level of DayNight Passive (for ability) for DayNightHero to 1
        • Else - Actions
          • Unit - Set level of DayNight Passive (for ability) for DayNightHero to ((Level of DayNight Passive for DayNightHero) + 1)
We store the learning hero, add the passive ability, check the day state and set the passive’s level to the apropriate value.
The trigger for detecting day:
  • Day
    • 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 - Set level of DayNight Passive (for ability) for DayNightHero to 1
As you see, this trigger runs when night turns to day. We must remove the ability’s effect. We do this by setting its level to 1 (we set level 1 values to make no effect).
Trigger for detecting night:
  • Night
    • 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 - Set level of DayNight Passive (for ability) for DayNightHero to ((Level of DayNight Passive for DayNightHero) + 1)
The level of the ability based on Channel remains normal all day, so we use it to set the passive ability’s level back to normal if it turns to night.
 
Status
Not open for further replies.
Top