How do I move unit to nearest object?

0 favourites
  • 4 posts
From the Asset Store
SCI-FI Units SFX contains 456 sounds With this pack, you can voice almost all the units in your sci-fi strategy game
  • Hello,

    I have a family called "Allies", in this family there are "Warriors", "Archers", "Healers".

    I wanted to make the "Healers" unit move to the nearest low life unit. How can I do this? I have tried in many ways with no result.

    I'm using pathfinding to move units

    Sorry for the translation, soon I start my English course to correct this =D

    Tagged:

  • Use the "pick highest/lowest value" expression under the family "Allies" object, select your health variable and choose lowest. This will pick the instance with the lowest health, then add another condition "pick nearest / furthest" expression also under the "Allies" object, this will pick the closest instance. Store this picked instance in a variable of the healer then do pathfinding to it.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Use the "pick highest/lowest value" expression under the family "Allies" object, select your health variable and choose lowest. This will pick the instance with the lowest health, then add another condition "pick nearest / furthest" expression also under the "Allies" object, this will pick the closest instance. Store this picked instance in a variable of the healer then do pathfinding to it.

    Because of the translation I did here, this was the maximum I understood

    drive.google.com/file/d/1QGZkTTg9axgXT6p7z0nqU0AiQYjTK6T3/view

    Could you help me with more details?

  • You want to get the instances UID, Aliados.uid instead of Aliados.pickedcount.

    Then when you do the pathfinding you pick instance by the uid you stored in the variable.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)