1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  4. The Secrets of Warcraft 3 have revealed interesting works. The RESULTS for Abelhawk's Mini-Mapping Contest #15 have come out!
    Dismiss Notice
  5. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  6. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  7. Night Rider gained several songs for his journey. The poll for the 12th Music Contest has started. Check it out!
    Dismiss Notice
  8. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  9. Join other hivers in a friendly concept-art contest. The contestants have to create a genie coming out of its container. We wish you the best of luck!
    Dismiss Notice
  10. Check out the Staff job openings thread.
    Dismiss Notice
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. Timo

    Timo

    Joined:
    Jan 8, 2013
    Messages:
    321
    Resources:
    0
    Resources:
    0
    i have a question, what if i have to use 2 loops? or more triggers like..

    i use the spell and gets a buff. then theres the loop checking when the buff runs out.
    the buff also makes me deal extra damage and i need a trigger when a unit gets damage to let my hero deal more damage. etc. what if i have a spell for what i need more then 2 triggers. lets say 5?
     
  2. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,151
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Naturally it's not limited to amount of triggers, so you can make such loop over indices in multiple triggers, too. Could you show up where your code gets a problem?
     
  3. Timo

    Timo

    Joined:
    Jan 8, 2013
    Messages:
    321
    Resources:
    0
    Resources:
    0
    just wantet to recreate this problem. but for some reasons it worked for me now.. maybe i did something wrong the years before. well nevermind :D
     
  4. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,151
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Even better.^^
     
  5. Timo

    Timo

    Joined:
    Jan 8, 2013
    Messages:
    321
    Resources:
    0
    Resources:
    0
    Well now i got into the bug i had a few years ago! IM creating balls behind a back of the unit(max. 8 balls) each few seconds. its one inititaltrigger which setts up the unit and integers and 1 loop. everything works fine in MUI.

    Now everytime im using a spell 4 balls should be used. so he have 4 balls. but that bugs in MUI. 4 balls for everyone is beeing used. and that was my problem.

    here i create the balls! If a unit enters the game i set him in the "BallSystem"

    [​IMG]

    Heres the loop.
    the if then else in the else-Action section doesnt matter to show. its just checking how much the integer is and creates balls on the back.
    And i dont reduce the index at the end becasue this System is permanent
    [​IMG]

    Now i use this in another spell.
    Im using a new Index becasue its a new spelll. but using the Indexing from the first ballsystem to reduce the amount of balls by 4.. But how does the game know which unit is using the spell and by which unit he should remove the 4 balls? in the code i have he reduces the balls of every unit.
    [​IMG]
    And thats the closed indexing.
    [​IMG]
     
  6. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,151
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    You should make a new thread in Triggers & Scipts. Could you then post triggers, and clarify the problem a bit more? For the problem, attaching a demo could help, too, I guess. At least from pics it seems a bit not clear, and not sure what info is missing.
     
  7. Timo

    Timo

    Joined:
    Jan 8, 2013
    Messages:
    321
    Resources:
    0
    Resources:
    0
  8. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    10,005
    Resources:
    1
    Maps:
    1
    Resources:
    1
    How do I remove a location that's using an array? I can't save the map and the code checker also gives an error for some reason. Tried both writing the variable name with and without the index name between square brackets.
     
  9. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,615
    Resources:
    27
    Packs:
    1
    Maps:
    8
    Spells:
    16
    Tutorials:
    2
    Resources:
    27
    Do you write udg_ for both index variable and location variable?
     
  10. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    10,005
    Resources:
    1
    Maps:
    1
    Resources:
    1
    No, only one udg like this: call RemoveLocation (udg_ShieldsTrainedUnitPoint[FloatingTextsLoopInteger])

    It doesn't work like this: call RemoveLocation (udg_ShieldsTrainedUnitPoint_udg_[FloatingTextsLoopInteger]) in case that's what you meant.

    call RemoveLocation (udg_ShieldsTrainedUnitPoint) by itself doesn't work either.

    EDIT: found something similar on another thread by accident. This is how I should have written it:
    call RemoveLocation (udg_ShieldsTrainedUnitPoint[udg_FloatingTextsLoopInteger])
     
    Last edited: Aug 9, 2019
  11. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,615
    Resources:
    27
    Packs:
    1
    Maps:
    8
    Spells:
    16
    Tutorials:
    2
    Resources:
    27
    Was referring to the last portion you wrote @deepstrasz

    Anyway, glad you solved it. Just for future reference, any variable you created in GUI starts with udg_
     
  12. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    10,005
    Resources:
    1
    Maps:
    1
    Resources:
    1
  13. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,151
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Which map/code is it exactly needed to be more GUI?
     
  14. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    10,005
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Well, I resorted to using a unit group and a loop at the end instead of a loop with exchanging variables as in the example.
     
  15. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    10,005
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I'm trying to figure out how would the last part

    • [​IMG]Siphon Life Loop
      • [​IMG][​IMG]Events
        • [​IMG][​IMG][​IMG]Time - Every 0.10 seconds of game time
      • [​IMG][​IMG]Conditions
      • [​IMG][​IMG]Actions
        • [​IMG][​IMG][​IMG]For each (SL_Loop_Integer) from 1 to SL_Index, do (Actions)
          • [​IMG][​IMG][​IMG][​IMG]Loop - Actions
            • [​IMG][​IMG][​IMG][​IMG][​IMG]Unit - Cause SL_Caster[SL_Loop_Integer] to damage SL_Target[SL_Loop_Integer], dealing 2 damage of attack type Spells and damage type Normal
            • [​IMG][​IMG][​IMG][​IMG][​IMG]Unit - Set life of SL_Caster[SL_Loop_Integer] to ((Life of SL_Caster[SL_Loop_Integer]) + 2.00)
            • [​IMG][​IMG][​IMG][​IMG][​IMG]Set SL_Counter[SL_Loop_Integer] = (SL_Counter[SL_Loop_Integer] + 0.10)
            • [​IMG][​IMG][​IMG][​IMG][​IMG]If (All Conditions are True) then do (Then Actions) else do (Else actions)
              • [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]If - Conditions
                • [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]SL_Counter[SL_Loop_Integer] Greater than or equal to 3.00
              • [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]Then - Actions
                • [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]Set SL_Caster[SL_Loop_Integer] = SL_Caster[SL_Index]
                • [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]Set SL_Target[SL_Loop_Integer] = SL_Target[SL_Index]
                • [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]Set SL_Counter[SL_Loop_Integer] = SL_Counter[SL_Index]
                • [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]Set SL_Index = (SL_Index - 1)
                • [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]Set SL_Loop_Integer = (SL_Loop_Integer - 1)
                • [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]If (All Conditions are True) then do (Then Actions) else do (Else actions)
                  • [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]If - Conditions
                    • [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]SL_Index Equal to 0
                  • [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]Then - Actions
                    • [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]Trigger - Turn off (This trigger)
                  • [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]Else - Actions
              • [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]Else - Actions

    work with the fourth/last hero or any dying in the process of life-mana stealing. How would I know which hero and how to exclude them from being overwritten/switched?

    EDIT:
    I think I solved it:

    • Shield Texts OFF
      • Events
        • Unit - A unit Dies
      • Conditions
      • Actions
        • For each (Integer FloatingTextsOFFLoopInteger) from 1 to ShieldsIndexInteger, do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • And - All (Conditions) are true
                  • Conditions
                    • (Dying unit) Equal to ShieldsTrainedUnit[FloatingTextsOFFLoopInteger]
                    • ((Dying unit) is in ShieldUnitsGroup) Equal to True
              • Then - Actions
                • Unit - Set Name of ShieldsTrainedUnit[FloatingTextsOFFLoopInteger] to UnitNameString[FloatingTextsOFFLoopInteger]
                • Unit Group - Remove ShieldsTrainedUnit[FloatingTextsOFFLoopInteger] from ShieldUnitsGroup
                • Game - Display to (All players) the text: (UnitsInGroup + (String((Number of units in ShieldUnitsGroup))))
                • Unit - Add a 60.00 second Generic expiration timer to ShieldsTrainedUnit[FloatingTextsOFFLoopInteger]
                • Set ShieldsTrainedUnit[FloatingTextsOFFLoopInteger] = ShieldsTrainedUnit[ShieldsIndexInteger]
                • Set ShieldsIndexInteger = (ShieldsIndexInteger - 1)
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • And - All (Conditions) are true
                      • Conditions
                        • (Number of units in ShieldUnitsGroup) Equal to 0
                  • Then - Actions
                    • Cinematic - Clear the screen of text messages for (All players)
                    • Set ShieldsIndexInteger = 0
                    • Set ShieldsArmourValue[FloatingTextsOFFLoopInteger] = 0
                    • Set ShieldsMaxValue[FloatingTextsOFFLoopInteger] = 0
                    • Game - Display to (All players) the text: (Index + (String(ShieldsIndexInteger)))
                    • Game - Display to (All players) the text: (UnitsInGroup + (String((Number of units in ShieldUnitsGroup))))
                    • Game - Display to (All players) the text: (ArmourValue + (String(ShieldsArmourValue[FloatingTextsOFFLoopInteger])))
                    • Game - Display to (All players) the text: (ArmourUpgrade + (String(ShieldsArmourUpgradeInteger)))
                    • Trigger - Turn off Shield Texts OFF <gen>
                    • Trigger - Turn off Shield Floating Texts Move <gen>
                    • Trigger - Turn off Shields Regenerate <gen>
                    • Trigger - Turn off Shield Units Damaged <gen>
                    • Trigger - Turn off Shield Boni Abilities <gen>
                    • Unit Group - Remove all units from ShieldUnitsGroup
                    • Custom script: call DestroyGroup (udg_ShieldUnitsGroup)
                  • Else - Actions

     
    Last edited: Aug 18, 2019 at 2:32 PM