Select the item instance with the smallest(or highest) value of all instances of the same item?

i don’t know javascript sadly but you’re probably right, i am surprised a function like the one i want to realize does not exist

If i want to select the highest value, and use 999999999999999999, but when i run the level the highest random value is only 1600, nothing will happen and it wont work, do you see why i need that threshold to be dynamic?

You could use an unimaginably large number when checking for the smallest value and for the largest value you would use a small negative number. So, whatever the first object value was it would be larger or smaller and become the new highest or lowest number.

The first object variable value is 6
Lowest = 999999999999999999
If objVar < lowest set lowest to objVar
(If 6 < 999999999999999999 set lowest to 6)

The first object variable value is 6
Highest = -999999999999999999
If objVar > highest set highest to objVar
(If 6 > -999999999999999999 set highest to 6)

The events to check Highest is separated of Lowest. Like @Keith_1357 said and my screenshoot shows:

edit: Just to clarify, I put the name of scene variable “Highest” because I did the events to pick the Highest value first. But i released that you don’t need another scene variable so I used the same scene variable in the events to pick Lowest value. But is just the name of scene variable. I don’t know if this could be confusing you…

I see no reason to use 99999999999 to get the high to low values.
Just use the first object as the init the values

example:

  1. first event = set the highest variable and lowest variable with first pick of OBJECT.
    2 ) start the loop:
    2.1) if it is less than the lowest var = updates the variable with a new value.
    2.2) if it is greater than the highest var = updates the variable with new value.
1 Like