I want to save the index of the maximum value in an array as a variable to then evaluate an array at that index. I’ve thought about this for a long time but can’t figure out a way to do it.
I’ll provide some context on what I’m actually trying to accomplish. Maybe there’s a better approach that I haven’t thought of:
I’m making a deathmatch where players vote on what hero everyone will be. I pick three heroes by generating three random integers and storing them in elements of an array, say “Rand” I have a global variable, “Vote”, which keeps a tally of how many votes each hero has received. So Vote[2] represents the hero generated by Rand[2].
Let’s say Vote[2] is the highest value in the array, receiving the most votes. How do I then force players to be HeroArray[ Rand[2] ]