I have four reals that changes values as the game progress.
They are each part of the same variable (array, size 4) - called "Damage".
Now I want to compare these values to find out which one is highest.
I also want to check if the two highest values are the same - aka a stalemate.
If a player isn't playing the value is 0.0 by default, so that's not a problem.
I don't mind a custom script solution to the problem.
I don't know how to turn the trigger into custom script, though. (In WC3 it was under 'Edit -> Turn into custom text', but not anymore?)
Thanks in advance.
EDIT:
First problem solved with a simple loop. I can now determine which value is largest by doing this:
Hi.
I have four reals that changes values as the game progress. They are each part of the same variable (array, size 4) - called "Damage".
Now I want to compare these values to find out which one is highest. I also want to check if the two highest values are the same - aka a stalemate.
If a player isn't playing the value is 0.0 by default, so that's not a problem.
I don't mind a custom script solution to the problem. I don't know how to turn the trigger into custom script, though. (In WC3 it was under 'Edit -> Turn into custom text', but not anymore?)
Thanks in advance.
EDIT: First problem solved with a simple loop. I can now determine which value is largest by doing this:
I still don't know how to find out if the highest two values (or more) are the same. (Stalemate.)
@Phrosen: Go
Make the 4 different variables into an array.
Then loop through all the values in the array to determine which one is the greatest.
If you can figure this out .... I suggest some heavy reading regarding array logic in general.
max(a, max(b, max(c, d)))