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

2 Things

Status
Not open for further replies.
Level 10
Joined
Feb 22, 2008
Messages
619
Hi, so basically I need help with these two things:

Sight Triggers
I need to make it so that certain units can only see in front of them, possibly in a cone shape, I don't want them to be able to see behind at all. It would also be nice if you could help me make it so that if the [Unit1] sees a [Unit2] they will be able to see [Unit2] (whether or not [Unit2] is in front of [Unit1]) until [Unit2] gets maybe 300 away from [Unit1].


Maximum Amount of Unit Buildings Placed
Fairly simple problem, it tell me I have over 600 unit buildings and I was wondering if there was a way to have as many as I wanted to have without getting the Jass editor. If the only way is with the Jass editor I'll just get that but another solution would be nice.


So anyway please just post your solution(s) below and I will give +Rep to anyone who tries to help me, thanks. (You don't have to help me with both problems to get +Rep or anything).
PS: Sorry if the colors are disturbing, I tried to make them as eye pleasing as possible and they're just to separate the problems.
 
Level 9
Joined
Oct 11, 2009
Messages
477
For the Sight Trigger, you need at least two triggers:

The first:
  • Sight Trigger 1
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Add something if necessary)
    • Actions
      • Set Point[2] = (Position of Unit[2])
      • Set Point[1] = (Position of Unit[1])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between Point[1] and Point[2]) Greater than or equal to 300.00
        • Then - Actions
          • Visibility - Create an initially Enabled visibility modifier for (Owner of Unit[1]) emitting Visibility from Point[2] to a radius of 200.00
          • Set Visibilility Modifier[2] = (Last created visibility modifier)
        • Else - Actions
      • For each (Integer A) from (Integer(((Facing of Unit[1]) - 67.50))) to (Integer(((Facing of Unit[1]) + 67.50))), do (Actions)
        • Loop - Actions
          • Set Point[3] = (Point[1] offset by 600.00 towards (Real((Integer A))) degrees)
          • Visibility - Create an initially Enabled visibility modifier for (Owner of Unit[1]) emitting Visibility from Point[3] to a radius of 1.00
          • Set Visibilility Modifier[2] = (Last created visibility modifier)
      • Custom script: call RemoveLocation(udg_Point[1])
      • Custom script: call RemoveLocation(udg_Point[2])
      • Custom script: call RemoveLocation(udg_Point[3])
      • Visibility - Destroy Visibilility Modifier[1]
      • Visibility - Destroy Visibilility Modifier[2]

The second one:
  • Sight Trigger 2
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
      • (No Conditions at all, put something if necessary)
    • Actions
      • Visibility - Create an initially Enabled visibility modifier for (Owner of Unit[1]) emitting Black mask across (Entire map)
      • Visibility - Create an initially Enabled visibility modifier for (Owner of Unit[1]) emitting Fog of war across (Entire map)
For the Maximum Amount of Unit Buildings Placed:
  • Maximum Amount of Unit Buildings Placed
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Number of units in (Units owned by <Your Player> matching ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Equal to Townhall)))) Greater than or equal to 600
    • Actions
      • Game - Display to (Player group(<Your Player>))) the text: You have builded 600 Townhalls!!!
      • Trigger - Turn off (This trigger)
Noticed that I used 67.50 degrees? Its because 67.50 degrees is a cone angle, but if I used 45.00 degrees, the vision range of Unit[1] will be narrower. It includes the one you requested that if Unit[2] becomes closer to Unit[1], it will provide vision for Unit[1]. And for the note; you must have a global variable Point, you can name it in anyway you want. I used Point name for the Point variable for your reference. And also this includes the Maximum Amount of Unit Buildings Placed, the building Townhall that I used is only an example, you can change it anyway you want.
I hope it helps!!!:grin::grin::grin:
 
Last edited:
Level 14
Joined
Aug 31, 2009
Messages
775
sephiroth1234, you may want to reconsider your triggers.
You're creating a hell of a lot of visibility modifiers but then not destroying them later, and this can cause a lot of memory leakage.

Also, I don't think you've actually answered what he was asking for in the 2nd problem. He's trying to add many buildings onto the map, but the editor won't let him place more due to the 600 building limit in the editor.
As a solution, you could place some dummy units on the map, and at map initialisation (or whenever you want) replace all of these units with the correct building type. This bypasses the limit, as in-game there isn't one.
 
Level 9
Joined
Oct 11, 2009
Messages
477
Also, I don't think you've actually answered what he was asking for in the 2nd problem. He's trying to add many buildings onto the map, but the editor won't let him place more due to the 600 building limit in the editor.
As a solution, you could place some dummy units on the map, and at map initialisation (or whenever you want) replace all of these units with the correct building type. This bypasses the limit, as in-game there isn't one.


Oh, sorry. I didn't understand the second one earlier...:sad:
 
Status
Not open for further replies.
Top