- 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?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
//** 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
Actions

Set Integer[1] = HighestInteger

If all conditions are True, Then do Then Actions, Else do Else Actions


If - Conditions



Integer[1] Less then or equal to Integer[2]


Then - Actions



Set Integer[2] = HighestInteger


Else - Actions

If all conditions are True, Then do Then Actions, Else do Else Actions


If - Conditions



HighestInteger Less then or equal to Integer[3]


Then - Actions



Set Integer[3] = HighestInteger


Else - Actions

If all conditions are True, Then do Then Actions, Else do Else Actions


If - Conditions



HighestInteger Less then or equal to Integer[4]


Then - Actions



Set Integer[4] = HighestInteger


Else - Actions

If all conditions are True, Then do Then Actions, Else do Else Actions


If - Conditions



HighestInteger Less then or equal to Integer[5]


Then - Actions



Set Integer[5] = HighestInteger


Else - Actions

If all conditions are True, Then do Then Actions, Else do Else Actions


If - Conditions



HighestInteger Less then or equal to Integer[6]


Then - Actions



Set Integer[6] = HighestInteger


Else - Actions

If all conditions are True, Then do Then Actions, Else do Else Actions


If - Conditions



HighestInteger Less then or equal to Integer[7]


Then - Actions



Set Integer[7] = HighestInteger


Else - Actions

If all conditions are True, Then do Then Actions, Else do Else Actions


If - Conditions



HighestInteger Less then or equal to Integer[8]


Then - Actions



Set Integer[8] = HighestInteger


Else - Actions
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.
Actions

Custom script: local integer a = 1

Custom script: local integer b = 2

Custom script: local unit u = GetTriggerUnit()

Custom script: call SetUnitState(u, UNIT_STATE_LIFE, (a + b))
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?
Actions
For each intiger from 1 to 12 do actions

Actions


If all conditions are True, Then do Then Actions, Else do Else Actions



If - Conditions




Integer[intigerA] Greater then or equal to HighestInteger



Then - Actions




Set HighestInteger = Integer[IntigerA]



Else - Actions
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
Leaderboard - Create a leaderboard for (All players) titled Hello i count.
Set board = (Last created leaderboard)
Leaderboard - Hide board
-------- IntegerVar[A] is the integer variable you have connected to each player --------
For each (Integer A) from 1 to 8, do (Actions)

Loop-Actions


Leaderboard - Change the value for (Player((Integer A))) in (Last created leaderboard) to Integer[(Integer A)]
Leaderboard - Sort board by Value in decending order
Set TempPlayer = (Player in position 1 of board)
Set High = Integer[(Player number of TempPlayer)]
Bestenliste - Destroy board

Leaderboard - Sort board by Value in Absteigend order
