- Joined
- Jun 12, 2007
- Messages
- 1,261
I have a map where 8 players each have their own integer value.
How can I see who has the highest?
How can I see who has the highest?
//** Get highest player value
// Requires the values of the players to search through to be in a variable.
// Substitute some function call or whatever you use to get this value as needed.
//
// @param: none
// @returns: the native player number of the player with the highest player value
//**
function getHighestPlayerValue takes nothing returns integer
local integer highestPlayerNum = 0
local integer highestValue = 0
local integer index = 0
loop
exitwhen index == 12
if (udg_theVariableWhereYouStoredTheValues[index] > highestValue) then
set highestPlayerNum = index
set highestValue = udg_variable[index]
endif
set index = index + 1
endloop
return highestPlayerNum
endfunction
Never caused problems on my maps.If the number of players is lower than 12, wouldn't
JASS:exitwhen index == 12
or
JASS:set index = index + 1
cause problems?
Maybe you could count every human player in the game and then use the exitwhen command.
For [B]all_numbers[/B] do:
if [B]current_number[/B] is bigger then [B]biggest_number[/B] then set [B]biggest_number[/B] to [B]current_number[/B]
Here, if you're too stupid to actually read what the Jass code does, this is what it does
Code:For [B]all_numbers[/B] do if [B]current_number[/B] is bigger then [B]biggest_number[/B] then set [B]biggest_number[/B] to [B]current_number[/B]
Is that so freaking hard to understand?
You know how to read texts, right? Reading (Jass) code is the same, its like talking to the CPU (very indirectly on a technical level though).
You can even recreate that function in GUI (much worse but its possible).
Yes, I know all that. What I say is that there are people that DO NOT know how to program. Which means that they actually can't read code. Is it that terrible? Is he a retard just because he can't read JASS?
Yes, I know all that. What I say is that there are people that DO NOT know how to program. Which means that they actually can't read code. Is it that terrible? Is he a retard just because he can't read JASS?
Jass is good for separate multiboards, long spells, and easy to make spells MPI and MPU and ofc to evade leaks if u are careful. Almost all other systems can be done in GUI but u need alot of expirience in it
I find it hard to see how this relates to the last previous posts, or to the thread at all.
I find it hard to see how this relates to the last previous posts, or to the thread at all. I couldn't answer better than u already do, thanks for you help read my signature