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

MUI Spell not working properly

Status
Not open for further replies.
Level 2
Joined
Aug 20, 2015
Messages
18
[Solved] MUI Spell not working properly

I made a spell intended for multiple use but it doesn't seem to work properly... Any help is appreciated.
 
Last edited:
Level 37
Joined
Jul 22, 2015
Messages
3,485
Post your triggers next time. It's a lot faster than having to download your map.

Your deindex isn't right. All you're doing is nulling the current loop integer. You should be switching the last iteration to the current one that ended:
  • PhantomRushUnit[Loop] = PhantomRushUnit[Int]
  • PhantomRushTarget[Loop] = PhantomRushTarget[Int]

Two other things:
  • When you're turning on the loop, check if PhantomRushInteger is equal to 1.
  • When turning off the loop, check if PhantomRushInteger is EQUAL to 0.
 
Level 2
Joined
Aug 20, 2015
Messages
18
Post your triggers next time. It's a lot faster than having to download your map.

Your deindex isn't right. All you're doing is nulling the current loop integer. You should be switching the last iteration to the current one that ended:
  • PhantomRushUnit[Loop] = PhantomRushUnit[Int]
  • PhantomRushTarget[Loop] = PhantomRushTarget[Int]

Two other things:
  • When you're turning on the loop, check if PhantomRushInteger is equal to 1.
  • When turning off the loop, check if PhantomRushInteger is EQUAL to 0.

I did as you instructed but it still doesn't work. Put the unit and target variables under the for each loops at the repeating triggers and checked for the integer variables to turn on/off the loop.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
I did as you instructed but it still doesn't work. Put the unit and target variables under the for each loops at the repeating triggers and checked for the integer variables to turn on/off the loop.

Did you just blindly listen and only do it for those two? That was just an example, youre supposed to do it for all variables that are unique to a spell instance.
 
Level 2
Joined
Aug 20, 2015
Messages
18
  • Phantom Rush
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Phantom Rush
    • Actions
      • Set PhantomRushInteger = (PhantomRushInteger + 1)
      • Set PhantomRushUnit[PhantomRushInteger] = (Triggering unit)
      • Set PhantomRushTarget[PhantomRushInteger] = (Target unit of ability being cast)
      • Set PhantomRushPoint[PhantomRushInteger] = (Position of PhantomRushTarget[PhantomRushInteger])
      • Set PhantomRushDamage = 0.00
      • Set PhantomRushIndex[PhantomRushInteger] = True
      • Set PhantomRushIndex2[PhantomRushInteger] = False
      • Set PhantomRushCheck = (PhantomRushCheck + 1)
      • Unit - Turn collision for PhantomRushTarget[PhantomRushInteger] Off
      • Unit - Set PhantomRushTarget[PhantomRushInteger] movement speed to 0.01
      • Unit - Make PhantomRushUnit[PhantomRushInteger] Invulnerable
      • Set PhantomRushMUI = (PhantomRushMUI + 1)
      • Unit - Create 1 Phantom Shadow for (Owner of PhantomRushUnit[PhantomRushInteger]) at (PhantomRushPoint[PhantomRushInteger] offset by 400.00 towards 0.00 degrees) facing 180.00 degrees
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Set PhantomRushDummy[PhantomRushMUI] = (Last created unit)
      • Set PhantomRushMUI = (PhantomRushMUI + 1)
      • Unit - Create 1 Phantom Shadow for (Owner of PhantomRushUnit[PhantomRushInteger]) at (PhantomRushPoint[PhantomRushInteger] offset by 400.00 towards 90.00 degrees) facing 270.00 degrees
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Set PhantomRushDummy[PhantomRushMUI] = (Last created unit)
      • Set PhantomRushMUI = (PhantomRushMUI + 1)
      • Unit - Create 1 Phantom Shadow for (Owner of PhantomRushUnit[PhantomRushInteger]) at (PhantomRushPoint[PhantomRushInteger] offset by 400.00 towards 180.00 degrees) facing 0.00 degrees
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Set PhantomRushDummy[PhantomRushMUI] = (Last created unit)
      • Set PhantomRushMUI = (PhantomRushMUI + 1)
      • Unit - Create 1 Phantom Shadow for (Owner of PhantomRushUnit[PhantomRushInteger]) at (PhantomRushPoint[PhantomRushInteger] offset by 400.00 towards 270.00 degrees) facing 90.00 degrees
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Set PhantomRushDummy[PhantomRushMUI] = (Last created unit)
      • Trigger - Turn on Phantom Rush Periodic <gen>
  • Phantom Rush Periodic
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer PhantomRushLoopA) from 1 to PhantomRushInteger, do (Actions)
        • Loop - Actions
          • Set PhantomRushUnit[PhantomRushLoopA] = PhantomRushUnit[PhantomRushInteger]
          • Set PhantomRushTarget[PhantomRushLoopA] = PhantomRushTarget[PhantomRushInteger]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PhantomRushIndex[PhantomRushLoopA] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (PhantomRushTarget[PhantomRushLoopA] is alive) Equal to True
                • Then - Actions
                  • Unit - Hide PhantomRushUnit[PhantomRushLoopA]
                  • For each (Integer PhantomRushLoopB) from 1 to PhantomRushMUI, do (Actions)
                    • Loop - Actions
                      • Set PhantomRushDummy[PhantomRushLoopB] = PhantomRushDummy[PhantomRushMUI]
                      • Unit - Move PhantomRushDummy[PhantomRushLoopB] instantly to ((Position of PhantomRushDummy[PhantomRushLoopB]) offset by 15.00 towards (Facing of PhantomRushDummy[PhantomRushLoopB]) degrees), facing (Facing of PhantomRushDummy[PhantomRushLoopB]) degrees
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Distance between (Position of PhantomRushDummy[PhantomRushLoopB]) and (Position of PhantomRushTarget[PhantomRushLoopA])) Less than or equal to 15.00
                        • Then - Actions
                          • Special Effect - Create a special effect attached to the origin of PhantomRushTarget[PhantomRushLoopA] using war3mapImported\BloodSlam.mdx
                          • Set PhantomRushEffect[PhantomRushLoopA] = (Last created special effect)
                          • Cinematic - Fade out and back in over 0.60 seconds using texture White Mask and color (100.00%, 0.00%, 0.00%) with 0.00% transparency
                          • Set PhantomRushMUI2 = (PhantomRushMUI2 + 1)
                          • Unit - Create 1 Phantom Shadow for (Owner of PhantomRushUnit[PhantomRushLoopA]) at (PhantomRushPoint[PhantomRushLoopA] offset by 400.00 towards 45.00 degrees) facing 225.00 degrees
                          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
                          • Set PhantomRushDummy2[PhantomRushMUI2] = (Last created unit)
                          • Set PhantomRushMUI2 = (PhantomRushMUI2 + 1)
                          • Unit - Create 1 Phantom Shadow for (Owner of PhantomRushUnit[PhantomRushLoopA]) at (PhantomRushPoint[PhantomRushLoopA] offset by 400.00 towards 135.00 degrees) facing 315.00 degrees
                          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
                          • Set PhantomRushDummy2[PhantomRushMUI2] = (Last created unit)
                          • Set PhantomRushMUI2 = (PhantomRushMUI2 + 1)
                          • Unit - Create 1 Phantom Shadow for (Owner of PhantomRushUnit[PhantomRushLoopA]) at (PhantomRushPoint[PhantomRushLoopA] offset by 400.00 towards 225.00 degrees) facing 45.00 degrees
                          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
                          • Set PhantomRushDummy2[PhantomRushMUI2] = (Last created unit)
                          • Set PhantomRushMUI2 = (PhantomRushMUI2 + 1)
                          • Unit - Create 1 Phantom Shadow for (Owner of PhantomRushUnit[PhantomRushLoopA]) at (PhantomRushPoint[PhantomRushLoopA] offset by 400.00 towards 315.00 degrees) facing 135.00 degrees
                          • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
                          • Set PhantomRushDummy2[PhantomRushMUI2] = (Last created unit)
                          • For each (Integer B) from 1 to PhantomRushInteger, do (Actions)
                            • Loop - Actions
                              • Set PhantomRushUnit[(Integer B)] = PhantomRushUnit[PhantomRushInteger]
                              • Set PhantomRushTarget[(Integer B)] = PhantomRushTarget[PhantomRushInteger]
                              • For each (Integer A) from 1 to PhantomRushMUI, do (Actions)
                                • Loop - Actions
                                  • Set PhantomRushDummy[(Integer A)] = PhantomRushDummy[PhantomRushMUI]
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Owner of PhantomRushDummy[(Integer A)]) Equal to (Owner of PhantomRushUnit[(Integer B)])
                                    • Then - Actions
                                      • Unit - Kill PhantomRushDummy[(Integer A)]
                                      • Set PhantomRushDummy[(Integer A)] = No unit
                                    • Else - Actions
                          • Set PhantomRushCheck2 = (PhantomRushCheck2 + 1)
                          • Set PhantomRushIndex[PhantomRushLoopA] = False
                          • Set PhantomRushIndex2[PhantomRushLoopA] = True
                          • Trigger - Turn on Phantom Rush Periodic 2 <gen>
                          • Set PhantomRushCheck = (PhantomRushCheck - 1)
                        • Else - Actions
                • Else - Actions
                  • Unit - Make PhantomRushUnit[PhantomRushLoopA] Vulnerable
                  • Set PhantomRushUnit[PhantomRushLoopA] = No unit
                  • Set PhantomRushTarget[PhantomRushLoopA] = No unit
                  • Set PhantomRushPoint[PhantomRushLoopA] = (Position of No unit)
                  • Set PhantomRushIndex[PhantomRushLoopA] = False
                  • Set PhantomRushIndex2[PhantomRushLoopA] = False
                  • Set PhantomRushCheck = (PhantomRushCheck - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • PhantomRushCheck Less than or equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
            • Else - Actions
  • Phantom Rush Periodic 2
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer PhantomRushLoopA2) from 1 to PhantomRushInteger, do (Actions)
        • Loop - Actions
          • Set PhantomRushUnit[PhantomRushLoopA2] = PhantomRushUnit[PhantomRushInteger]
          • Set PhantomRushTarget[PhantomRushLoopA2] = PhantomRushTarget[PhantomRushInteger]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PhantomRushIndex2[PhantomRushLoopA2] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (PhantomRushTarget[PhantomRushLoopA2] is alive) Equal to True
                • Then - Actions
                  • For each (Integer PhantomRushLoopB2) from 1 to PhantomRushMUI2, do (Actions)
                    • Loop - Actions
                      • Set PhantomRushDummy2[PhantomRushLoopB2] = PhantomRushDummy2[PhantomRushMUI2]
                      • Unit - Move PhantomRushDummy2[PhantomRushLoopB2] instantly to ((Position of PhantomRushDummy2[PhantomRushLoopB2]) offset by 10.00 towards (Facing of PhantomRushDummy2[PhantomRushLoopB2]) degrees), facing (Facing of PhantomRushDummy2[PhantomRushLoopB2]) degrees
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Distance between (Position of PhantomRushDummy2[PhantomRushLoopB2]) and (Position of PhantomRushTarget[PhantomRushLoopA2])) Less than or equal to 15.00
                        • Then - Actions
                          • Special Effect - Create a special effect attached to the origin of PhantomRushTarget[PhantomRushLoopA2] using war3mapImported\BloodSlam.mdx
                          • Set PhantomRushEffect[(PhantomRushLoopA2 + 12)] = (Last created special effect)
                          • Cinematic - Fade out and back in over 0.60 seconds using texture White Mask and color (100.00%, 0.00%, 0.00%) with 0.00% transparency
                          • Unit - Unhide PhantomRushUnit[PhantomRushLoopA2]
                          • Unit - Turn collision for PhantomRushTarget[PhantomRushLoopA2] On
                          • Unit - Make PhantomRushUnit[PhantomRushLoopA2] Vulnerable
                          • Selection - Select PhantomRushUnit[PhantomRushLoopA2]
                          • Unit - Set PhantomRushTarget[PhantomRushLoopA2] movement speed to (Default movement speed of PhantomRushTarget[PhantomRushLoopA2])
                          • For each (Integer B) from 1 to PhantomRushInteger, do (Actions)
                            • Loop - Actions
                              • Set PhantomRushUnit[(Integer B)] = PhantomRushUnit[PhantomRushInteger]
                              • Set PhantomRushTarget[(Integer B)] = PhantomRushTarget[PhantomRushInteger]
                              • For each (Integer A) from 1 to PhantomRushMUI2, do (Actions)
                                • Loop - Actions
                                  • Set PhantomRushDummy2[(Integer A)] = PhantomRushDummy2[PhantomRushMUI2]
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Owner of PhantomRushDummy2[(Integer A)]) Equal to (Owner of PhantomRushUnit[(Integer B)])
                                    • Then - Actions
                                      • Unit - Kill PhantomRushDummy2[(Integer A)]
                                      • Set PhantomRushDummy2[(Integer A)] = No unit
                                    • Else - Actions
                          • Set PhantomRushIndex2[PhantomRushLoopA2] = False
                          • Set PhantomRushUnit[PhantomRushLoopA2] = No unit
                          • Set PhantomRushTarget[PhantomRushLoopA2] = No unit
                          • Set PhantomRushPoint[PhantomRushLoopA2] = (Position of No unit)
                          • Set PhantomRushCheck2 = (PhantomRushCheck2 - 1)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • PhantomRushCheck2 Equal to 0
                            • Then - Actions
                              • Trigger - Turn off (This trigger)
                            • Else - Actions
                        • Else - Actions
                • Else - Actions
                  • Special Effect - Destroy PhantomRushEffect[PhantomRushLoopA2]
                  • Special Effect - Destroy PhantomRushEffect[(PhantomRushLoopA2 + 12)]
                  • Unit - Unhide PhantomRushUnit[PhantomRushLoopA2]
                  • Unit - Make PhantomRushUnit[PhantomRushLoopA2] Vulnerable
                  • Unit - Set PhantomRushTarget[PhantomRushLoopA2] movement speed to (Default movement speed of PhantomRushTarget[PhantomRushLoopA2])
                  • Selection - Select PhantomRushUnit[PhantomRushLoopA2]
                  • Set PhantomRushUnit[PhantomRushLoopA2] = No unit
                  • Set PhantomRushTarget[PhantomRushLoopA2] = No unit
                  • Set PhantomRushPoint[PhantomRushLoopA2] = (Position of No unit)
                  • Set PhantomRushIndex2[PhantomRushLoopA2] = False
                  • Set PhantomRushIndex[PhantomRushLoopA2] = False
                  • Set PhantomRushCheck2 = (PhantomRushCheck2 - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • PhantomRushCheck2 Less than or equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
            • Else - Actions
Instead of using PhantomRushInteger to turn off the loops I use PhantomRushCheck.
 
Level 2
Joined
Aug 20, 2015
Messages
18
Because I'll be adding more triggers to this specifiec spell I wanted to make a seperate integer [PRMui and Mui2] to put them just to dummies so it won't be a variable confusion within there. Also, by max integer u mean like the PhantomRushInteger. And the Loop integer just gets reset to 1 each the loop is running so I do not have to manualy do something, do I?
 
Level 2
Joined
Aug 20, 2015
Messages
18
Since I was into GUI a lot in the past and I have some trouble with MUI... by decreasing the loop integer you mean to reduce it by like what? 1? when the dummies reach the distance specified? Like Set = PhantomRushLoopA = PhantomRushLoopA - 1?
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Since I was into GUI a lot in the past and I have some trouble with MUI... by decreasing the loop integer you mean to reduce it by like what? 1? when the dummies reach the distance specified? Like Set = PhantomRushLoopA = PhantomRushLoopA - 1?

Yes. Same way you did for PhantomRushCheck.

I also know that you said you use Check versus Int, what's the reasoning behind this? They are incremented at the same time, so theres really no need for 2 of the same variables?
 
Level 2
Joined
Aug 20, 2015
Messages
18
Doesn't work either. In fact, it's now not even function correctly for a single cast.

EDIT: Spell is fixed. Thanks for your attempt to help and interest KILLCIDE.
 
Last edited:
Status
Not open for further replies.
Top