• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Multiboard data update help

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

I'm making a TD where each tower has Experience, Kills and Damage dealt saved in a Hashtable.

I want to display in the multiboard

1- The name of the tower with most kills (With Owner Color).
2- The name of the tower with most experience (With Owner Color)
3- The name of the tower that has dealt more damage (With Owner Color)
4- The number of hostile creeps alive
5- The number of lives left.

I think it's better if I do it as a periodic trigger every 1 second. I don't want to update the kill row everytime a unit dies, and the experience row everytime a tower gets experience, and the damage row everytime a tower deals damage. I think it's lighter to do it as a periodic trigger.

I already know how to display the player color, my main doubt is: How do I know which tower has the most kills, damage, or exp? How do I compare all of them and know which one has the highest value in the slots (indexes) used in the hashtable to save those values into the tower Handle?.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
It's the "Damage dealt" in all the lifetime of the tower. It's stored in Slot 1 of Tower Handle.

I would have to check through all towers Slot 1 and know which one is the highest, and which tower has that value.
 
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

Moderator: I misstitled this thread asking for a multiboard, and what I need is a formula. I started a new thread http://www.hiveworkshop.com/forums/world-editor-help-zone-98/how-find-highest-value-214515/ with the correct title and question. You may mix threads this whenever you want or delete this one. Sorry for my mistake.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Lol, you're right. Thanks a lot for your help and fast answer.

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)
  Custom Script: Set int = GetHandleId(Towers[i])
  Set r = Load 1 of int in Hash
  If r > MaxDamage then
    Set MaxDamage = r
    Set MaxTower = Towers[i]
    Set Owner = Player number of (Owner of MaxTower)
  endif
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
No, you do not even need to put them in an array.

JASS:
Set MaxDamage = 0.00
Set MaxTower = null <-- consider the case that no unit is picked

Unit - Pick Every Unit in TowerGroup and do:
  Custom Script: Set int = GetHandleId(GetEnumUnit())
  Set r = Load 1 of int in Hash
  If r > MaxDamage then
    Set MaxDamage = r
    Set MaxTower = (Picked Unit)
    Set Owner = Player number of (Owner of MaxTower)
  endif
 
Status
Not open for further replies.
Top