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

Unit type within range of unit type

Status
Not open for further replies.
Level 1
Joined
Dec 24, 2009
Messages
2
Hey, I'm just making a small scenario for fun, and can't seem to be able to get an action to happen off a certain unit type being within range of another unit type. The example in question is that I want a building to be un-buildable within a certain range of itself, so the player will have to spread that building out. Any ideas? Will I have to use Variables? Thanks in advance.

EDIT: Sorry, I just realised that I'm supposed to post this in Triggers & Scripts, so if someone could please move this to the appropriate sub-forum, that'd be great.
 
Level 7
Joined
May 3, 2007
Messages
210
You'd be better off detecting a buildings construction, then finding all the units matching condition within range of the constructed unit, and removing the constructed unit/refunding the player when you find what you're looking for in the condition.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Well you're probably wanting the "Unit begins constructing a unit" event. From here you can check whether or not there are any units in an X radius of the same type and allow the unit to build the structure (leave him be) or disallow it (order him to stop, display message to user).
 
Status
Not open for further replies.
Top