Trigger that works at night?

I_RULE_YOU

New Member
Reaction score
34
I'm trying to give my hero an ability that works at night time only, like the Night Stalker in DotA. When it turns night time, the hero gains attack speed and movement speed. I know how I'd do this, add 2 abilities and such when its night time. But I can't find time of day in conditions anywhere, I can only find it in Events. But I could'nt figure out how to do the trigger with the event of it being 18.00 game time (exactly when it turns night). So how would I accomplish this spell?

(Note, when it turns day time the abilities should be removed).
 

foodflare

You can change this now in User CP.
Reaction score
32
its a real comparison use two and click on life of (triggering unit) then go to game - time of day
Code:
Or - Any (Conditions) are true
    Conditions
        (In-game time of day) Greater than or equal to 18.00
        (In-game time of day) Less than or equal to 6.00
 

I_RULE_YOU

New Member
Reaction score
34
Ok, heres the trigger so far:

Code:
Rage of Darkness
    Events
        Unit - A unit Learns a skill
    Conditions
        (Learned Hero Skill) Equal to Rage of Darkness (Dummy)
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Or - Any (Conditions) are true
                    Conditions
                        (In-game time of day) Greater than or equal to 18.00
                        (In-game time of day) Less than or equal to 6.00
            Then - Actions
                Unit - Add Dark Nova (Trigger) to (Triggering unit)
                Unit - Set level of Dark Nova (Trigger) for (Triggering unit) to (Level of Rage of Darkness (Dummy) for (Triggering unit))
                Unit - Add Night Speed  to (Triggering unit)
                Unit - Set level of Night Speed  for (Triggering unit) to (Level of Rage of Darkness (Dummy) for (Triggering unit))
            Else - Actions

How would I make those 2 abilities go away at day time?
 

Weyrling

New Member
Reaction score
25
Code:
Event: Game - Time of Day becomes > 6 (this meaning 6 AM, standard 24 hour day).
Action: Remove 'Night Spell' from 'Unit', Add 'Day Spell', etcetera..
 

esb

Because none of us are as cruel as all of us.
Reaction score
329
Remember, you may only remove abilities if they were added with triggers in the first place.
 

Weyrling

New Member
Reaction score
25
esb said:
Remember, you may only remove abilities if they were added with triggers in the first place.
False. Ever played an RP map?

Which reminds me, you will want to make the actual hero ability invisible and use totally different ones for the effects.
The fact that the hero can learn the ability can't be removed, but the ability itself CAN be removed from the unit.
This means that if you use the same ability your hero selects as, say, the night-time ability, when you switch it to daytime the hero could learn the night one a second time since you removed it from the unit itself, yet it's still in their 'hero abilities' list.
 

I_RULE_YOU

New Member
Reaction score
34
That's what I did, I made it so at night time 2 abilities were added if he had the spell learned ( It's a dummy spell, based it off Critical Strike). I'm at school right now so I cant test the remove ability part, but I will soon.
 

I_RULE_YOU

New Member
Reaction score
34
Code:
Rage of Darkness
    Events
        Unit - A unit Learns a skill
    Conditions
        (Learned Hero Skill) Equal to Rage of Darkness (Dummy)
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Or - Any (Conditions) are true
                    Conditions
                        (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 Dark Nova (Trigger) to (Triggering unit)
                Unit - Set level of Dark Nova (Trigger) for (Triggering unit) to (Level of Rage of Darkness (Dummy) for (Triggering unit))
                Unit - Add Night Speed  to (Triggering unit)
                Unit - Set level of Night Speed  for (Triggering unit) to (Level of Rage of Darkness (Dummy) for (Triggering unit))
            Else - Actions


Code:
Rage of Darkness B
    Events
        Unit - A unit Learns a skill
    Conditions
        (Learned Hero Skill) Equal to Rage of Darkness (Dummy)
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Or - Any (Conditions) are true
                    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 - Remove Dark Nova (Trigger) from (Triggering unit)
                Unit - Remove Night Speed  from (Triggering unit)
            Else - Actions


Those are my two triggers for the spel. It isn't working. Night time comes, and nothing happens. What am I doing wrong?
 

Weyrling

New Member
Reaction score
25
The only event is 'unit learns a skill'.
You need to make another trigger with the event:
Code:
Game - in game time becomes >= 6
This will detect the game time entering Day
Code:
Game - in game time becomes >= 18
This will detect the game time entering Night
The previous 2 code strings were events.
You need to make corresponding actions to both of those events, meaning 2 more triggers or one complexified one.
 

I_RULE_YOU

New Member
Reaction score
34
Well that's what I wanted to do, but I got stuck here:

Code:
Action: Remove 'Night Spell' from 'Unit'

Could not find a place where I choose a specific kind of unit to remove the ability from, only (triggering unit) and such.
 

Weyrling

New Member
Reaction score
25
Assuming there is only one unit with that ability, simply make a global 'unit' variable, and set it when you add the skill.
 

I_RULE_YOU

New Member
Reaction score
34
Well there could be multiple heroes of that type running around.

How would I make a global unit variable and set it when the skill is added? Im kinda nooby at triggers.
 

Weyrling

New Member
Reaction score
25
If you can potentially have multiple of this unit type running around, use the following:
First, make a unit group variable (Select the X in the trigger editor, make new, go down til you find 'Unit Group').
Code:
Event: Game - in game time becomes >= 6
Set UnitGroupVariable to Units of Type HeroGuy
[b]Pick every unit in UnitGroupVariable and do:
     Remove NightSpell from Picked Unit
     Add DaySpell to Picked Unit
     Set DaySpell level to level of DummyAbility for Picked Unit[/b]
CustomScript: "call DestroyGroup(udg_UnitGroupVariable)"
For the Custom Script at the end, use udg_ then the name of your Unit Group variable.
If the variable was named TempGroup, you'd say "call DestroyGroup(udg_TempGroup)".
Good luck with your map.
 

Kelvin87

New Member
Reaction score
14
But, If with a single code to Trigger this Day and Night Event Ability isn't enough. It still got bugs. You need to have 2 trigger to code this. but 1st, you need to create a global variable of Is_Day_Flag (false as default) Boolean 1st, then pick every triggering unit of owning of the ability to do action.
The working as below:(Not really follow the jass code)
Code A:
If GetTriggerUnit != null and count number of Triggering Unit in playable map area > 0 and udg_Is_Day_Flag == false then
set udg_Is_Day_Flag = true
else
return
endif

Code B:
If udg_Is_Day_Flag == true and TimeofDay > 6.00 and TimeofDay < 18.00 then
call SetUnitAbilityLevel( GetTriggerUnit(), 'abilcode', lvlofskill )
endif

If udg_Is_Day_Flag != false and count number of Triggering Unit in playable map area <0 then
set udg_Is_Day_Flag == false
endif

from Thelder Clan
 

Naga'sShadow

Ultra Cool Member
Reaction score
49
How many of this unit can a single player have? If the answer is 1 then you can also use the disable- spell for player action. If you do that its the same as if you removed the spell but you don't need to store the level to add it back in come nightfall.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top