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

Vision Tower triggers?

Status
Not open for further replies.
Level 6
Joined
Feb 23, 2010
Messages
222
I want to make a vision tower for my map that functions basically just like the xel naga vision tower from SC2.

I have a flying fairie dragon right now that enters channel animation and gives 2200/2200 vision range. I got it to work when a unit owned by a player enters and it transfers ownership correctly and it enters animation correctly, but that's about it. The dragon is immobile and invulnerable.

SNtgG1m.png


My trouble is setting the conditions and turning it off right. Here is what I'm not sure how to polish.


If no units are in the region, the FD reverts back to being neutral passive and cancels their channel animation.
I want it to only work for units that are on the ground, NOT invisible, and NOT a structure.
If there are units owned by various players the dragon is still neutral.
Bonus points if we can figure out how to make the faerie dragon glow when channeling to. (right now it just curls in a ball, which is okay, not I want a more obvious visual queue. Doesn't HAVE to be the standard fairie dragon glow.)

Here is what I have so far.
PP4nUzr.png

(EDIT: the one on the left doesn't have the "leave" event.)

This seems to work in vacuum for the most part, but when a unit dies in the region there are issues because nothing is "leaving". A 2 second periodic check for units doesn't seem to work and im worried it'll lag the map.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,565
Here's a simple system I made. Hopefully it does what you want.

Note that there's no easy way to detect if a unit is "Invisible" so you need to check if it has certain buffs/abilities like Wind Walk or Permanent Invisibility.

How to use it:
In the "VT Config" trigger you want to add variables for every Region and Faerie Dragon you have. Also update the variable VT_RegionCount to be equal to the # of Regions (Vision Towers) you use. I also Pause and make the Faerie Dragons Invulnerable in this trigger but you can delete that if that's not what you intend on doing.

Also, you will also have to edit the Conditions in the "Enter VT Region" trigger to suit your needs. The conditions are located inside two separate If Then Else statements:
In this one you determine which units SHOULDN'T count. This is done for EVERY unit in the Tower Region. I add these units to a Unit Group regardless of their classifications THEN I filter out which units shouldn't count (invis, flying, etc...). I do this to determine if the Vision Tower is contested or not.
  • Unit Group - Pick every unit in VT_UnitGroup and do (Actions)
    • Loop - Actions
      • -------- Remove unwanted units from the Unit Group (flying, structure, invis, etc) --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Picked unit)) Equal to (Owner of (Triggering unit))
              • ((Picked unit) is dead) Equal to True
              • ((Picked unit) is A flying unit) Equal to True
              • ((Picked unit) is A structure) Equal to True
              • ((Picked unit) has buff Wind Walk) Equal to True
              • ((Picked unit) has buff Invisibility) Equal to True
              • (Level of Permanent Invisibility for (Picked unit)) Not equal to 0
              • (Level of Ghost for (Picked unit)) Not equal to 0
        • Then - Actions
In this one you determine which units SHOULD count. This is done for our Entering unit (triggering unit is the same thing) to determine if it's allowed to control the tower.
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Triggering unit) is dead) Equal to False
      • ((Triggering unit) is A flying unit) Equal to False
      • ((Triggering unit) is A structure) Equal to False
      • ((Triggering unit) has buff Wind Walk) Equal to False
      • ((Triggering unit) has buff Invisibility) Equal to False
      • (Level of Permanent Invisibility for (Triggering unit)) Equal to 0
      • (Level of Ghost for (Triggering unit)) Equal to 0
    • Then - Actions
Make sure you follow the pattern here. In the "Pick every unit" conditions you're referencing the Picked Unit and checking if ANY of the conditions are TRUE. In the "If Then Else" conditions below it you're referencing the Triggering Unit (Entering Unit) and checking if the conditions are FALSE.

EDIT:
Found some bugs already, lol. Try v.2 instead.
EDIT 2:
I found another bug... Here's version 3. I'm fairly confident that this one should work.
 
Last edited:
Level 6
Joined
Feb 23, 2010
Messages
222
Hey thanks for the effort! :D

I'm trying your version 3 map rn

EDIT: Checked it out.

As far as 'contesting the point' goes;
Allies won't contest each other, but enemies will 'contest' it.
As long as there a valid enemy unit and one of your own valid units, the point will be contested and no one gets the benefit of the extra vision.

I'll add the invis rules you suggested to the conditions. :D Again thnx

EDIT: Also, I changed my mind and think they should start in the channel animation (curled up) and open up when activated lol. (not sure how to do that either)
 
Last edited:
Level 6
Joined
Feb 23, 2010
Messages
222
shop sharing causes units to share vision when you stand near. getting it to be flying vision may be trickier though. you could try with a locust flyer on top of the regular building, i guess.
It's a bit more complicated than shop sharing I think. Considering it's a 'contestable' point mechanic, with custom specifications to be considered a 'valid contestant'.
 
Level 23
Joined
Oct 18, 2008
Messages
938
guess I should actually read the thread before I post

you'll want a periodic check. to look for invisibility it will probably work if you check 'is unit visible to player' for a neutral player that has vision of the area but no truesight or shared vision. then pick all units in the valid unit group, set tempplayer = owner of unit and check if its an enemy of the previous tempplayer. if yes, then the thing is contested.

as for making the faerie dragon shiny try the priestess of the moon starfall ray of light effect.
 
Level 6
Joined
Feb 23, 2010
Messages
222
guess I should actually read the thread before I post

you'll want a periodic check. to look for invisibility it will probably work if you check 'is unit visible to player' for a neutral player that has vision of the area but no truesight or shared vision. then pick all units in the valid unit group, set tempplayer = owner of unit and check if its an enemy of the previous tempplayer. if yes, then the thing is contested.

as for making the faerie dragon shiny try the priestess of the moon starfall ray of light effect.

No worries ^^. I'm pretty newb to trigger editing so I didn't get most of that information though, sadly. I do recognize the cleverness of "unit visible to neutral player" idea, but just don't know how to execute it properly.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,565
Hey thanks for the effort! :D

I'm trying your version 3 map rn

EDIT: Checked it out.

As far as 'contesting the point' goes;
Allies won't contest each other, but enemies will 'contest' it.
As long as there a valid enemy unit and one of your own valid units, the point will be contested and no one gets the benefit of the extra vision.

I'll add the invis rules you suggested to the conditions. :D Again thnx

EDIT: Also, I changed my mind and think they should start in the channel animation (curled up) and open up when activated lol. (not sure how to do that either)
How many teams do you plan on having? Will it always be 5v5 for example or can the players be split up into different team sizes? I could add in the contesting stuff once I know.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,565
Alright, I think I got it working exactly as you wanted.

These are the only 2 Triggers you have to worry about:

VT Config = This has all of the variables you need to configure for the system. Hopefully it's easy to understand. Just copy and paste the Variables and adjust their Arrays and Values. Look at how I used them in my map to get a better understanding of how to do it.

Example: If you have 5 Vision Towers (so 5 Regions) in your map then you will need to set
  • Set VT_RegionCount = 5
and
  • Set VT_Region[1] = VisionTowerRegion1 <gen>
  • Set VT_Region[2] = VisionTowerRegion2 <gen>
  • Set VT_Region[3] = VisionTowerRegion3 <gen>
  • Set VT_Region[4] = VisionTowerRegion4 <gen>
  • Set VT_Region[5] = VisionTowerRegion5 <gen>
VT Unit Filter = This is where you will put your Conditions like "Is unit Alive" and "Is A Ground unit".
This filter is used in all of the other triggers that way you don't have to worry about editing multiple triggers every time you make a little change. Just make sure to reference the Variable "VT_FilterUnit" instead of using Entering Unit/Leaving Unit.
  • Conditions
    • (VT_FilterUnit is dead) Equal to False
    • (VT_FilterUnit is A flying unit) Equal to False
    • (VT_FilterUnit is A structure) Equal to False
    • (VT_FilterUnit has buff Wind Walk) Equal to False
    • (VT_FilterUnit has buff Invisibility) Equal to False
    • (Level of Permanent Invisibility for VT_FilterUnit) Equal to 0
    • (Level of Ghost for VT_FilterUnit) Equal to 0
    • (Owner of VT_FilterUnit) Not equal to Neutral Passive
    • (Owner of VT_FilterUnit) Not equal to Neutral Hostile
If you have any questions feel free to ask. Remember, you don't have to worry about the other triggers. Just adjust these two and you're good to go.

Edit: Uploaded v.6. Fixed some bugs. It now uses a Unit Indexer to get around some annoying bugs with the Enters/Leaves region Event.
 
Last edited:
Level 6
Joined
Feb 23, 2010
Messages
222
How many teams do you plan on having? Will it always be 5v5 for example or can the players be split up into different team sizes? I could add in the contesting stuff once I know.

I made a custom melee map from scratch inspired from twisted meadows (but balanced) so 4 players. (1v1, 2v2, FFA).

Checkin out your map now. =] Thanks for coming back to it.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,565
Alright, so there is a bug in ALL of the previous versions I uploaded that will cause the system to fail on rare occasions. However, in this new version I think I fixed it.

It turns out that Regions are slightly bugged in that the Unit isn't technically "inside" of a region when the Event "A unit enters/leaves region" fires. The size of Regions are actually off (explained in detail in the link below).

Here's the thread if anyone is interested: [General] - game does not realise when region contains unit

Edit: I added in a system to detect the Teams automatically. This assumes that you're setting up the Teams in the pre-game Lobby like you would with a standard Melee Map.

Edit 2: Uploaded v.9. Fixed a bug with the Team system. Tested it and everything appears to work.

Edit 3: Uploaded v.10. Had a small leak.
  • For each (Integer A) from 1 to VT_TotalRegions, do (Actions)
    • Loop - Actions
      • Custom script: set r = udg_VT_Region[bj_forLoopAIndex]
      • Custom script: call SetRect(r, GetRectMinX(r) - 32., GetRectMinY(r) - 32., GetRectMaxX(r) + 32., GetRectMaxY(r) + 32.)
      • Custom script: set r = null
^ set r = null was outside of the Loop. You can easily move it into the Loop like I did above. It's at the very bottom of the VT Config trigger.
 

Attachments

  • Vision Tower v.10.w3x
    31.4 KB · Views: 9
Last edited:
Level 6
Joined
Feb 23, 2010
Messages
222
Alright, so there is a bug in ALL of the previous versions I uploaded that will cause the system to fail on rare occasions. However, in this new version I think I fixed it.

It turns out that Regions are slightly bugged in that the Unit isn't technically "inside" of a region when the Event "A unit enters/leaves region" fires. The size of Regions are actually off (explained in detail in the link below).

Here's the thread if anyone is interested: [General] - game does not realise when region contains unit

THIS version (v.8) should be bug free... Fingers crossed. Hopefully you aren't too tired of looking at these, lol.

Edit: I added in a system to detect the Teams automatically. This assumes that you're setting up the Teams in the pre-game Lobby like you would with a standard Melee Map.

You're helping me, of course I'm going to check it all out. lol. Thnx again btw.

I'll check it out later today though, as I only had time to reply at the moment.
 
Status
Not open for further replies.
Top