• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Setting it so units only live at night.

Status
Not open for further replies.

Leet_Zeno

L

Leet_Zeno

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?
 
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.
 
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 by a moderator:
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.
 
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.
Back
Top