1. Head to the 33rd Modeling Contest Poll and drink to your heart's desire.
    Dismiss Notice
  2. Choose your means of doom in the 17th Mini Mapping Contest Poll.
    Dismiss Notice
  3. A slave to two rhythms, the 22nd Terraining Contest is here.
    Dismiss Notice
  4. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  5. The die is cast - the 6th Melee Mapping Contest results have been announced. Onward to the Hive Cup!
    Dismiss Notice
  6. The glory of the 20th Icon Contest is yours for the taking!
    Dismiss Notice
  7. 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
    Alright, any other ideas ? lol This is not going to work because at any given time one person may have one that is 10 links and another one with 15. The range of values with likely will vary between 10 and 30, so I don't know...
     
  2. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,526
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    ooo ok. Best way is the way you have it then. Only thing to do to try to fix it is display the variables for the links to see what index they are indexed to. That way you can see were they overlap.
     
  3. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I "know" where they overlap, I'm having a hard time putting it any clearer than I had before.

    The indexing "works" if we don't de-index. I disabled most of the de-indexing and this allowed for all the hooks to extend and retract properly. I'm sure that this quickly will add up and cause some terrible lag. Eventually those would have to be de-indexed, but I can't see how you could tell when "all" instances are over as to not foul the current instance up.

    If we try to de-index any instance while another instance is firing, it will lose the reference to the proper dummy unit, because they are saved under there original Index, so if they start out at index 2, but by the end the Current Index is chopped down to 1, it no longer "knows" which unit the variable refers too.
     
  4. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,526
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    use a hashtable.
     
  5. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I knew this day would come...Now I get to completely remake it :/...And I just clicked one of those Hashtable functions that crash, geez. lol.

    Edit: I'll just rep you now so I can do it again by the time I finish :p
     
  6. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,526
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
  7. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I'm sure this is not what you want...a conglomerate mess with indexed arrays and a pitiful attempt at a hashtable but you know :p

    I didn't add much other than a minor reference to a hashtable, It still is unable to handle multiple instances. Although now, I'm feeling a little confused because I thought the problem before was from the math that was taking place with the CurrentIndex but that isn't happening anymore and I'm having the same problem... Also I don't put it in here---but Do I flush the child when I deindex and do I ever flush the parent?

    • 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)
                • Hashtable - Save Handle Of(Last created unit) as 1 of Hook_Loop[Hook_CurrentIndex] in Hook_Hashtable
                • 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
                    • Set TempUnit = (Load 1 of Hook_Loop[Hook_CurrentIndex] in Hook_Hashtable)
                    • Custom script: call SetUnitX(udg_MeatHookTarget[udg_Hook_CurrentIndex], GetUnitX(udg_TempUnit))
                    • Custom script: call SetUnitY(udg_MeatHookTarget[udg_Hook_CurrentIndex], GetUnitY(udg_TempUnit))
                    • Game - Display to (All players) the text: Move Unit!
                  • Else - Actions
                • Set TempUnit = (Load 1 of Hook_Loop[Hook_CurrentIndex] in Hook_Hashtable)
                • Unit - Remove TempUnit 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 Hook_Loop[Hook_CurrentIndex] = Hook_Loop[Hook_MaxIndex]
                      • Set MeatHookTarget[Hook_CurrentIndex] = MeatHookTarget[Hook_MaxIndex]
                      • Set MeatHookTarget[Hook_CurrentIndex] = 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_CurrentIndex] = No unit
                      • 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
     
  8. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    bump
     
  9. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    bump
     
  10. chobibo

    chobibo

    Joined:
    Sep 24, 2005
    Messages:
    2,707
    Resources:
    0
    Resources:
    0
    Is this like the meat hook spell form DotA? If so you could use a linked list to store the hook links (a 2d-array is also possible). I think it is possible to setup a linked list in gui, I haven't tried though, I suck at GUI.
     
  11. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Yeah, its a Pudge Hook from Dota, I'm trying to do a 2D array with the harshtable but I'm still not comfortable so I not sure why its not working.

    As I said above

     
  12. chobibo

    chobibo

    Joined:
    Sep 24, 2005
    Messages:
    2,707
    Resources:
    0
    Resources:
    0
    Flush the child key after your done with the data stored on the table and you no longer need to save it.

    You could save your meat hook links like this:

    SaveUnitHandle(table,<indexer_id>,<link_position>,link)
     

    Oh I forgot, GUI only lol!

    the parentKey should store the caster index, and the childKey, the link position.

    link_position is the order of creation of the link:

    linkA->linkB->linkC = 0,1,2
     
    Last edited: Sep 4, 2013
  13. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    • Hashtable - Save Handle Of(Last created unit) as Hook_CurrentIndex of Hook_Loop[Hook_CurrentIndex] in Hook_Hashtable


    Index of the Unit, Loop number @ the Index of the Unit in the Hash...still doesn't work for more than 1 :(
     
  14. chobibo

    chobibo

    Joined:
    Sep 24, 2005
    Messages:
    2,707
    Resources:
    0
    Resources:
    0
    Try this format, but I think it won't help:
    • Hashtable - Save Handle Of <unit> as <childKey> of <parentKey> in <Table>


    It would be great if you could attach your test map.
     
  15. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I'm not too keen on the whole Child Vs Parent difference but I made a test map.

    I feel like the file size is big, but theres nothing on it...

    ANYWAY: here it is :grin:
     

    Attached Files:

  16. chobibo

    chobibo

    Joined:
    Sep 24, 2005
    Messages:
    2,707
    Resources:
    0
    Resources:
    0
    I've tested the map, I also skimmed on the triggers and my preliminary impression is that the indexing for the spell instance is to blame. I'm going to look into it some more since my evaluation is inconclusive.

    EDIT: I've tested the map, I think there is a problem with the variable Hook_CurrentIndex, it is not declared as an integer, that may be causing the problem.

    I'm sorry I can't be of any more help, I suck at GUI. I could help you more if it was jass.
     
    Last edited: Sep 5, 2013
  17. mikagami

    mikagami

    Joined:
    Aug 9, 2012
    Messages:
    112
    Resources:
    0
    Resources:
    0
    is this spell complete? anyway theres so much hook spell type in hiveworkshop, anyone can suggest which is the best to perform in MUI and less lag?
    thx
     
  18. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Nah the declaration of the variable is not the problem, I don't know how it got changed when I copied it from my other map, but anyway. You're right its the instance to blame which we've known for a while just not how to fix. I appreciate your effort though! Just incase anyone doesn't believe here is another test map with the integer fixed.


    @mikagami
    I don't even know what to reply to you...right now this works for 1 person and if the cooldown is long enough that 2 instances are not going at the same time.

    Trig
    • 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)
                • Hashtable - Save Handle Of(Last created unit) as Hook_CurrentIndex of Hook_Loop[Hook_CurrentIndex] in Hook_Hashtable
                • 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
                    • Set TempUnit = (Load Hook_CurrentIndex of Hook_Loop[Hook_CurrentIndex] in Hook_Hashtable)
                    • Custom script: call SetUnitX(udg_MeatHookTarget[udg_Hook_CurrentIndex], GetUnitX(udg_TempUnit))
                    • Custom script: call SetUnitY(udg_MeatHookTarget[udg_Hook_CurrentIndex], GetUnitY(udg_TempUnit))
                    • Game - Display to (All players) the text: Move Unit!
                  • Else - Actions
                • Set TempUnit = (Load Hook_CurrentIndex of Hook_Loop[Hook_CurrentIndex] in Hook_Hashtable)
                • Unit - Remove TempUnit 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
                      • Hashtable - Clear all child hashtables of child Hook_Loop[Hook_CurrentIndex] in Hook_Hashtable
                      • Custom script: call SetUnitPropWindow(udg_MeatHookTarget[udg_Hook_CurrentIndex], 1)
                      • Set Hook_Loop[Hook_CurrentIndex] = Hook_Loop[Hook_MaxIndex]
                      • Set MeatHookTarget[Hook_CurrentIndex] = MeatHookTarget[Hook_MaxIndex]
                      • Set MeatHookTarget[Hook_CurrentIndex] = 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_CurrentIndex] = No unit
                      • 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
     

    Attached Files:

    Last edited: Sep 19, 2013
  19. pOke

    pOke

    Joined:
    Mar 24, 2013
    Messages:
    1,103
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Bump :/

    To catch anyone up who is looking at this for the first time;

    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!
     
  20. mikagami

    mikagami

    Joined:
    Aug 9, 2012
    Messages:
    112
    Resources:
    0
    Resources:
    0
    ooh okay", anyway im jst asking, if any of people try meat hook map, because theres so many people make this kind of spell.
    and dont make it bother u thou