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

Don't build too close! (?)

Status
Not open for further replies.
Level 15
Joined
Jan 27, 2007
Messages
948
how can i make a trigger than checks if there is another building nearby the selected zone for the new building??

  • VillageClose
    • Events
      • Unit - A unit Begins construction
    • Conditions
      • (Unit-type of (Constructing structure)) Equal to Village
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
  • (WHAT GOES HERE???) xD
    • Then - Actions
      • Game - Display to (All players) the text: Too close to anothe...
      • Unit - Remove (Constructing structure) from the game
      • Player - Add 100 to (Owner of (Constructing structure)) Current gold
    • Else - Actions
      • Do nothing
 
Level 7
Joined
Mar 12, 2006
Messages
407
If there are no buildings at all allowed no matter which type you can do

  • dont build close
    • Events
      • Unit - A unit starts construction
    • Conditions
      • (Unit-type of (Constructing structure)) Equal to Village
    • Actions
      • Set p = (Position of (Constructing structure))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units within 512.00 of p matching (((Matching unit) is a Building) equals True))) Greater 1
        • Then - Actions
        • Else - Actions
      • Custom Script: call RemoveLocation(udg_p)
p is a Variable of Type Point
The range is ofc up to you 512 was just default
to get the function you do:
Integer Comparision
Count units in Unit group
Units in range matching
 
Level 7
Joined
Mar 12, 2006
Messages
407
  • (Number of units in (Units within 512.00 of p matching ((Unit-type of (Matching unit)) Gleich Village))) Greater 1
About the Number... not totally sure it has to be bigger then 1 but i think the condition will count the one being actually build too
so if it doesnt work with 1 try 0
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
1.)

Unit is issued targeting a point

-issued order not equal to smart/move/attack/patrol/and other abilities that has your unit
...your conditions

-ser ORDERED_UNIT = oredred unit
-start TIMER that will expire in 0.00 seconds

2.)
TIMER expires

-order ORDERED_UNIT to stop


dont ask why it should work :D ......

you must wait 0 sec or warcraft will crash....
 
1.)

Unit is issued targeting a point

-issued order not equal to smart/move/attack/patrol/and other abilities that has your unit
...your conditions

-ser ORDERED_UNIT = oredred unit
-start TIMER that will expire in 0.00 seconds

2.)
TIMER expires

-order ORDERED_UNIT to stop


dont ask why it should work :D ......

you must wait 0 sec or warcraft will crash....

This will not work since the target of stop has no point so u need order unit to go in a place then it will do it non stop and make ur pc on fire xD
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
This will not work since the target of stop has no point so u need order unit to go in a place then it will do it non stop and make ur pc on fire xD
wtf is he talking about......anway there is one more bad thing in my trigger,it will work for every structure

is there an issue order
-build structure of type ?

Look at this post for trigger.

you can use his trigger,i have the same one in my map :D
one small miss
if the structure is destroyed it will still be counted in unit group,so you cannot build near dead structure (witch should be bad)

add condition
unit of type (matching unit) equal to <<our unit tyype> and (matching unit) is alive equal to true

OR

remove construction structure instead killing it
 
Status
Not open for further replies.
Top