• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] How to see what three integers are highest?

Status
Not open for further replies.
The only thing I can think of is multiple If/Then statements, but that's really not effective. There is no multiple variable comparison in GUI (that I know of), but that may be possible in JASS.
 
no randomly player with highest integer number is viewed.

like
Player1 integer=1
Player2 integer=6
Player3 integer=4
etc...
Player 2 have highest integer vaule.



Wait please i try do this
 
Well since a binary search is clearly not possible here...

JASS:
//** 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
 
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.
 
The only way to do this in GUI is
  • 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
 
I heard that you can't have more than one local in GUI... I mean, only the first custom scripted local gets registered, the others dont.
So that a trigger like this wouldn't work;
  • 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))
Not sure tho.
 
Last edited:
i think the hint is that it has something to do with the math - max function. this function compares two values that determines which value is higher.

this trigger is for example:

Event:
Player - Player 1 (Red) types a chat message containing compare as An exact match

Condition:none

Action:
Game - Display to (All players) the text: (String((Max((Life of Peasant 0056 <gen>), (Life of Footman 0057 <gen>)))))

this triggers simply display the hit point of footman because it has more hit point than that of the peasant
 
Last edited:
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?

Erm, did you even think he might not know JASS? Nobody was born knowing everything. Would you understand an advanced C++ app if the only thing you knew was "Hello World!"? If you're not used to programming, it's not that easy, you know...
 
The only way to do this in GUI is (onix's edit)
  • 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
i write it by my hands i am 2 lazy to open the world editor but i am sure it will work 100% and is leak free so u don't need nothing more
 
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
 
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?

It's not that they can't, it is that they don't even bother trying. I could figure what a small code like that does before I knew anything about programming or 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.
 
Wll, we have two "only" ways now, but i will throw in a third:

  • 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
I don't know if the hide board is needed :slp:
Now, in TempPlayer you have the leading player and High is his value.
 
Last edited by a moderator:
Hell, whats the english version of this one:
  • Leaderboard - Sort board by Value in Absteigend order
I have no idea, lol.
 
Status
Not open for further replies.
Back
Top