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. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Dismiss Notice
  5. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  6. 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.

MUI help

Discussion in 'Triggers & Scripts' started by pOke, Aug 21, 2013.

  1. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    • MUI help[/b]
    • Well I'm trying to make a hook...and it's going okay...but most of the time it glitches out...
    • So the problems that happen is mainly the links don't get retracted/removed.
    • Sometimes the link is removed "too fast" and the unit gets set to the center of playable map area. And sometimes a previously hooked unit who is on the other side of the map will suddenly be "snagged" again without even being close... So here's what I got...
    • I guess the summary is I need some advice on how to index each link of the hook.
    • [HIDDEN="Cast"][TRIGGER]Hook Cast
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to (==) Meat Hook
      • Actions
        • Set Hook_MaxIndex = (Hook_MaxIndex + 1)
        • Set Hook_Caster[Hook_MaxIndex] = (Triggering unit)
        • Set TempLoc = (Position of Hook_Caster[Hook_MaxIndex])
        • Set TempLoc2 = (Target point of ability being cast)
        • Set Hooked_Boolean[Hook_MaxIndex] = False
        • Set HookAngle[Hook_MaxIndex] = (Angle from TempLoc to TempLoc2)
        • Set Hook_Loop[Hook_MaxIndex] = 0
        • Set HookLength[Hook_MaxIndex] = ((Level of Meat Hook for Hook_Caster[Hook_MaxIndex]) x 9)
        • Set MeatHook_Dmg[Hook_MaxIndex] = ((Real((Level of Meat Hook for Hook_Caster[Hook_MaxIndex]))) x 90.00)
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Hook_MaxIndex Equal to (==) 1
            • Then - Actions
              • Trigger - Turn on Hook Loop <gen>
            • Else - Actions
        • Custom script: call RemoveLocation(udg_TempLoc)
        • Custom script: call RemoveLocation(udg_TempLoc2)
    [/HIDDEN]

    Loop
    • Hook Loop
      • Events
        • Time - Every 0.03 seconds of game time
      • Conditions
      • Actions
        • Do Multiple ActionsFor each (Integer Hook_CurrentIndex) from 1 to Hook_MaxIndex, do (Actions)
          • Loop - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Hooked_Boolean[Hook_CurrentIndex] Equal to (==) False
              • Then - Actions
                • Set Hook_Loop[Hook_CurrentIndex] = (Hook_Loop[Hook_CurrentIndex] + 1)
                • Set TempLoc = (Position of Hook_Caster[Hook_CurrentIndex])
                • Set TempLoc2 = (TempLoc offset by (50.00 x (Real(Hook_Loop[Hook_CurrentIndex]))) towards HookAngle[Hook_CurrentIndex] degrees)
                • Unit - Create 1 Hook for (Owner of Hook_Caster[Hook_CurrentIndex]) at TempLoc2 facing HookAngle[Hook_CurrentIndex] degrees
                • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
                • Set HookChain[Hook_Loop[Hook_CurrentIndex]] = (Last created unit) -- This line needs a fix.
                • Set TempGroup = (Units within 100.00 of TempLoc2 matching ((((Matching unit) is alive) Equal to (==) True) and ((((Matching unit) is A structure) Equal to (==) False) and ((((Matching unit) is Mechanical) Not equal to (!=) True) and ((Matching unit) Not equal to (!=) Hook_Ca
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (TempGroup is empty) Equal to (==) False
                    • Then - Actions
                      • Set Hooked_Boolean[Hook_CurrentIndex] = True
                      • Set MeatHookTarget[Hook_CurrentIndex] = (Random unit from TempGroup)
                      • Custom script: call SetUnitPropWindow(udg_MeatHookTarget[udg_Hook_CurrentIndex], 0)
                        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • (MeatHookTarget[Hook_CurrentIndex] belongs to an enemy of (Owner of Hook_Caster[Hook_CurrentIndex])) Equal to (==) True
                          • Then - Actions
                            • Unit - Create 1 Dummy for (Owner of Hook_Caster[Hook_CurrentIndex]) at TempLoc2 facing Default building facing (270.0) degrees
                            • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
                            • Unit - Cause (Last created unit) to damage MeatHookTarget[Hook_CurrentIndex], dealing MeatHook_Dmg[Hook_CurrentIndex] damage of attack type Chaos and damage type Universal
                            • Special Effect - Create a special effect attached to the origin of MeatHookTarget[Hook_CurrentIndex] using Objects\Spawnmodels\Human\HumanBlood\BloodElfSpellThiefBlood.mdl
                            • Special Effect - Destroy (Last created special effect)
                          • Else - Actions
                    • Else - Actions
                • Custom script: call DestroyGroup(udg_TempGroup)
                • Custom script: call RemoveLocation(udg_TempLoc)
                • Custom script: call RemoveLocation(udg_TempLoc2)
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Hook_Loop[Hook_CurrentIndex] Greater than or equal to (>=) HookLength[Hook_CurrentIndex]
                    • Then - Actions
                      • Set Hooked_Boolean[Hook_CurrentIndex] = True
                    • Else - Actions
              • Else - Actions
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • MeatHookTarget[Hook_CurrentIndex] Not equal to (!=) No unit
                  • Then - Actions
                    • Custom script: call SetUnitX(udg_MeatHookTarget[udg_Hook_CurrentIndex], GetUnitX(udg_HookChain[udg_Hook_Loop[udg_Hook_CurrentIndex]]))
                    • Custom script: call SetUnitY(udg_MeatHookTarget[udg_Hook_CurrentIndex], GetUnitY(udg_HookChain[udg_Hook_Loop[udg_Hook_CurrentIndex]]))
                  • Else - Actions
                • Unit - Remove HookChain[Hook_Loop[Hook_CurrentIndex]] from the game
                • Set Hook_Loop[Hook_CurrentIndex] = (Hook_Loop[Hook_CurrentIndex] - 1)
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Hook_Loop[Hook_CurrentIndex] Less than or equal to (<=) 0
                    • Then - Actions
                      • Custom script: call SetUnitPropWindow(udg_MeatHookTarget[udg_Hook_CurrentIndex], 1)
                      • Set Hooked_Boolean[Hook_CurrentIndex] = False
                      • Set MeatHookTarget[Hook_CurrentIndex] = MeatHookTarget[Hook_MaxIndex]
                      • Set Hook_Caster[Hook_CurrentIndex] = Hook_Caster[Hook_MaxIndex]
                      • Set Hook_CurrentIndex = (Hook_CurrentIndex - 1)
                      • Set Hook_MaxIndex = (Hook_MaxIndex - 1)
                    • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Hook_MaxIndex Equal to (==) 0
          • Then - Actions
            • Trigger - Turn off (This trigger)
          • Else - Actions


    EDIT: Look back page. Here's a gist--

    The Looping trigger posted above is unable to properly deal with multiple instances of the spell.

    Specially the way in which


    Hashtable - Save Handle Of(Last created unit) as Hook_CurrentIndex of Hook_Loop[Hook_CurrentIndex] in Hook_Hashtable


    this is saved is incorrect.

    Currently, one instance will fire and complete properly, if another one is fired while the 1st one is active and this second instance will finish after the first one has finished, a problem occurs where it loses track of the proper dummy units it points to.

    Thanks!
     
    Last edited: Sep 17, 2013
  2. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,528
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    Don't use a Boolean to check simply use the Counter in the top.
    Your problem is the hook loop integer. It starts at 0 then in your loop trigger you reduce it then check if it is equal to 0. That condition will always be true. So it will always de-index.
     
  3. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I need to use a Boolean to easily decide when to retract or not.

    I'm not exactly grasping why it would start at 0. When the ability starts it creates a dummy in front of the caster, and the Loop is incremented by 1 to denote this creation, once the max dummy count (i.e. HookLength) or it has connected with a unit it will set the Boolean true, and start to find the dummies who are assigned to the loop number and remove them till there are none left, all the while moving the hooked unit to the previous dummy position until it has arrived at the 1st dummy. So lets say there was a unit 10 "hook links" away, the Loop counts up to 10 and once it grabs the unit it starts counting down again till 0.

    Sorry if this added no value, I'm just not entirely sure how it could start at 0, because it does seem to work for 1 person w/ an enforced cool down the problem is when its 0 cooldown/multiple units casting at once.
     
  4. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,181
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    You could use a single array for the links. Indexes from 0 to maxLinks-1 would be reserved for instance 1, indexes from maxLinks to maxLinks*2-1 to instance 2 and so on.
     
  5. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Hm, could you maybe elaborate a little more, I'm not sure I'm following, where I would have the maxLinks set, incremented and so on.

    Edit: Keeping with what you said in mind I tried something...however it doesn't work (ofc :p) but it goes along with what you're saying I think...what exactly am I not getting?

    • Set HookChain[((Hook_CurrentIndex x 100) + Hook_Loop[Hook_CurrentIndex])] = (Last created unit)


    • Unit - Remove HookChain[((Hook_CurrentIndex x 100) + Hook_Loop[Hook_CurrentIndex])] from the game


    We are trying to save the created units in a way in which we can easily reference them later, but I guess I'm just not doing it properly?
     
    Last edited: Aug 22, 2013
  6. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    *bump* :grin:
     
  7. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,181
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    It looks like it is correctly done. Post the updated trigger.
     
  8. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    • Hook Loop
      • Events
        • Time - Every 0.03 seconds of game time
      • Conditions
      • Actions
        • Do Multiple ActionsFor each (Integer Hook_CurrentIndex) from 1 to Hook_MaxIndex, do (Actions)
          • Loop - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Hooked_Boolean[Hook_CurrentIndex] Equal to (==) False
              • Then - Actions
                • Set Hook_Loop[Hook_CurrentIndex] = (Hook_Loop[Hook_CurrentIndex] + 1)
                • Set TempLoc = (Position of Hook_Caster[Hook_CurrentIndex])
                • Set TempLoc2 = (TempLoc offset by (50.00 x (Real(Hook_Loop[Hook_CurrentIndex]))) towards HookAngle[Hook_CurrentIndex] degrees)
                • Unit - Create 1 Hook for (Owner of Hook_Caster[Hook_CurrentIndex]) at TempLoc2 facing HookAngle[Hook_CurrentIndex] degrees
                • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
                • Set HookChain[((Hook_CurrentIndex x 100) + Hook_Loop[Hook_CurrentIndex])] = (Last created unit)
                • Set TempGroup = (Units within 100.00 of TempLoc2 matching ((((Matching unit) is alive) Equal to (==) True) and ((((Matching unit) is A structure) Equal to (==) False) and ((((Matching unit) is Mechanical) Not equal to (!=) True) and ((Matching unit) Not equal to (!=) Hook_Ca
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (TempGroup is empty) Equal to (==) False
                    • Then - Actions
                      • Set Hooked_Boolean[Hook_CurrentIndex] = True
                      • Set MeatHookTarget[Hook_CurrentIndex] = (Random unit from TempGroup)
                      • Custom script: call SetUnitPropWindow(udg_MeatHookTarget[udg_Hook_CurrentIndex], 0)
                        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • (MeatHookTarget[Hook_CurrentIndex] belongs to an enemy of (Owner of Hook_Caster[Hook_CurrentIndex])) Equal to (==) True
                          • Then - Actions
                            • Unit - Create 1 Dummy (rock) for (Owner of Hook_Caster[Hook_CurrentIndex]) at TempLoc2 facing Default building facing (270.0) degrees
                            • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
                            • Unit - Cause (Last created unit) to damage MeatHookTarget[Hook_CurrentIndex], dealing MeatHook_Dmg[Hook_CurrentIndex] damage of attack type Chaos and damage type Universal
                            • Special Effect - Create a special effect attached to the origin of MeatHookTarget[Hook_CurrentIndex] using Objects\Spawnmodels\Human\HumanBlood\BloodElfSpellThiefBlood.mdl
                            • Special Effect - Destroy (Last created special effect)
                          • Else - Actions
                    • Else - Actions
                • Custom script: call DestroyGroup(udg_TempGroup)
                • Custom script: call RemoveLocation(udg_TempLoc)
                • Custom script: call RemoveLocation(udg_TempLoc2)
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Hook_Loop[Hook_CurrentIndex] Greater than or equal to (>=) HookLength[Hook_CurrentIndex]
                    • Then - Actions
                      • Set Hooked_Boolean[Hook_CurrentIndex] = True
                    • Else - Actions
              • Else - Actions
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • MeatHookTarget[Hook_CurrentIndex] Not equal to (!=) No unit
                  • Then - Actions
                    • Custom script: call SetUnitX(udg_MeatHookTarget[udg_Hook_CurrentIndex], GetUnitX(udg_HookChain[udg_Hook_Loop[udg_Hook_CurrentIndex]]))
                    • Custom script: call SetUnitY(udg_MeatHookTarget[udg_Hook_CurrentIndex], GetUnitY(udg_HookChain[udg_Hook_Loop[udg_Hook_CurrentIndex]]))
                  • Else - Actions
                • Unit - Remove HookChain[((Hook_CurrentIndex x 100) + Hook_Loop[Hook_CurrentIndex])] from the game
                • Set Hook_Loop[Hook_CurrentIndex] = (Hook_Loop[Hook_CurrentIndex] - 1)
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Hook_Loop[Hook_CurrentIndex] Less than or equal to (<=) 0
                    • Then - Actions
                      • Custom script: call SetUnitPropWindow(udg_MeatHookTarget[udg_Hook_CurrentIndex], 1)
                      • Set Hooked_Boolean[Hook_CurrentIndex] = False
                      • Set MeatHookTarget[Hook_CurrentIndex] = MeatHookTarget[Hook_MaxIndex]
                      • Set Hook_Caster[Hook_CurrentIndex] = Hook_Caster[Hook_MaxIndex]
                      • Set Hook_CurrentIndex = (Hook_CurrentIndex - 1)
                      • Set Hook_MaxIndex = (Hook_MaxIndex - 1)
                    • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Hook_MaxIndex Equal to (==) 0
          • Then - Actions
            • Trigger - Turn off (This trigger)
          • Else - Actions


    Here is the updated Loop
     
  9. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    mobile bump :grin:
     
  10. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,181
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    You should use debug messages to see where you go wrong.
     
  11. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Debug msgs didn't really shed any light to me :(.

    Well... I think it "works", but if you cast it before the current "duration" ends, it makes the new links, but then it recreates the 1st hook and then removes the 1st hook and leaves the 2nd hook.

    Also when I deindex, I first set it to No Unit because when I didn't, if a unit ever got hooked, it would bring the unit to the end of the hook then proceed back to the caster. The unit all the while would have been on the other side of the map unreachable...

    Updated again
    • Hook Loop
      • Events
        • Time - Every 0.03 seconds of game time
      • Conditions
      • Actions
        • Do Multiple ActionsFor each (Integer Hook_CurrentIndex) from 1 to Hook_MaxIndex, do (Actions)
          • Loop - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Hooked_Boolean[Hook_CurrentIndex] Equal to (==) False
              • Then - Actions
                • Set Hook_Loop[Hook_CurrentIndex] = (Hook_Loop[Hook_CurrentIndex] + 1)
                • Set TempLoc = (Position of Hook_Caster[Hook_CurrentIndex])
                • Set TempLoc2 = (TempLoc offset by (50.00 x (Real(Hook_Loop[Hook_CurrentIndex]))) towards HookAngle[Hook_CurrentIndex] degrees)
                • Unit - Create 1 Hook for (Owner of Hook_Caster[Hook_CurrentIndex]) at TempLoc2 facing HookAngle[Hook_CurrentIndex] degrees
                • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
                • Set HookChain[((Hook_CurrentIndex x 100) + Hook_Loop[Hook_CurrentIndex])] = (Last created unit)
                • Game - Display to (All players) the text: Create Link
                • Set TempGroup = (Units within 100.00 of TempLoc2 matching ((((Matching unit) is alive) Equal to (==) True) and ((((Matching unit) is A structure) Equal to (==) False) and ((((Matching unit) is Mechanical) Not equal to (!=) True) and ((Matching unit) Not equal to (!=) Hook_Ca
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (TempGroup is empty) Equal to (==) False
                    • Then - Actions
                      • Game - Display to (All players) the text: Hooked
                      • Set Hooked_Boolean[Hook_CurrentIndex] = True
                      • Set MeatHookTarget[Hook_CurrentIndex] = (Random unit from TempGroup)
                      • Custom script: call SetUnitPropWindow(udg_MeatHookTarget[udg_Hook_CurrentIndex], 0)
                        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • (MeatHookTarget[Hook_CurrentIndex] belongs to an enemy of (Owner of Hook_Caster[Hook_CurrentIndex])) Equal to (==) True
                          • Then - Actions
                            • Game - Display to (All players) the text: Hooked Enemy!
                            • Unit - Create 1 Hook for (Owner of Hook_Caster[Hook_CurrentIndex]) at TempLoc2 facing Default building facing (270.0) degrees
                            • Unit - Add a 0.05 second Generic expiration timer to (Last created unit)
                            • Unit - Cause (Last created unit) to damage MeatHookTarget[Hook_CurrentIndex], dealing MeatHook_Dmg[Hook_CurrentIndex] damage of attack type Chaos and damage type Universal
                            • Special Effect - Create a special effect attached to the origin of MeatHookTarget[Hook_CurrentIndex] using Objects\Spawnmodels\Human\HumanBlood\BloodElfSpellThiefBlood.mdl
                            • Special Effect - Destroy (Last created special effect)
                          • Else - Actions
                    • Else - Actions
                • Custom script: call DestroyGroup(udg_TempGroup)
                • Custom script: call RemoveLocation(udg_TempLoc)
                • Custom script: call RemoveLocation(udg_TempLoc2)
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Hook_Loop[Hook_CurrentIndex] Greater than or equal to (>=) HookLength[Hook_CurrentIndex]
                    • Then - Actions
                      • Game - Display to (All players) the text: Max Length
                      • Set Hooked_Boolean[Hook_CurrentIndex] = True
                    • Else - Actions
              • Else - Actions
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • MeatHookTarget[Hook_CurrentIndex] Not equal to (!=) No unit
                  • Then - Actions
                    • Custom script: call SetUnitX(udg_MeatHookTarget[udg_Hook_CurrentIndex], GetUnitX(udg_HookChain[((udg_Hook_CurrentIndex * 100) + udg_Hook_Loop[udg_Hook_CurrentIndex])]))
                    • Custom script: call SetUnitY(udg_MeatHookTarget[udg_Hook_CurrentIndex], GetUnitY(udg_HookChain[((udg_Hook_CurrentIndex * 100) + udg_Hook_Loop[udg_Hook_CurrentIndex])]))
                    • Game - Display to (All players) the text: Move Unit!
                  • Else - Actions
                • Unit - Remove HookChain[((Hook_CurrentIndex x 100) + Hook_Loop[Hook_CurrentIndex])] from the game
                • Game - Display to (All players) the text: Remove Unit
                • Set Hook_Loop[Hook_CurrentIndex] = (Hook_Loop[Hook_CurrentIndex] - 1)
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Hook_Loop[Hook_CurrentIndex] Less than or equal to (<=) 0
                    • Then - Actions
                      • Game - Display to (All players) the text: Deindexed
                      • Custom script: call SetUnitPropWindow(udg_MeatHookTarget[udg_Hook_CurrentIndex], 1)
                      • Set MeatHookTarget[Hook_CurrentIndex] = No unit
                      • Set MeatHookTarget[Hook_CurrentIndex] = MeatHookTarget[Hook_MaxIndex]
                      • Set Hooked_Boolean[Hook_CurrentIndex] = False
                      • Set MeatHookTarget[Hook_CurrentIndex] = MeatHookTarget[Hook_MaxIndex]
                      • Set Hook_Caster[Hook_CurrentIndex] = Hook_Caster[Hook_MaxIndex]
                      • Set Hook_CurrentIndex = (Hook_CurrentIndex - 1)
                      • Set Hook_MaxIndex = (Hook_MaxIndex - 1)
                    • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Hook_MaxIndex Equal to (==) 0
          • Then - Actions
            • Trigger - Turn off (This trigger)
          • Else - Actions
     
  12. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,528
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    i told u this above. The problem is in your de-indexing.
    You never de-index this variable.
    Set Hook_Loop[ ]

    also change this.
    • Set MeatHookTarget[Hook_CurrentIndex] = No unit
    • Set MeatHookTarget[Hook_CurrentIndex] = MeatHookTarget[Hook_MaxIndex]
    • Set Hooked_Boolean[Hook_CurrentIndex] = False
    • Set MeatHookTarget[Hook_CurrentIndex] = MeatHookTarget[Hook_MaxIndex]
    • Set Hook_Caster[Hook_CurrentIndex] = Hook_Caster[Hook_MaxIndex]

    to this.
    • Set MeatHookTarget[Hook_CurrentIndex] = MeatHookTarget[Hook_MaxIndex]
    • Set MeatHookTarget[Hook_MaxIndex] = No unit
    • Set Hooked_Boolean[Hook_CurrentIndex] = Hooked_Boolean[Hook_MaxIndex]
    • Set Hooked_Boolean[Hook_CurrentIndex] = False
    • Set Hook_Caster[Hook_CurrentIndex] = Hook_Caster[Hook_MaxIndex]
    • Set Hook_Caster[Hook_MaxIndex] = No unit


    As a note u have to de-index everything you use.
     
  13. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Hm, alright I did as you suggested, the problem is---

    Unit A casts it he is instance 1, it makes the links, assigning them to the unit array by CurrentIndex, when it starts to retract

    Unit B casts, they become instance 2, while Unit B's is still extending, Unit A's finishes, the CurrentIndex changes to 1, meaning the previously assigned links in the unit array under instance 2 are lost.

    Because
    • Set HookChain[((Hook_CurrentIndex x 100) + Hook_Loop[Hook_CurrentIndex])] = (Last created unit)

    makes reference to the CurrentIndex which is "always" changing, how should I save the units in the unit array to avoid this "collision" in a sense.

    Edit: Is this what Maker was talking about with that Linked list thing?
     
  14. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,528
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    The way indexed arrays are you will never lose an instance. Indexed array move the last index to the expiring index.

    Explain exactly what this is supposed to do. Also explain why you create the unit and store it ? How is it getting overwritten ? Do you de-index the dummy unit that you create ?
     
  15. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Sorry for the novel! Between the stars is the good stuff

    Okay so the exact purpose of this trigger is to allow the caster to create a "pull", the caster will target a point and creates numerous dummies toward the target point offset by a little until the maximum number of dummies is created. At any point during the creation of these dummies, if a unit is within 100 AoE of the dummy it will be "hooked" this will cause the creation of dummies to stop and start the retraction process where the unit will move to the position of the dummies all the way back to the position of the first dummy.

    I am creating a unit and storing it so I am able to reference which dummy in the "chain" of the pull to move the unit to.

    *****************************************************
    (THIS MIGHT BE WRONG, BUT ITS WHAT I BELIEVE IS HAPPENING)
    It's not getting overwritten per say its, just changing the referenced unit unintentionally. I will try to explain again what I said earlier, for simplicities sake each hook has 10 "links" and extends all the way without hitting a target.

    CI == CurrentIndex
    The first Unit casts the spell, it creates Link 1 and saves it as HookChain[(CI)1*100) + NumberOfLinksMade[(CI)1]

    The 2nd link is created and saved as HookChain[(CI) 1*100) + NumberOfLinksMade[(CI)1]

    In terms of HookChain, the 1st dummy's number is 101, and the 2nd dummy's number is 102.

    This will continue all the way to 10.

    The second unit casts the spell after 3 links have been created for the first unit.

    Meaning it creates Link 1 and saves it as HookChain[(CI)2*100) + NumberOfLinksMade[(CI)2]

    So in terms of HookChain, this 1st dummy's number is 201. So on..

    This happens all the way to 10 just as before except, this time when its retracting the first units "hook" ends, meaning the MaxIndex is decreased by 1 making the CurrentIndex equal to 1.


    The second unit's hook at this point will have retracted until to gets to the last 3 links, it is attempting to remove
    • Unit - Remove HookChain[((Hook_CurrentIndex x 100) + Hook_Loop[Hook_CurrentIndex])] from the game
    the problem is, the CurrentIndex has changed, and now it tries to remove the HookChain at 103 - 101 but that is pointing to an already remove unit/null object.

    ************************************************************
    I do not de-index the units because....well I have no reason other than I don't think I need too, but I'm sure you'll say otherwise I just don't know where I could de-index them.
     
  16. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,528
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    Make multiple units for the links rather than using the same array. It is bugging because the index is changing but its not keeping everything aligned correctly.
     
  17. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I'm sorry to need a spoon feeding, but I don't understand what you mean...
     
  18. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,528
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    You use one unit array for the links ( dummy units)
    Use separate unit arrays for each of the links.
    so unitArrayLink1 = link 1
    unitArrayLink2 = link 2
    and so on
     
  19. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    How would I go about setting that to the proper index? And how many variables would I have to make?
     
  20. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,528
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    If you only want 3 links make 3 unit arrays.
    If you have a lot of links this is a bad idea.

    and you index and de-index like normal. It is just an extra variable.