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

[Solved] Visibility Trigger

Status
Not open for further replies.
Level 3
Joined
Jan 19, 2017
Messages
32
Hello fellow Hivers,

I was wondering if the following trigger sequence will create leaks?
If yes, then how should i fix it?

Thanks

---------------------------------------------------------------------------------------------------------------------
Entering WT (1st Trigger)
Events
> Unit - A unit enters Region 003 <gen>

Conditions

Actions
> Visibility - Create an initially Enabled visibility modifier for (Owner of (Triggering unit)) emitting
Visibility across Region 003 <gen>
> Set WT_Visibility = (Last created visibility modifier)
> Visibility - Enable WT_Visibility

---------------------------------------------------------------------------------------------------------------------

Leaving WT (2nd Trigger)
Events
Unit - A unit leaves Region 003 <gen>
Conditions
Actions
Visibility - Disable WT_Visibility
 
Level 3
Joined
Jan 19, 2017
Messages
32
it won't work if there is (in my map)
1. no create visibility modifier
2. or if i destroy the visibility modifier after disabling it
 
Level 17
Joined
Mar 21, 2011
Messages
1,597
Thats not what i meant. I'll explain. Your current problem is that every time you enter the region, you create a new visibility modifier. So.. whenever you leave the region, only the last created one will be disabled - however, you cannot catch the other ones anymore. To prevent that, you need to create the VM only the first time you enter the region (and enable/disable it whenever you enter/leave the region). Thats why i check if the variable is equal to null, which means it is not set yet. If so, you can create the VM and save it into the variable
 
GIMLI's solution should work.
The if statement may require Custom script (jass), and after destroying you may wanna null it.
The modifier variable maybe needs to be an array, if you wanna have it player specific.
Alternativly, for pure GUI, you can use boolean variable(s), which you assign true at creation, and false at destruction.
 
Level 3
Joined
Jan 19, 2017
Messages
32
GIMLI's solution should work.
The if statement may require Custom script (jass), and after destroying you may wanna null it.
The modifier variable maybe needs to be an array, if you wanna have it player specific.
Alternativly, for pure GUI, you can use boolean variable(s), which you assign true at creation, and false at destruction.

Sorry if I'm a little stupid. But may i ask for a photo pls? Or just the text format of the whole trigger?
Highly appreciate it. ty
 
Level 14
Joined
Nov 30, 2013
Messages
926
Sorry if I'm a little stupid. But may i ask for a photo pls? Or just the text format of the whole trigger?
Highly appreciate it. ty
Here's the trigger you needed.
  • Enter Region
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
    • Actions
      • Custom script: if(udg_VM == null) then
      • Visibility - Create an initially Enabled visibility modifier for Player 1 (Red) emitting Visibility across (Playable map area)
      • Set VM = (Last created visibility modifier)
      • Custom script: endif
      • Visibility - Enable VM
  • Leave Region
    • Events
      • Unit - A unit leaves Region 000 <gen>
    • Conditions
    • Actions
      • Custom script: if(udg_VM != null) then
      • Visibility - Disable VM
      • Custom script: endif
Edited: Suddenly realized how GIMLI_2's solution supposed to work so I edited it out.
 
Last edited:
Level 3
Joined
Jan 19, 2017
Messages
32
Here's the trigger you needed.
  • Enter Region
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
    • Actions
      • Custom script: if(udg_VM == null) then
      • Visibility - Create an initially Enabled visibility modifier for Player 1 (Red) emitting Visibility across (Playable map area)
      • Set VM = (Last created visibility modifier)
      • Custom script: endif
      • Visibility - Enable VM
  • Leave Region
    • Events
      • Unit - A unit leaves Region 000 <gen>
    • Conditions
    • Actions
      • Custom script: if(udg_VM != null) then
      • Visibility - Disable VM
      • Visibility - Destroy VM
      • Custom script: set udg_VM = null
      • Custom script: endif

let me test it on my map.
haven't tried custom scrips b4 tho so i really don't understand this stuf yet.
:D
 
Level 3
Joined
Jan 19, 2017
Messages
32
Untitled.png

Ok, so i followed your instructions guys.

It seems to be working except for 1 problem.

here's what happened.
1. My hero enters the region, VM worked. :)
2. My hero leaves the region, VM disabled just fine. :)

3. My hero returns (enters) to the same region, VM not working anymore :eek:

Help? TIA.
 
Level 3
Joined
Jan 19, 2017
Messages
32
oh it works! this should be the final trigger:

1. Entering WT
Events
Unit - A unit enters Region 003 <gen>
Conditions
Actions
Custom script: if(udg_WT_Visibility == null) then
Visibility - Create an initially Enabled visibility modifier for (Owner of (Triggering unit)) emitting Visibility across Region 003 <gen>
Set WT_Visibility = (Last created visibility modifier)
Custom script: endif
Visibility - Enable WT_Visibility
---------------------------------------------------------------------------------------------------------------------------------------------------------------------

2.Leaving WT
Events
Unit - A unit leaves Region 003 <gen>
Conditions
Actions
Custom script: if(udg_WT_Visibility != null) then
Visibility - Disable WT_Visibility
Custom script: endif


Thanks guys!
 
Level 3
Joined
Jan 19, 2017
Messages
32
Just 1 last question,

Why does the VM slightly darkens, but quickly recovers when Mortred casts shadowmeld and becomes hidden in the night?
Does this mean Mortred left the region and returned quickly?
 
Status
Not open for further replies.
Top