Filter the active with the lowest alterable value. Can it be done?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I'm looking to filter an active which have the lowest value on a given alterable value.
    Is there a way to do that?
    I heard there was an extension for it, but it doesn't work now.

    Has anyone done that?

    Please login to see this picture.

  • all active objects start their alterable values to 0.

    If you add multiple instances of that same object, you could do this in event editor:
    Run This Event Once -> [Active] -> Spread Value 0 in Alterable Value A

    For every object you add in frame editor, that Alterable Value A will be different.

    For the final bit, all you would do in event editor is something like this:
    [Active] Alterable Value A = 0 -> [Do your function here]

  • So the function Spread Value 0 will add floating point numbers to alterable value?
    And the Alterable Value A = 0 will select the active with the lower floating point value?
    That's what I understand from what you're saying..

    My actives have an alterable value named ID which can be from 1000 to 2,000,000.
    Sometimes I would have 3 to 4 actives with ID's 4200,4202,4028,4240.. etc.
    I need to select the one with the lowest value, like a queue.

    I could use queue object instead, but it isn't available for Android, so I use objects like a queue.
    But the order can't be set right.

    Please login to see this picture.

  • Can I ask why you have ID numbers from 2000 to 2,000,000? That sounds like a ridiculous number and the max number of objects in a frame can only be 20,000. Also if you're building for Android, I doubt you'd hit this max without dealing with slowdown.

    To find the lowest alterable value, you should use ForEach loops. A ForEach loop will go through each object in the loop and will test for each one individually. Therefore during the ForEach loop you should compare the objects current ID to the saved lowest ID you have checked so far. If that objects ID is lower than the saved ID, update your saved ID to the new lowest ID. When the ForEach loop is finished going through all the objects, your final saved ID number will be the lowest. Then you can compare to that number to specifically choose that object.

    -------

    Just to clarify about the spread values, no it does not use floating point values (numbers past decimals). It uses regular whole numbers. Spread values will start at the number you specify. Then for each instance (copy, not clone) of the object, it will add 1 to the spread value and record it in the alterable value. Therefore you can have different ID numbers separating your instances of an object.

    Sent from my iPhone using Tapatalk

    Custom A* Pathfinding in MMF2: Please login to see this link.
    Random Tile World Generation: Please login to see this link.

  • Hey Sumo, the IDs are representative only, it doesn't mean I have 2million objects on my game.
    I have max 10 objects that change ID's on the run while they are used.
    But the Id's come from a database.

    What you suggest it's a good Idea, I was hoping to avoid fast loops, but If I can't find any other way to do the same, the Ill do it that way.

    Please login to see this picture.

  • ForEach loops are super simple and will calculate your lowest ID object instantly. Let me know if you need more help, I can whip up an example when I get home from work.


    Sent from my iPhone using Tapatalk

    Custom A* Pathfinding in MMF2: Please login to see this link.
    Random Tile World Generation: Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!