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

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 6
Joined
Nov 7, 2007
Messages
39
then agin, he doesnt want it to be castable. It is still castable even with their HP regen set to -999999

One way would be
  • 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 Add Ability when it becomes night time
 
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