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

[Trigger] Disable Omnilight During Day, Enable At Night

Status
Not open for further replies.
Level 7
Joined
Feb 20, 2016
Messages
274
My units have an omnilight ability. I tried disabling, for all units of player 1 (me), during the day and enabling during the night but it doesnt work

1.JPG


2.JPG


i even tested specifically disabling just on the peasant when the game starts but its not working either

3.JPG
 
Not familiar with omnilight term being used here, but the third trigger is bound to fail due to invalid condition (there's no trained unit at map init event). The other two would fall into a race state at the game start. Now, one needs to be aware that "night" starts at 18:00 instead of 24:00.

Are you sure you're using the right player? One of my map has exactly this kind of system (switch ability power for some heroes in my case), and it functions properly from my tests.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
These "Map Initialization" Events don't make any sense. You're misunderstanding how Events/Event Responses work.

An Event is when something happens in the game. A unit dies, a unit enters a region, the game first loads, some amount of time passes, etc.

An Event Response is something that can be used in response to one or more of these Events. They're often used exclusively with a single Event.

So when the Event Unit - A unit dies happens, there will be multiple Event Responses set for you to use:

Triggering unit - the unit mentioned in the Event (A UNIT dies).
Dying unit - the unit that died in the Event. So this is the same as the Triggering unit.
Killing unit - the unit that killed the dying unit. This may not exist if there was no killing unit.

So your Conditions/Actions can only reference Event Responses associated with their Events.
So in the case of my Unit - A unit dies example, the trigger only has information regarding those 3 Event Responses (triggering unit, dying unit, killing unit). From there you can gather more information by using things like "Owner of dying unit" to get the Player that the unit belongs to.


With all of this in mind, understand that Map Initialization has no Event Responses because nothing happened to a unit, player, item, destructable, etc...
Therefore, the game has absolutely no idea what you're talking about in your 3rd trigger.
  • Events
  • Map initialization
  • Conditions
  • (Unit-type of (Trained unit)) Equal to Peasant
What Trained unit? The Event (map loaded) has nothing to do with the Event Response (trained unit).

This is the proper Event:
  • Unit - A unit Finishes training a unit
So the trigger should look like this:
  • Disable Peasants Omnilight
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Peasant
    • Actions
      • Unit - For (Trained unit), Ability Dummy - Omnilight Yellow, Disable ability: True, Hide UI: True

Furthermore, when you do:
  • Events
  • Map initialization
  • Game - the in-game time of day becomes Equal to 6.00
You're basically saying, "when the game first loads and whenever the time of day becomes Equal to 6.00 do these Conditions/Actions...".

Since both your enable/disable triggers use the Map initialization Event, you're disabling AND enabling your omnilight ability when the game first loads. Depending on the order that these triggers are executed, you may end up with one or the other outcomes (ability is disabled or enabled).

So as long as your triggers are setup properly you should be able to disable Omnilight using either of those two disable Actions.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
Triggering Unit is the structure that trained the unit. Trained Unit is the actual unit that came out of the structure. Look carefully at your Events/Event Responses, see how your Peasant trigger is different from mine.

Also, you're still using the Map Initialization Events. In my previous post I said:
"Since both your enable/disable triggers use the Map initialization Event, you're disabling AND enabling your omnilight ability when the game first loads. Depending on the order that these triggers are executed, you may end up with one or the other outcomes (ability is disabled or enabled)."

I'll clarify, both of your Day/Night triggers use the Map Initialization Event. This means that they both run during the loading process. Two triggers can't run at the same exact time, one of those two triggers will happen first. See the issue? It's possible that the Disable Omnilight trigger runs first and then the Enable Omnilight trigger runs after it, resulting in the ability being enabled.

Solution 1: Remove Map Initialization from the Day trigger.

This will result in the Omnilight ability being disabled for Player 1 when the game finishes loading. So it'll be disabled by default.

Solution 2: Remove Map Initialization from both of the Day/Night triggers.

This would result in Omnilight being enabled by default.
Then if you wanted the ability to be disabled by default you would create a new trigger using the Map Initialization Event:
  • Events
  • Map initialization
  • Conditions
  • Actions
  • Player - Disable Dummy - Omnilight Yellow for Player 1 (Red)
 
Last edited:
Level 7
Joined
Feb 20, 2016
Messages
274
Triggering Unit is the structure that trained the unit. Trained Unit is the actual unit that came out of the structure. Look carefully at your Events/Event Responses, see how your Peasant trigger is different from mine.

Ok i fixed the error but nothing is capable of disabling the omnilight, i tried using just disable triggers.

1.JPG


2.JPG
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
Okay I figured it out. The issue has to do with some passive abilities not turning off their Art when disabled.

I found that Brilliance Aura doesn't have this issue and can be Disabled/Enabled properly.

Note that I only tested it using the Player Disable actions but it should work for specific units as well.
  • Player - Enable Test for Player 1 (Red)
  • Player - Disable Test for Player 1 (Red)
See the attached picture for the settings you should use on Brilliance Aura.

If you want to hide the ability, you can set it's Art - Button Positions to x: 0, y: -11.
In order to type a negative number you need to hold down Shift while opening the field. You may need to Enable negative values in the World Editor settings -> File/Preferences/General -> Allow negative real values in the Object Editor.
 

Attachments

  • brilliance aura settings.png
    brilliance aura settings.png
    77.7 KB · Views: 16
Last edited:
Status
Not open for further replies.
Top