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

[Spell] Help with Lightning Call

Status
Not open for further replies.
Level 6
Joined
Sep 19, 2006
Messages
179
I tried to make a MUI code based on a tutorial. It gives the unit 4 defense and 8 attack damage.Code below:
  • Lightning Call
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Call
    • Actions
      • -------- Here, I set the main index and this is required for later. --------
      • Set IndexLimit = (IndexLimit + 1)
      • -------- Now I set the other 3 variables. These require the IndexLimit specified above. --------
      • Set TpUnit[IndexLimit] = (Triggering unit)
      • Set AffUnit[IndexLimit] = (Target unit of ability being cast)
      • Set Numbering[IndexLimit] = 0
      • -------- The 3 variables are set. Now it's time for the spell to work. But first: --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IndexLimit Equal to 1
        • Then - Actions
          • Trigger - Turn on Lightning Call Looping <gen>
        • Else - Actions
  • Lightning Call Looping
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer IndexCurrent) from 1 to IndexLimit, do (Actions)
        • Loop - Actions
          • Set Numbering[IndexCurrent] = (Numbering[IndexCurrent] + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Numbering[IndexCurrent] Equal to 2
            • Then - Actions
              • Unit - Add Lightning Activation to AffUnit[IndexCurrent]
              • Set TpUnit[IndexCurrent] = TpUnit[IndexLimit]
              • Set AffUnit[IndexCurrent] = AffUnit[IndexLimit]
              • Set Numbering[IndexCurrent] = Numbering[IndexLimit]
              • Set IndexLimit = (IndexLimit - 1)
              • Set IndexCurrent = (IndexCurrent - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IndexLimit Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
Since I'm not even a beginner at this, I do wonder what do I need to do in order to remove Lightning Activation(gives 8 attack damage)and I know no waits in a MUI spell. Any help?
 
Level 9
Joined
Apr 23, 2011
Messages
527
I'm assuming your spell simply gives a buff for a few seconds after 2 seconds have passed? If so, it's unnecessary to use dynamic indexing. However, I may be missing something, as you assign 2 unit variables, one for the target and then another for the caster. TpUnit is then never referred to in the loop trigger so you assign it for nothing. Could you explain your spell a little bit further?

If you wish to simply understand the process, then what you should do is put another ITE statement in Else - Actionsthat checks if Numbering[IndexCurrent] is equal to your desired duration (for example, 8 seconds). Also probably put the IndexLimit = 0 ITE in the aforementioned new ITE.
  • Lightning Call Looping
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer IndexCurrent) from 1 to IndexLimit, do (Actions)
        • Loop - Actions
          • Set Numbering[IndexCurrent] = (Numbering[IndexCurrent] + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Numbering[IndexCurrent] Equal to 2
            • Then - Actions
              • Unit - Add Lightning Activation to AffUnit[IndexCurrent]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Numbering[IndexCurrent] Equal to 8
                • Then - Actions
                  • Unit - Remove Lightning Activation from AffUnit[IndexCurrent]
                  • Set AffUnit[IndexCurrent] = AffUnit[IndexLimit]
                  • Set Numbering[IndexCurrent] = Numbering[IndexLimit]
                  • Set IndexLimit = (IndexLimit - 1)
                  • Set IndexCurrent = (IndexCurrent - 1)
                  • Else - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • IndexLimit Equal to 0
                      • Then - Actions
                        • Turn off (This trigger)
                      • Else - Actions
 
Status
Not open for further replies.
Top