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

Detecting when a unit starts using a Shop

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,496
So i'm making a custom Shop system with pages and categories and I wanted to know of a good way to determine if a unit has come into buying range of a Shop. I have some ideas, but I'd like to know what you guys would do.

So the first two ideas that come to mind are:

1) A unit comes within Range of the Shop (The event or using a periodic timer to compare positions)
2) Detect when a shop uses it's "Select User" ability or one of it's other Shop-related abilities

Option 2 doesn't seem to work, but this would probably be the best option if I could get it to work. The idea of using a timer and constantly setting points sounds pretty inefficient to me, but maybe I'll have to settle with that.

Any suggestions?
 
Last edited:
Level 20
Joined
Aug 29, 2012
Messages
818
If your shops are pre-placed on the map, the event "A unit comes within range" is probably the easiest solution.

Else, you could create a region around your shop and detect whether an unit enters the area. It probably won't be 100% accurate as I believe the "aura" around the shop is a circle and the region is a square, but that shouldn't be game breaking.
 
Status
Not open for further replies.
Top