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

Setting it so units only live at night.

Status
Not open for further replies.
Level 2
Joined
Aug 10, 2008
Messages
6
I'm trying to work on a skill that summons creatures, and i'm trying to make a trigger where it will only be alive at night, as well as the spell being castable only at night.


And I am also trying to make it so that my hero is invulnerable when casting. Any trigger advice?
 
Level 14
Joined
Apr 21, 2007
Messages
1,465
Well, you can create a Real Variable and set it up in a trigger like this:

  • Events
    • Time - Every 0.1 seconds
  • Conditions
  • Actions
    • Set TIME = (In-game time of day)
Now for the casting trigger we will use a spell that requires 3 seconds to cast called Summon Shade and this trigger:

  • Events
    • Unit - A unit Begins casting an ability
  • Conditions
    • (Ability being cast) Equal to Summon Shade
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • A Greater than or equal to 18.00
        • A Less than 6.00
      • Then - Actions
        • Unit - Add Invulnerable (Neutral) to (Casting unit)
        • Wait 3.00 seconds
        • Unit - Remove Invulnerable (Neutral) from (Casting unit)
      • Else - Actions
        • Unit - Order (Casting unit) to Stop
Now since all of those shades can be summoned after 18 pm we need a trigger that will kill any shades still alive at 6 am so we use this:

  • Events
    • Game - The in-game time of day becomes Equal to 6.00
  • Conditions
  • Actions
    • Set ShadeUG = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Shade))
    • Unit Group - Pick every unit in ShadeUG and do (Unit - Kill (Picked unit))
Oh, ShadeUG is a unit group variable.
 
Level 2
Joined
Aug 10, 2008
Messages
6
ty and sorry for posting in wrong board.


I can't seem to find the "a greater than or equal to 18.00" and the "a less than 6.00"
 
Last edited:
Level 9
Joined
Jun 26, 2007
Messages
659
why using a variable to store a value you can ask at any time?

the following trigger will works the same and will avoid the useless first one :
  • Events
    • Unit - A unit Begins casting an ability
  • Conditions
    • (Ability being cast) Equal to Summon Shade
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Or (you've forgoten this)
          • (In-game time of day) Greater than or equal to 18.00
          • (In-game time of day) Less than 6.00
      • Then - Actions
        • Unit - Add Invulnerable (Neutral) to (Casting unit)
        • Wait 3.00 seconds
        • Unit - Remove Invulnerable (Neutral) from (Casting unit)
      • Else - Actions
        • Unit - Order (Casting unit) to Stop
@RunBa : basically, everything cause lags, games just lags when they've got too many things to do
a "every 0.1s" trigger cause as lags as ten "every 1.0s" triggers
you make the game lags with a single "every 0.1s" trigger only if this one ask the game to do tons of actions.
 
Level 8
Joined
Mar 23, 2007
Messages
302
We need both, because he wants it to be:
1. only castable at night so:
  • Events
  • Game - The in-game time of day becomes Equal to 6.00
  • Conditions
  • Actions
  • Remove *your summoning ability here* from *your unit here*
(And the same to get the ability back at night)

2.-999 HP regen at day, to make them die at day even when summoned right before 6 in the morning.
 
Status
Not open for further replies.
Top