• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

MUI help

Status
Not open for further replies.
Level 13
Joined
Mar 24, 2013
Messages
1,105
  • 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]

  • 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:
Level 13
Joined
Mar 24, 2013
Messages
1,105
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.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
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:
Level 13
Joined
Mar 24, 2013
Messages
1,105
  • 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
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
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...

  • 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
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
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.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
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?
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
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.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
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...
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
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.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
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
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
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
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
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.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
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

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?
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
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:
Level 13
Joined
Mar 24, 2013
Messages
1,105
  • 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 :(
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
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.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
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:
Level 13
Joined
Mar 24, 2013
Messages
1,105
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.

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.

  • 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
 

Attachments

  • Hook.w3x
    27 KB · Views: 45
Last edited:
Level 13
Joined
Mar 24, 2013
Messages
1,105
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!
 
Level 5
Joined
Aug 9, 2012
Messages
119
@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.

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
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
Bump...patience is a virtue :)

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

The Looping trigger posted below 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!

  • 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
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
Don't triple post pOke just have a patience ;). Anyway this can be done in hashtable without I'Arr and I see there that you doesn't use unit groups. You can check the spell sections about hooks and review them or make them as your template ;).
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
I thank you Daffa, while I've already attempted to use these as a spring board, I've gone back over them while the Phantom takes an "easy" way out with lightning and the Meat Hook GUI MUI removes them all in 1 fell swoop. The Psycho does more of what I'm trying to do, however my original method is the same one it employs and for whatever reason it works for them but not me... >.>

the
  • Set PHSegment[((i x 100) + PHSegmentMax[i])] = (Last created unit)
Meaning it saves the unit as the CurrentIndex * 100 + the Link Position, but the problem seems to be that when I decrease the index we lose the unit being pointed to because it goes from being 201 to 101.

P.S. Jake it's not triple posting when you wait 2+ days in between :)
 
Status
Not open for further replies.
Top