Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Visualize: Dynamic Indexing

Discussion in 'Trigger (GUI) Editor Tutorials' started by PurgeandFire, Sep 27, 2013.

  1. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,309
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    What is supposed to happen when Whelp Carrying Red Dragon dies? The other interceptors die and de-index or?
     
  2. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    15,433
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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.
     

    Attached Files:

    Last edited: Aug 23, 2019
  3. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,309
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    • 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

    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.
     

    Attached Files:

  4. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    15,433
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Why this? It wasn't necessary in the non-MUI version or any loops I've made for it?
    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.
     
  5. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,309
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    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.
    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.
     

    Attached Files:

  6. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    15,433
    Resources:
    1
    Maps:
    1
    Resources:
    1
    :D thanks but it still has issues.
    Try making more dragons and play with the little ones kill them some by some, all, and try making more, try shuffling the whelp spell on/off with their number being max/below max, you'll see what I mean :p
     
  7. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,309
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    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.
     

    Attached Files:

  8. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    15,433
    Resources:
    1
    Maps:
    1
    Resources:
    1
  9. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,309
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    AHA!
    Remember when I told you
    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
     

    Attached Files:

  10. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    15,433
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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?
    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.
     
  11. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,309
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    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.
     

    Attached Files:

  12. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    15,433
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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: Aug 26, 2019
  13. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,309
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    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.
     
  14. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    15,433
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Hmm, I have this trigger and it kills all my spiders instead of the one actually close to the target:

    trigger

    • 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.
    trigger

    • 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

     

    Attached Files:

    Last edited: Aug 27, 2019
  15. corpuzmarvicjune

    corpuzmarvicjune

    Joined:
    Jun 20, 2012
    Messages:
    15
    Resources:
    0
    Resources:
    0
    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?
     

    Attached Files:

    Last edited: Nov 15, 2020