1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Choose your ride to damnation in the 5th Special Effect Contest Poll.
    Dismiss Notice
  5. The winners of the 13th Techtree Contest have been announced!
    Dismiss Notice
  6. The 13th Music Contest Poll is up! Vote for the best tracks in this symphony of frost and flame.
    Dismiss Notice
  7. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  8. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Detecting when a unit starts using a Shop

Discussion in 'World Editor Help Zone' started by Uncle, May 20, 2019.

  1. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    764
    Resources:
    0
    Resources:
    0
    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: May 20, 2019
  2. Chaosium

    Chaosium

    Joined:
    Aug 29, 2012
    Messages:
    416
    Resources:
    2
    Models:
    2
    Resources:
    2
    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.
     
  3. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    764
    Resources:
    0
    Resources:
    0
    Turns out I didn't actually need this for my shop system, but maybe this will help someone else out.