• 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.

[Trigger] Change Hero ability day/night

Status
Not open for further replies.
I've created this ability where it changes depending on wether it's day or night. It changes between the two abilities called "Dodge" and "Weak Spot". But alas, in-game nothing happens when it turns night-time (or the other way around).
Here's my triggers:
  • D and WS D to N
    • Events
      • Game - The in-game time of day becomes Equal to 18.00
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • Set Werewolf_LVLofAbility = (Level of Dodge for (Picked unit))
          • Wait 0.01 seconds
          • Player - Disable Dodge for (Owner of (Picked unit))
          • Player - Enable Weak Spot for (Owner of (Picked unit))
          • Unit - Set level of Weak Spot for (Picked unit) to Werewolf_LVLofAbility
  • D and WS N to D
    • Events
      • Game - The in-game time of day becomes Equal to 6.00
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • Set Werewolf_LVLofAbility = (Level of Weak Spot for (Picked unit))
          • Wait 0.01 seconds
          • Player - Disable Weak Spot for (Owner of (Picked unit))
          • Player - Enable Dodge for (Owner of (Picked unit))
          • Unit - Set level of Dodge for (Picked unit) to Werewolf_LVLofAbility
Can anyone help me with this? Tell me what I am doing wrong?

EDIT: (By the way, I do have the correct unit selected, and he has both abilities (Weak Spot being disabled), and it being daytime when the game starts.)
 
Last edited:
Well that worked.. Somewhat. But it does not work the first time the trigger is activated (I suppose it's 'cause the level is stored at the same time as it is used.. I'll try to figure something out, thanks a lot ;)

EDIT: Ended up finally with something that works! :D Here's the triggers I ended up with, in case anyone's interrested :p

  • D and WS D to N
    • Events
      • Game - The in-game time of day becomes Equal to 18.00
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • Set Werewolf_LVLofAbility = (Level of Dodge for (Picked unit))
          • Player - Disable Dodge for (Owner of (Picked unit))
          • Player - Enable Weak Spot for (Owner of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Level of Dodge for (Picked unit)) Equal to 1
                  • WerewolfAbility_Used Equal to False
            • Then - Actions
              • Hero - Modify unspent skill points of (Picked unit): Add 1 points
              • Hero - Learn skill for (Picked unit): Weak Spot
              • Set WerewolfAbility_Used = True
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Dodge for (Picked unit)) Greater than or equal to 1
                • Then - Actions
                  • Unit - Set level of Weak Spot for (Picked unit) to Werewolf_LVLofAbility
                • Else - Actions
  • D and WS N to D
    • Events
      • Game - The in-game time of day becomes Equal to 6.00
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • Set Werewolf_LVLofAbility = (Level of Weak Spot for (Picked unit))
          • Player - Disable Weak Spot for (Owner of (Picked unit))
          • Player - Enable Dodge for (Owner of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Level of Weak Spot for (Picked unit)) Equal to 1
                  • WerewolfAbility_Used Equal to False
            • Then - Actions
              • Hero - Modify unspent skill points of (Picked unit): Add 1 points
              • Hero - Learn skill for (Picked unit): Dodge
              • Set WerewolfAbility_Used = True
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Weak Spot for (Picked unit)) Greater than or equal to 1
                • Then - Actions
                  • Unit - Set level of Dodge for (Picked unit) to Werewolf_LVLofAbility
                • Else - Actions
 
Last edited:
Level 4
Joined
Jun 23, 2011
Messages
70
If you need the wait function, separate it into two divided unit group functions.

  • Example
    • Events
      • Game - The in-game time of day becomes Equal to 18.00
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • Set Werewolf_LVLofAbility = (Level of Dodge for (Picked unit))
      • Wait 0.01 seconds
      • Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • Player - Disable Dodge for (Owner of (Picked unit))
          • Player - Enable Weak Spot for (Owner of (Picked unit))
          • Unit - Set level of Weak Spot for (Picked unit) to Werewolf_LVLofAbility
.
 
I figured out what the problem was.. When the hero is created, he hasn't learnt any of the abilites, and this is NOT the same as the ability is level 0. So I had to check if it was already learnt (By the variable called WerewolfAbility_Used), and do different things accordingly. See my last response for the full solution and trigger ;)
 
Status
Not open for further replies.
Top