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

Help Indexing

Status
Not open for further replies.
Level 6
Joined
Mar 2, 2013
Messages
127
So its my first time trying to make a spell mui by indexing, and its kinda cool!
but im having a little trouble. So this spell gives an attacked unit an ability that slows their ms and as. Each hit the level increases ability level and resets counter(lasts 3 seconds on target)

  • Attacks
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to (==) Baraggan
      • (Level of Rot for (Attacking unit)) Greater than (>) 0
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Int2[MaxIndex] Not equal to (!=) 0
          • Target[MaxIndex] Equal to (==) (Attacked unit)
        • Then - Actions
          • Set Int2[MaxIndex] = 3
          • Unit - Increase level of Bara slow 1 for Target[MaxIndex]
        • Else - Actions
          • Set MaxIndex = (MaxIndex + 1)
          • Set Target[MaxIndex] = (Attacked unit)
          • Set Attacker[MaxIndex] = (Attacking unit)
          • Set Int2[MaxIndex] = 3
          • Unit - Add Spell Book 1 to Target[MaxIndex]
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MaxIndex Equal to (==) 1
        • Then - Actions
          • Trigger - Turn on Attacks Timer <gen>
        • Else - Actions
  • Attacks Timer
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer CurrentIndex) from 1 to MaxIndex, do (Actions)
        • Loop - Actions
          • Set Int2[CurrentIndex] = (Int2[CurrentIndex] - 1)
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Int2[CurrentIndex] Equal to (==) 0
              • Then - Actions
                • Unit - Remove Spell Book 1 from Target[CurrentIndex]
                • Set MaxIndex = (MaxIndex - 1)
              • Else - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • MaxIndex Equal to (==) 0
              • Then - Actions
                • Trigger - Turn off (This trigger)
              • Else - Actions
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
If you are trying to do something like extend something it is best to use unit indexer with a unit group or use hashtable with a unit group.
The other way you can do it is to simply add instances but that means that other instances are running that do not need to run.

This should be in the de-index portion right after where you reduce the max instances.
  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • MaxIndex Equal to (==) 0
    • Then - Actions
      • Trigger - Turn off (This trigger)
    • Else - Actions
Also you never de-index the above.
 
Re-think the if-conditions and then-actions in your first If/Then/Else block in T1. It's not MUI, because you always only work with MaxIndex.

^deathismyfriend is right, do the check to turn trigger off in deindex part, and you can move the Set Int2[CurrentIndex] = (Int2[CurrentIndex] - 1) in the Else-Actions, and change condition to == 1, instead of ==0. (always care not to do unnecessary actions :p)
 
Status
Not open for further replies.
Top