• 🏆 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!

How can I loop through the custom value of all units?

Status
Not open for further replies.
Which Unit indexer you use, bribes GUI Unit Indexer?

Edit: Bribes Unit Indexer saves used indexes in an double linked list, you might loop this linked list, not sure right now how to do.
I think UDexGen is the amount of generated indexes, hmm. might loop from 1 to udexgen or until you repeat first one.

  • empty.gif
    line.gif
    line.gif
    join.gif
    set.gif
    Set UDexPrev[UDexNext[0]] = UDex
  • empty.gif
    line.gif
    line.gif
    join.gif
    set.gif
    Set UDexNext[UDex] = UDexNext[0]
 
Last edited:
Level 11
Joined
Oct 9, 2015
Messages
721
Yes, I'm using Bribes, I did this:
  • Movement and turning
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set UDexPrev[UDexNext[0]] = UDex
      • Set UDexNext[UDex] = UDexNext[0]
      • For each (Integer A) from UDexPrev[UDexNext[0]] to UDexNext[UDex], do (Actions)
        • Loop - Actions
Apparently it works (didn't tested MUI functionality). Can you please confirm if that's it ?
 
Edit: LinkEDlists are not from - to
They are in worst case sperated indexes knowing the next/previous one, you can't simple move from first to last.

This should do the trick.
It Prints out the Unit Names, Index in the array, and its custom value.
Beaware that Bribes Unit indexer cleans off lost indexes only as soon 15 units entered the game.
  • Loop All Last to first
    • Ereignisse
      • Player - Player 1 (Rot) skips a cinematic sequence
    • Bedingungen
    • Aktionen
      • -------- This will enum the List starting with the lastest moving down to first --------
      • -------- Get Last --------
      • Set Current = UDexNext[0]
      • For each (Integer A) from 1 to UDexGen, do (Actions)
        • Schleifen - Aktionen
          • -------- Looped all? bribes list ends with 0 --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Current Equal 0
            • Then - Actions
              • Game - Display to (All players) for 30.00 seconds the text: -------------
              • Skip remaining actions
            • Else - Actions
          • -------- Print current Unit/Index/Custom Value --------
          • -------- If a unit was Removed; Index and Custom Value are not equal --------
          • Game - Display to (All players) for 30.00 seconds the text: ((Name of UDexUnits[Current]) + (( - + ((String(Current)) + - )) + (String((Custom value of UDexUnits[Current])))))
          • -------- Get Next --------
          • Set Current = UDexNext[Current]
  • Loop All First to last
    • Ereignisse
      • Player - Player 1 (Rot) skips a cinematic sequence
    • Bedingungen
    • Aktionen
      • -------- This will enum the units from first to Last index --------
      • -------- Get First and take allways prev in this trigger to find further units --------
      • Set Current = UDexPrev[0]
      • For each (Integer A) from 1 to UDexGen, do (Actions)
        • Schleifen - Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Current Equal 0
            • Then - Actions
              • Game - Display to (All players) for 30.00 seconds the text: -------------
              • Skip remaining actions
            • Else - Actions
          • Game - Display to (All players) for 30.00 seconds the text: ((Name of UDexUnits[Current]) + (( - + ((String(Current)) + - )) + (String((Custom value of UDexUnits[Current])))))
          • Set Current = UDexPrev[Current]
 
Last edited:
Status
Not open for further replies.
Top