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

Visualize: Dynamic Indexing

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,806
What is supposed to happen when Whelp Carrying Red Dragon dies? The other interceptors die and de-index or?
Yes, I switch the whelp units, their point and set -1 to their integer. But first I wasn't able to fire the actions properly because, as you wrote, the double array was considered as one.



EDIT:

Still doesn't work:

  • Carrier Train Index
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Whelp Carrying Red Dragon
        • Then - Actions
          • Set CarrierIndexInteger = (CarrierIndexInteger + 1)
          • Set CarrierTrained[CarrierIndexInteger] = (Entering unit)
          • Unit Group - Add CarrierTrained[CarrierIndexInteger] to CarrierGroup
          • -------- Check If Ready to Go --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CarrierIndexInteger Greater than 0
            • Then - Actions
            • Else - Actions
        • Else - Actions
  • Interceptor Train MUI
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • For each (Integer CarrierCastInteger) from 1 to CarrierIndexInteger, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to Train Intercepting Red Dragon Whelp (Berserk)
              • CarrierInterceptorIndexInteger[CarrierCastInteger] Less than 8
              • (Casting unit) Equal to CarrierTrained[CarrierCastInteger]
            • Then - Actions
              • Game - Display to (All players) the text: Carrier Casts
              • Set CarrierInterceptorIndexInteger[CarrierCastInteger] = (CarrierInterceptorIndexInteger[CarrierIndexInteger] + 1)
              • Set InterceptorCreatePoint[CarrierCastInteger] = (Position of CarrierTrained[CarrierCastInteger])
              • Unit - Create 1 Intercepting Red Dragon Whelp for Player 1 (Red) at InterceptorCreatePoint[CarrierCastInteger] facing (Facing of CarrierTrained[CarrierCastInteger]) degrees
              • Set CarrierInterceptorUnit[CarrierCastInteger] = (Last created unit)
              • Game - Display to (All players) the text: (Name of CarrierInterceptorUnit[CarrierCastInteger])
              • Set InterceptorArrayGroup[CarrierCastInteger] = (Units within 512.00 of (Position of CarrierTrained[CarrierCastInteger]) matching ((Triggering unit) Equal to CarrierInterceptorUnit[CarrierInterceptorInteger]))
              • Unit Group - Add CarrierInterceptorUnit[CarrierCastInteger] to InterceptorArrayGroup[CarrierCastInteger]
              • Game - Display to (All players) the text: (InterceptorIndexInteger + (String(CarrierInterceptorIndexInteger[CarrierCastInteger])))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CarrierInterceptorIndexInteger[CarrierCastInteger] Equal to 8
                • Then - Actions
                  • Unit - For CarrierTrained[CarrierCastInteger], Ability Train Intercepting Red Dragon Whelp (Berserk), Hide ability: True
                • Else - Actions
            • Else - Actions
  • Interceptor Clear MUI
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer InterceptorDieInteger) from 1 to CarrierInterceptorInteger, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Dying unit) Equal to CarrierInterceptorUnit[InterceptorDieInteger]
              • ((Dying unit) is in InterceptorArrayGroup[InterceptorDieInteger]) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: Interceptor Died
              • Unit Group - Remove CarrierInterceptorUnit[InterceptorDieInteger] from InterceptorArrayGroup[InterceptorDieInteger]
              • Set CarrierInterceptorUnit[CarrierInterceptorInteger] = CarrierInterceptorUnit[InterceptorDieInteger]
              • Set CarrierInterceptorInteger = (CarrierInterceptorInteger - 1)
              • Set InterceptorDieInteger = (InterceptorDieInteger - 1)
              • Set InterceptorMoveOrderInteger = (InterceptorMoveOrderInteger - 1)
              • Set InterceptorCarrierPositionItgr = (InterceptorCarrierPositionItgr - 1)
              • Game - Display to (All players) the text: (InterceptorIndexInteger + (String(CarrierInterceptorInteger)))
            • Else - Actions
          • -------- Unhide Interceptor Train Ability --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CarrierInterceptorInteger Less than 8
            • Then - Actions
              • Unit - For CarrierTrained[InterceptorDieInteger], Ability Train Intercepting Red Dragon Whelp (Berserk), Hide ability: False
            • Else - Actions


EDIT2:
Still nothing:

  • Interceptor Train MUI
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • For each (Integer CarrierCastInteger) from 1 to CarrierIndexInteger, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to Train Intercepting Red Dragon Whelp (Berserk)
              • CarrierInterceptorInteger Less than 8
              • (Casting unit) Equal to CarrierTrained[CarrierCastInteger]
            • Then - Actions
              • Game - Display to (All players) the text: Carrier Casts
              • Set CarrierInterceptorIndexInteger[CarrierCastInteger] = (CarrierInterceptorIndexInteger[CarrierIndexInteger] + 1)
              • Set InterceptorCreatePoint[CarrierCastInteger] = (Position of CarrierTrained[CarrierCastInteger])
              • Unit - Create 1 Intercepting Red Dragon Whelp for Player 1 (Red) at InterceptorCreatePoint[CarrierCastInteger] facing (Facing of CarrierTrained[CarrierCastInteger]) degrees
              • Set CarrierInterceptorUnit[CarrierCastInteger] = (Last created unit)
              • Game - Display to (All players) the text: (Name of CarrierInterceptorUnit[CarrierCastInteger])
              • Set InterceptorArrayGroup[CarrierCastInteger] = (Units within 512.00 of (Position of CarrierTrained[CarrierCastInteger]) matching ((Triggering unit) Equal to CarrierInterceptorUnit[CarrierInterceptorInteger]))
              • Unit Group - Add CarrierInterceptorUnit[CarrierCastInteger] to InterceptorArrayGroup[CarrierCastInteger]
              • Game - Display to (All players) the text: (InterceptorIndexInteger + (String(CarrierInterceptorIndexInteger[CarrierCastInteger])))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CarrierInterceptorIndexInteger[CarrierCastInteger] Equal to 8
                • Then - Actions
                  • Unit - For CarrierTrained[CarrierCastInteger], Ability Train Intercepting Red Dragon Whelp (Berserk), Hide ability: True
                • Else - Actions
            • Else - Actions
  • Interceptor Clear MUI
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer InterceptorDieInteger) from 1 to CarrierCastInteger, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Dying unit) Equal to CarrierInterceptorUnit[InterceptorDieInteger]
              • ((Dying unit) is in InterceptorArrayGroup[InterceptorDieInteger]) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: Interceptor Died
              • Unit Group - Remove CarrierInterceptorUnit[InterceptorDieInteger] from InterceptorArrayGroup[InterceptorDieInteger]
              • Set CarrierInterceptorUnit[InterceptorDieInteger] = CarrierInterceptorUnit[CarrierCastInteger]
              • Set CarrierInterceptorIndexInteger[InterceptorDieInteger] = (CarrierInterceptorIndexInteger[CarrierCastInteger] - 1)
              • Set InterceptorDieInteger = (InterceptorDieInteger - 1)
              • Set InterceptorMoveOrderInteger = (InterceptorMoveOrderInteger - 1)
              • Set InterceptorCarrierPositionItgr = (InterceptorCarrierPositionItgr - 1)
              • Game - Display to (All players) the text: (InterceptorIndexInteger + (String(CarrierInterceptorIndexInteger[InterceptorDieInteger])))
            • Else - Actions
          • -------- Unhide Interceptor Train Ability --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CarrierInterceptorIndexInteger[InterceptorDieInteger] Less than 8
            • Then - Actions
              • Unit - For CarrierTrained[InterceptorDieInteger], Ability Train Intercepting Red Dragon Whelp (Berserk), Hide ability: False
            • Else - Actions

The indexing integer is 0 the first time a interceptor is created and 0 when any of the whelps die, no matter if some are still alive.

OK, I guess the integer with an array means the same mistake as before but how will I be able to make a specific integer for this specific chain (carrier and its interceptors) because if I use one integer without an array, it'd mean that this one integer will function for all Carrier and their interceptors which is bad if the integer gets -1 after an interceptor from one Carrier dies as all carriers will get the -1.
 

Attachments

  • ProtossShieldsTestX.w3x
    85.3 KB · Views: 121
Last edited:

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
  • Carrier Train Index
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Whelp Carrying Red Dragon
        • Then - Actions
          • Set CarrierMaxIndex = (CarrierMaxIndex + 1)
          • Set CarrierTrained[CarrierMaxIndex] = (Entering unit)
          • Unit Group - Add CarrierTrained[CarrierMaxIndex] to CarrierGroup
          • -------- Check If Ready to Go --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CarrierMaxIndex Greater than 0
            • Then - Actions
            • Else - Actions
        • Else - Actions
  • Interceptor Train MUI
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Train Intercepting Red Dragon Whelp (Berserk)
    • Actions
      • For each (Integer CarrierLoop) from 1 to CarrierMaxIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CarrierInterceptorIndexInteger[CarrierLoop] Less than 8
              • (Casting unit) Equal to CarrierTrained[CarrierLoop]
            • Then - Actions
              • Game - Display to (All players) the text: Carrier Casts
              • Set CarrierInterceptorIndexInteger[CarrierLoop] = (CarrierInterceptorIndexInteger[CarrierLoop] + 1)
              • Set Point = (Position of CarrierTrained[CarrierLoop])
              • Unit - Create 1 Intercepting Red Dragon Whelp for Player 1 (Red) at Point facing (Facing of CarrierTrained[CarrierLoop]) degrees
              • Custom script: call RemoveLocation(udg_Point)
              • Unit Group - Add (Last created unit) to InterceptorArrayGroup[CarrierLoop]
              • Game - Display to (All players) the text: (InterceptorIndexInteger + (String(CarrierInterceptorIndexInteger[CarrierLoop])))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CarrierInterceptorIndexInteger[CarrierLoop] Equal to 8
                • Then - Actions
                  • Unit - For CarrierTrained[CarrierLoop], Ability Train Intercepting Red Dragon Whelp (Berserk), Hide ability: True
                • Else - Actions
              • Set CarrierLoop = (CarrierMaxIndex + 1)
            • Else - Actions
  • Interceptor Clear MUI
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer InterceptorDieLoop) from 1 to CarrierMaxIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is in InterceptorArrayGroup[InterceptorDieLoop]) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: Interceptor Died
              • Unit Group - Remove (Triggering unit) from InterceptorArrayGroup[InterceptorDieLoop]
              • Set CarrierInterceptorIndexInteger[InterceptorDieLoop] = (CarrierInterceptorIndexInteger[InterceptorDieLoop] - CarrierInterceptorIndexInteger[InterceptorDieLoop])
              • Set InterceptorMoveOrderInteger[InterceptorDieLoop] = (InterceptorMoveOrderInteger[InterceptorDieLoop] - 1)
              • Set InterceptorCarrierPositionItgr[InterceptorDieLoop] = InterceptorCarrierPositionItgr[InterceptorDieLoop]
              • Game - Display to (All players) the text: (InterceptorIndexInteger + (String(CarrierInterceptorIndexInteger[CarrierLoop])))
            • Else - Actions
          • -------- Unhide Interceptor Train Ability --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CarrierInterceptorIndexInteger[InterceptorDieLoop] Less than 8
            • Then - Actions
              • Unit - For CarrierTrained[InterceptorDieLoop], Ability Train Intercepting Red Dragon Whelp (Berserk), Hide ability: False
            • Else - Actions
          • -------- -----DEINDEX--- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to CarrierTrained[InterceptorDieLoop]
            • Then - Actions
              • Unit Group - Pick every unit in InterceptorArrayGroup[InterceptorDieLoop] and do (Actions)
                • Loop - Actions
                  • Unit - Kill (Picked unit)
              • Unit Group - Remove all units from InterceptorArrayGroup[InterceptorDieLoop]
              • Set CarrierTrained[InterceptorDieLoop] = CarrierTrained[CarrierMaxIndex]
              • Set InterceptorArrayGroup[InterceptorDieLoop] = InterceptorArrayGroup[CarrierMaxIndex]
              • Set InterceptorDieLoop = (InterceptorDieLoop - 1)
              • Set CarrierMaxIndex = (CarrierMaxIndex - 1)
            • Else - Actions
OK, I guess the integer with an array means the same mistake as before but how will I be able to make a specific integer for this specific chain (carrier and its interceptors)
I'm not sure I understand that, but maybe I've already done that. All variables like CarrierTrained and the InterceptorArrayGroup (more) are pointing to the corresponding to an index, if you're trying to reference to a every from the intereceptorgroup with a variable then don't, since you can just pick every unit in the group and do what you want with them.
 

Attachments

  • ProtossShieldsTestX_WrdaFix.w3x
    84.5 KB · Views: 110

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,806
joinbottom.gif
set.gif
Set CarrierLoop = (CarrierMaxIndex + 1)
Why this? It wasn't necessary in the non-MUI version or any loops I've made for it?
  • empty.gif
    empty.gif
    empty.gif
    line.gif
    line.gif
    join.gif
    set.gif
    Set CarrierInterceptorIndexInteger[InterceptorDieLoop] = (CarrierInterceptorIndexInteger[InterceptorDieLoop] - CarrierInterceptorIndexInteger[InterceptorDieLoop])
  • empty.gif
    empty.gif
    empty.gif
    line.gif
    line.gif
    join.gif
    set.gif
    Set InterceptorMoveOrderInteger[InterceptorDieLoop] = (InterceptorMoveOrderInteger[InterceptorDieLoop] - 1)
  • empty.gif
    empty.gif
    empty.gif
    line.gif
    line.gif
    join.gif
    set.gif
    Set InterceptorCarrierPositionItgr[InterceptorDieLoop] = InterceptorCarrierPositionItgr[InterceptorDieLoop]
Why not loop integer after =?

My head hurts.

Anyways, tested and it's pretty much the same, indexinteger always considered 0 no matter how many whelps die and the modified Berserker ability doesn't disappear the second time.

Thanks for the input though.
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
I'm stupid, now it's fixed. It was this
  • Set CarrierInterceptorIndexInteger[InterceptorDieLoop] = (CarrierInterceptorIndexInteger[InterceptorDieLoop] - 1)
And was this
  • Set CarrierInterceptorIndexInteger[InterceptorDieLoop] = (CarrierInterceptorIndexInteger[InterceptorDieLoop] - CarrierInterceptorIndexInteger[InterceptorDieLoop])
Which always made it as 0 as soon as one of them died.
Why this? It wasn't necessary in the non-MUI version or any loops I've made for it?
it isn't necessary but makes the loop exit when we found which carrier casted the spell, so if we know the [index] we do other actions and make it exit loop so it doesn't need to check more indexes and conditions :)
I don't know how to answer your 2nd question since i don't really see the context in it
I don't know what InteceptorMoveOrderInteger is supposed to do though, i assumed it as a battle formation so you could make interceptors be around the carrier.
 

Attachments

  • ProtossShieldsTestX_WrdaFix2.w3x
    83.7 KB · Views: 120

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
Fixed. The problem was that
  • Unit - For (Triggering unit), Ability SomeAbility, Hide ability: True/False
Is a stacked action, meaning if you have it twice in a row with true. Then doing one with false won't hide the ability, you have to do the same number of times of the opposite. But I fixed it with a variable boolean array :D All should be fixed now. Except of course the part of them all moving around. The indexing and de-indexing is completly fixed.
 

Attachments

  • ProtossShieldsTestX_WrdaFix3.w3x
    83.9 KB · Views: 105

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
AHA!
Remember when I told you
Now my question is... did you initialize the groups? InterceptorArrayGroup[some high value]? Otherwise, in a map initialization trigger do it:
  • Custom Script: call set udg_InterceptorArrayGroup[loop] = CreateGroup()
Because you can't add units to a group that doesn't even exist.
Well, you didn't have that so Interceptor Clear MUI didn't even run because the 2nd index of the group didn't even exist XD
Note that array unit groups and similars like player groups are NOT initialized, meaning only the first index is, if you want to use more indexes then increase the size of the variable on the variable dialog:
upload_2019-8-24_12-22-5.png

Or just do manually on Carrier Train Index, like I did now :)
I still think you're kind of lost in all of this dynamic indexing logic xD
 

Attachments

  • ProtossShieldsTestX_WrdaFix4.w3x
    84 KB · Views: 109

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,806
Note that array unit groups and similars like player groups are NOT initialized, meaning only the first index is, if you want to use more indexes then increase the size of the variable on the variable dialog:
But I have no such problem with the shield triggers, possibly because I only use one unit group where all shield bearing units are included?
I still think you're kind of lost in all of this dynamic indexing logic xD
Obviously, why I seek help.

Anyways, it's much better but sadly, there still are some issues. Some bug dragons get their integer from -5 and then to +8.
Same with the little dragons when killed:
index0.png
index1.png
index-5.png
index-5to0.png
index-5to8.png
Even though it shows a different group number, it was the same dragon doing the spawning from -5 to 8.
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
First question: yes
the bug: apparently I couldn't set a group with an index to another group index...I'm still dumbfounded.
Any way, It seems finally work 100% after playing around.
 

Attachments

  • ProtossShieldsTestX_WrdaFix6.w3x
    84 KB · Views: 106

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,806
Any way, It seems finally work 100% after playing around.
Hey, thanks again!

Why is it necessary to destroy groups and make them before not even adding any units in or removing any? Also, can they not be made without custom script?

Also, why does the interceptor integer get - after the carrier dies and not after an interceptor dies?
  • Set InterceptorDieLoop = (InterceptorDieLoop - 1)
Is it necessary to turn the trigger on before a unit group loop and then off?
 
Last edited:

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
1: Because you can't add units to a group array that doesn't exist at all, and also to prevent leaks, it's just a safe way to prevent leaks. No it isn't possible to do it without custom scripts.
2: Because we need the loop to check that index again since we set all variables[currentindex] to variables[maxindex], so you -1 for when it iterates again it will +1, it's the way to make it check the index again with new data. The dynamic indexing consists of replacing the index you're at with the max index.
3: Yes, because pick every unit action has "Kill - Picked Unit" and that will "pause" the actions queue and fire again because the event is "A unit dies", and then it fires all those unnecessary actions.
 

deepstrasz

Map Reviewer
Level 69
Joined
Jun 4, 2009
Messages
18,806
3: Yes, because pick every unit action has "Kill - Picked Unit" and that will "pause" the actions queue and fire again because the event is "A unit dies", and then it fires all those unnecessary actions.
Hmm, I have this trigger and it kills all my spiders instead of the one actually close to the target:


  • Spider Mine Attack
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • -------- Spider Mine Movement --------
      • For each (Integer SpiderMineAttackInteger) from 1 to SpiderMineCountInteger, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between (Position of SpiderMineUnit[SpiderMineAttackInteger]) and (Position of SpiderMineTargetUnit)) Less than or equal to 400.00
              • (SpiderMineTargetUnit is alive) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: Spider Mine Attack
              • Unit - Order SpiderMineUnit[SpiderMineAttackInteger] to Undead Crypt Fiend - Unburrow
              • Set SpiderMineTargetGroup = (Units within 400.00 of (Position of SpiderMineUnit[SpiderMineAttackInteger]) matching ((((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to True) and (((Matching unit) is A ground unit) Equal to True)))
              • Set SpiderMineTargetPoint = (Position of (Random unit from SpiderMineTargetGroup))
              • Unit Group - Pick every unit in SpiderMineTargetGroup and do (Actions)
                • Loop - Actions
                  • Unit - Order SpiderMineUnit[SpiderMineAttackInteger] to Move To SpiderMineTargetPoint
              • -------- Spider Mine Explosion --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between (Position of SpiderMineUnit[SpiderMineAttackInteger]) and SpiderMineTargetPoint) Less than or equal to 125.00
                • Then - Actions
                  • Set SpiderMineExplosionGroup = (Units within 300.00 of (Position of SpiderMineUnit[SpiderMineAttackInteger]) matching ((((Matching unit) is A ground unit) Equal to True) and ((Unit-type of (Matching unit)) Not equal to Nerubian Mine)))
                  • Trigger - Turn off (This trigger)
                  • Unit Group - Pick every unit in SpiderMineExplosionGroup and do (Actions)
                    • Loop - Actions
                      • Unit - Cause VultureTrainedUnit to damage (Picked unit), dealing 200.00 damage of attack type Spells and damage type Normal
                      • Unit - Kill SpiderMineUnit[SpiderMineAttackInteger]
                      • Special Effect - Create a special effect at SpiderMineTargetPoint using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
                      • Set SpiderMineFX = (Last created special effect)
                  • Trigger - Turn on (This trigger)
                  • Custom script: call DestroyGroup (udg_SpiderMineExplosionGroup)
                  • Special Effect - Destroy SpiderMineFX
                • Else - Actions
              • Custom script: call DestroyGroup (udg_SpiderMineTargetGroup)
              • Custom script: call RemoveLocation (udg_SpiderMineTargetPoint)
            • Else - Actions
              • Unit - Order SpiderMineUnit[SpiderMineCountInteger] to Undead Crypt Fiend - Burrow


EDIT: OK, funny, it seems not to be because of the kill trigger.

Never mind. I'm stupid. I forgot the mine is made of two unit types.

Grr, I think at least one of them still die when one explodes.

EDIT: I guess I had to put the kill trigger out of the group loop.



EDIT2:
for some reason this integer even though becomes 3, the conditions after it sees it as 3 if 4 units have been summoned so I had to put the condition to verify 2.

  • Spider Mine Count
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Summoned unit)) Equal to Nerubian Mine
          • (Summoning unit) Equal to VultureTrainedUnit
          • SpiderMineCountInteger Less than 3
        • Then - Actions
          • Set SpiderMineCountInteger = (SpiderMineCountInteger + 1)
          • Set SpiderMineUnit[SpiderMineCountInteger] = (Summoned unit)
          • Unit Group - Add SpiderMineUnit[SpiderMineCountInteger] to SpiderMineGroup
          • Unit - Order SpiderMineUnit[SpiderMineCountInteger] to Undead Crypt Fiend - Burrow
          • Game - Display to (All players) the text: Vulture Casts
          • Game - Display to (All players) the text: (SpiderMineCountInteger + (String(SpiderMineCountInteger)))
          • Game - Display to (All players) the text: (SpiderMinesGroup + (String((Number of units in SpiderMineGroup))))
          • -------- Spider Mine Limit --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SpiderMineCountInteger Equal to 2
            • Then - Actions
              • Unit - For Unit VultureTrainedUnit, Set cooldown of ability Place Nerubian Mine - G , Level: 0 to 10000.00
            • Else - Actions
          • Trigger - Add to Spider Mine Target Within Range <gen> the event (Unit - A unit comes within 400.00 of SpiderMineUnit[SpiderMineCountInteger])
        • Else - Actions
 

Attachments

  • ProtossShieldsTest.w3x
    89.3 KB · Views: 99
Last edited:
Hello and good day, this tutorial you have posted is quite comprehensive and it really enlightens me on how to make MUI spells. It gives me the perseverance to make MUI spells. I tried to use the concept of this tutorial for the spell I created but somehow failed to stop the loop when the first caster finishes casting the ability. The damage points and effects went on. I choose to reply here in hopes that some may be able to answer the question. I have made a spell, not like this though but almost as it is a channeling spell; however, if the caster is interrupted, the spell stops and the effects and damage stops too. When I tried it in MUI, even if the caster is interrupted or finishes channeling the ability, the effects and damage went on. The whole spell consists of 3 triggers, 1st was for setting all the variables and activating the loop. 2nd was for the damage points, effects and damage and last trigger was for stopping the trigger.

In connection to this tutorial, I can say that the spell you made as an example is a channeling spell, but how would you stop the loop if your caster was interrupted?


BTW, how can I attach a screenshot of the trigger to appear inside the comment box?
 

Attachments

  • Untitled1.jpg
    Untitled1.jpg
    80.4 KB · Views: 69
  • Untitled2.jpg
    Untitled2.jpg
    395.8 KB · Views: 76
  • Untitled3.jpg
    Untitled3.jpg
    85.2 KB · Views: 67
Last edited:
Level 5
Joined
Feb 5, 2021
Messages
89
Alright, so i followed this guide and its incredible in so many ways and i have now learnt way more than i had anticipated..
Im hoping someone still looks at this and might be able to help me, since there is 1 thing i just cannot fathom.

Im guessing its an integer variable, but what is its initial value? when is it set? where and how does it stay "above 0" when i can only see that we remove 1 from the value, but never set it up again? = (SL_Loop_Integer) ??

Is it just an integer with an initial value of 1 or smth?
 
Alright, so i followed this guide and its incredible in so many ways and i have now learnt way more than i had anticipated..
Im hoping someone still looks at this and might be able to help me, since there is 1 thing i just cannot fathom.

Im guessing its an integer variable, but what is its initial value? when is it set? where and how does it stay "above 0" when i can only see that we remove 1 from the value, but never set it up again? = (SL_Loop_Integer) ??

Is it just an integer with an initial value of 1 or smth?
SL_Loop_Integer as the name suggest, is a loop integer. So, if you notice the loop trigger, it is used there.

For SL_Loop_Integer from 1 to X means that the value for the variable will Loop from 1 to X
 
Level 5
Joined
Feb 5, 2021
Messages
89
SL_Loop_Integer as the name suggest, is a loop integer. So, if you notice the loop trigger, it is used there.

For SL_Loop_Integer from 1 to X means that the value for the variable will Loop from 1 to X
Yes thanks i got that much, so the variable itself, what is its initial value?

I understand its purpose but not if i need to do anything but create it?
 
Top