• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

How to find the highest value

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Hi!

I started this thread as a "Multiboard data update" but I noticed the title isn't appropiate.

I save all my tower kills and damage dealt so far during lifetime in a Hashtable under the towers handle. I need to find which tower has the highest number of kills or damage dealt, and know who owns it. How can I do that?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Like this? I know it's a mix of jass and GUI, I just need to know if the general idea works and it's easy + efficient.

JASS:
Set i = 0
Set MaxDamage = 0.00

Unit - Pick Every Unit in TowerGroup and do:
   Set i = i +1 
   Set Tower[i] = (Picked Unit)

For each Integer A from 1 to (Number of Units in TowersGroup) do (Actions)
   Custom Script: Set int = GetHandleId(Towers[GetForLoopIndexA()])
   Set r = Load 1 of int in Hash
   If r > MaxDamage then
      Set MaxDamage = r
      Set MaxTower = Towers[Integer A]
      Set Owner = Player number of (Owner of MaxTower)
   endif
 
Status
Not open for further replies.
Top