• 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.

Pick Highest of 5 Integers

Status
Not open for further replies.
Level 21
Joined
Mar 16, 2008
Messages
955
Trying to imagine the best way to do this. Pick highest of 5 Integers, since the GUI function only has 2 input spots.

  • ...
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • highest_no_hero[SaveLoadEvent_PN] Greater than 0
    • Then - Actions
      • Set VariableSet difficulty_highest_load[SaveLoadEvent_PN] = highest_no_hero[SaveLoadEvent_PN]
    • Else - Actions
  • ...
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • highest_warden[SaveLoadEvent_PN] Greater than 0
      • highest_warden[SaveLoadEvent_PN] Greater than highest_no_hero[SaveLoadEvent_PN]
    • Then - Actions
      • Set VariableSet difficulty_highest_load[SaveLoadEvent_PN] = highest_warden[SaveLoadEvent_PN]
    • Else - Actions
  • ...
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • highest_dh[SaveLoadEvent_PN] Greater than 0
      • highest_dh[SaveLoadEvent_PN] Greater than highest_no_hero[SaveLoadEvent_PN]
      • highest_dh[SaveLoadEvent_PN] Greater than highest_warden[SaveLoadEvent_PN]
    • Then - Actions
      • Set VariableSet difficulty_highest_load[SaveLoadEvent_PN] = highest_dh[SaveLoadEvent_PN]
    • Else - Actions
  • ...
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • highest_potm[SaveLoadEvent_PN] Greater than 0
      • highest_potm[SaveLoadEvent_PN] Greater than highest_no_hero[SaveLoadEvent_PN]
      • highest_potm[SaveLoadEvent_PN] Greater than highest_warden[SaveLoadEvent_PN]
      • highest_potm[SaveLoadEvent_PN] Greater than highest_dh[SaveLoadEvent_PN]
    • Then - Actions
      • Set VariableSet difficulty_highest_load[SaveLoadEvent_PN] = highest_potm[SaveLoadEvent_PN]
    • Else - Actions
  • ...
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • highest_kotg[SaveLoadEvent_PN] Greater than 0
      • highest_kotg[SaveLoadEvent_PN] Greater than highest_no_hero[SaveLoadEvent_PN]
      • highest_kotg[SaveLoadEvent_PN] Greater than highest_warden[SaveLoadEvent_PN]
      • highest_kotg[SaveLoadEvent_PN] Greater than highest_dh[SaveLoadEvent_PN]
      • highest_kotg[SaveLoadEvent_PN] Greater than highest_potm[SaveLoadEvent_PN]
    • Then - Actions
      • Set VariableSet difficulty_highest_load[SaveLoadEvent_PN] = highest_kotg[SaveLoadEvent_PN]
    • Else - Actions
  • ...
  • ...
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • highest_no_hero[SaveLoadEvent_PN] Greater than 0
    • Then - Actions
      • Set VariableSet difficulty_highest_load[SaveLoadEvent_PN] = highest_no_hero[SaveLoadEvent_PN]
    • Else - Actions
  • ...
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • highest_warden[SaveLoadEvent_PN] Greater than difficulty_highest_load[SaveLoadEvent_PN]
    • Then - Actions
      • Set VariableSet difficulty_highest_load[SaveLoadEvent_PN] = highest_warden[SaveLoadEvent_PN]
    • Else - Actions
  • ...
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • highest_dh[SaveLoadEvent_PN] Greater than difficulty_highest_load[SaveLoadEvent_PN]
    • Then - Actions
      • Set VariableSet difficulty_highest_load[SaveLoadEvent_PN] = highest_dh[SaveLoadEvent_PN]
    • Else - Actions
  • ...
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • highest_potm[SaveLoadEvent_PN] Greater than difficulty_highest_load[SaveLoadEvent_PN]
    • Then - Actions
      • Set VariableSet difficulty_highest_load[SaveLoadEvent_PN] = highest_potm[SaveLoadEvent_PN]
    • Else - Actions
  • ...
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • highest_kotg[SaveLoadEvent_PN] Greater than difficulty_highest_load[SaveLoadEvent_PN]
    • Then - Actions
      • Set VariableSet difficulty_highest_load[SaveLoadEvent_PN] = highest_kotg[SaveLoadEvent_PN]
    • Else - Actions
  • ...
 
Last edited:
Level 24
Joined
Jun 26, 2020
Messages
1,928
There are several ways to do that, first you can use the max function but nested like this:

max(1, max(2, 3))

Or you can use a loop to compare all the values which is the most standard way to do it:

Set value[1] = <first value>
Set value[2] = <second value>
...
Set value[5] = <fifth value>

Set max = - 1
For i = 1 to 5
If value > max then
Set max = value
 
Level 21
Joined
Mar 16, 2008
Messages
955
Was worried nesting would bug it out because it happened to me once with concentrate strings function, or maybe I'm making that up.

but your 2nd idea is similar to the one in my "draft 2" trigger so I guess that will work. thanks.
 
Status
Not open for further replies.
Top