Find path to object that has a certain instance variable val

  • Hello guys,

    I've set up a little test where sheep collect material and bring it to the headquarters:

    [attachment=2:cofffyss][/attachment:cofffyss]

    The material mountains are all the same object that have different values set for the instance variable material_number. This variable determines which animation is used and it also gives its value to the sheep's instance variable collecting_material_number when the sheep is dropped onto the mountain. When the sheep reaches the HQ, +1 is added to the appropriate material value (which is stored in an array).

    Now the problem is that, when having reached the HQ, the sheep finds its path to the mountain in the middle, but not to the mountain which it first was dropped onto.

    [attachment=1:cofffyss][/attachment:cofffyss]

    I'm looking for an event like

    Find path to a mountain that has a certain value set at its instance variable, e.g. 2

    I would appreciate any kind of help. Thank you.

  • add a subevent:

    system pick pick by comparison: object=mountain mountain.material number = sheep.collectign material number

    and put the last two actions in that subevent..

  • Wow, this software is awesome. And so are you. Thanks a lot!

    [attachment=0:3nvpdd7d][/attachment:3nvpdd7d]

  • That works? I think you need Move along path in a separate 'On Path Found type' event..

  • I thought so too, but it works, yes.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Careful.. it could be a timing thing. I would follow recommended practice..

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