- 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
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Custom script: call RemoveLocation(udg_TempLoc)
- Custom script: call RemoveLocation(udg_TempLoc2)
-
Events
-
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
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (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
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (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
-
If - Conditions
- 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
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - 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
-
If - Conditions
-
Do Multiple ActionsFor each (Integer Hook_CurrentIndex) from 1 to Hook_MaxIndex, do (Actions)
-
Events
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: