- Joined
- Feb 15, 2008
- Messages
- 2,174
Also i dont get the spell to work. what have i missed when importing the spell?
Where do i change the speed of the hook. Also how big distance of the chain.
Also if i gona add so you cant hook through buildings or doodas/trees.
Where do i change this and how do i do?
And do this hook catch units on the way back?
-
Unit Indexer
-

Events
-


Map initialization
-
-

Conditions
-

Actions
-


Custom script: call ExecuteFunc("InitializeUnitIndexer")
-


Custom script: endfunction
-


-------- --------
-


-------- This is the most important function - it provides an index for units as they enter the map --------
-


-------- --------
-


Custom script: function IndexUnit takes nothing returns boolean
-


Custom script: local integer pdex = udg_UDex
-


-------- --------
-


-------- You can use the boolean UnitIndexerEnabled to protect some of your undesirable units from being indexed --------
-


-------- - Example: --------
-


-------- -- Set UnitIndexerEnabled = False --------
-


-------- -- Unit - Create 1 Dummy for (Triggering player) at TempLoc facing 0.00 degrees --------
-


-------- -- Set UnitIndexerEnabled = True --------
-


-------- --------
-


-------- You can also customize the following block - if conditions are false the (Matching unit) won't be indexed. --------
-


-------- --------
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




UnitIndexerEnabled Equal to True
-
-



Then - Actions
-




-------- --------
-




-------- Generate a unique integer index for this unit --------
-




-------- --------
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






UDexRecycle Equal to 0
-
-





Then - Actions
-






Set UDex = (UDexGen + 1)
-






Set UDexGen = UDex
-
-





Else - Actions
-






Set UDex = UDexRecycle
-






Set UDexRecycle = UDexNext[UDex]
-
-
-




-------- --------
-




-------- Link index to unit, unit to index --------
-




-------- --------
-




Set UDexUnits[UDex] = (Matching unit)
-




Unit - Set the custom value of UDexUnits[UDex] to UDex
-




-------- --------
-




-------- Use a doubly-linked list to store all active indexes --------
-




-------- --------
-




Set UDexPrev[UDexNext[0]] = UDex
-




Set UDexNext[UDex] = UDexNext[0]
-




Set UDexNext[0] = UDex
-




-------- --------
-




-------- Fire index event for UDex --------
-




-------- --------
-




Set UnitIndexEvent = 0.00
-




Set UnitIndexEvent = 1.00
-




Set UnitIndexEvent = 0.00
-




Custom script: set udg_UDex = pdex
-
-



Else - Actions
-
-


Custom script: return false
-


Custom script: endfunction
-


-------- --------
-


-------- The next function is called each time a unit enters the map --------
-


-------- --------
-


Custom script: function IndexNewUnit takes nothing returns boolean
-


Custom script: local integer pdex = udg_UDex
-


Custom script: local integer ndex
-


-------- --------
-


-------- Recycle indices of units no longer in-play every (15) units created --------
-


-------- --------
-


Set UDexWasted = (UDexWasted + 1)
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




UDexWasted Equal to 15
-
-



Then - Actions
-




Set UDexWasted = 0
-




Set UDex = UDexNext[0]
-




Custom script: loop
-




Custom script: exitwhen udg_UDex == 0
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






(Custom value of UDexUnits[UDex]) Equal to 0
-
-





Then - Actions
-






-------- --------
-






-------- Remove index from linked list --------
-






-------- --------
-






Custom script: set ndex = udg_UDexNext[udg_UDex]
-






Custom script: set udg_UDexNext[udg_UDexPrev[udg_UDex]] = ndex
-






Custom script: set udg_UDexPrev[ndex] = udg_UDexPrev[udg_UDex]
-






Set UDexPrev[UDex] = 0
-






-------- --------
-






-------- Fire deindex event for UDex --------
-






-------- --------
-






Set UnitIndexEvent = 2.00
-






Set UnitIndexEvent = 0.00
-






-------- --------
-






-------- Recycle the index for later use --------
-






-------- --------
-






Set UDexUnits[UDex] = No unit
-






Set UDexNext[UDex] = UDexRecycle
-






Set UDexRecycle = UDex
-






Custom script: set udg_UDex = ndex
-
-





Else - Actions
-






Set UDex = UDexNext[UDex]
-
-
-




Custom script: endloop
-




Custom script: set udg_UDex = pdex
-
-



Else - Actions
-
-


-------- --------
-


-------- Handle the entering unit (Matching unit) --------
-


-------- --------
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




(Custom value of (Matching unit)) Equal to 0
-
-



Then - Actions
-




Custom script: call IndexUnit()
-
-



Else - Actions
-
-


Custom script: return false
-


Custom script: endfunction
-


-------- --------
-


-------- The next function initializes the core of the system --------
-


-------- --------
-


Custom script: function InitializeUnitIndexer takes nothing returns nothing
-


Custom script: local integer i = 0
-


Custom script: local region re = CreateRegion()
-


Custom script: local rect r = GetWorldBounds()
-


Set UnitIndexerEnabled = True
-


Custom script: call RegionAddRect(re, r)
-


Custom script: call TriggerRegisterEnterRegion(CreateTrigger(), re, Filter(function IndexNewUnit))
-


Custom script: call RemoveRect(r)
-


Custom script: set re = null
-


Custom script: set r = null
-


Custom script: loop
-


Custom script: call GroupEnumUnitsOfPlayer(bj_lastCreatedGroup, Player(i), Filter(function IndexUnit))
-


Custom script: set i = i + 1
-


Custom script: exitwhen i == 16
-


Custom script: endloop
-


-------- --------
-


-------- This is the "Unit Indexer Initialized" event, use it instead of "Map Initialization" for best results --------
-


-------- --------
-


Set UnitIndexEvent = 3.00
-


Set UnitIndexEvent = 0.00
-
-
-
MeatHook Cast
-

Events
-


Unit - A unit Starts the effect of an ability
-
-

Conditions
-


(Ability being cast) Equal to Meat Hook New
-
-

Actions
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




(Number of units in MeatHook_HeadGroup) Equal to 0
-
-



Then - Actions
-




Trigger - Turn on MeatHook Run <gen>
-
-



Else - Actions
-
-


Set TempUnitLoc = (Position of (Triggering unit))
-


Set TempTargetLoc = (Target point of ability being cast)
-


Set MeatHook_DummyHeadType = Meat Hook (Head)
-


Set MeatHook_ChainType = Meat Hook (Dummy)
-


Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (TempUnitLoc offset by 25.00 towards (Angle from TempUnitLoc to TempTargetLoc) degrees) facing (Angle from TempUnitLoc to TempTargetLoc) degrees
-


Set MeatHook_Index = (Custom value of (Last created unit))
-


Set MeatHook_DamageIndex[MeatHook_Index] = (125.00 x (Real((Level of (Ability being cast) for (Triggering unit)))))
-


Set MeatHook_RangeIndex[MeatHook_Index] = 1200.00
-


Set MeatHook_RadiusIndex[MeatHook_Index] = 100.00
-


Set MeatHook_SpeedIndex[MeatHook_Index] = 40.00
-


Set MeatHook_BoolIndex[MeatHook_Index] = True
-


Set MeatHook_BoolDoneIndex[MeatHook_Index] = False
-


Set MeatHook_CasterIndex[MeatHook_Index] = (Triggering unit)
-


Set MeatHook_CasterLocIndex[MeatHook_Index] = (Position of (Triggering unit))
-


Set MeatHook_OffsetIndex[MeatHook_Index] = 0.00
-


Set MeatHook_DummyHeadIndex[MeatHook_Index] = (Last created unit)
-


Set MeatHook_TargetIndex[MeatHook_Index] = No unit
-


Unit Group - Add (Last created unit) to MeatHook_HeadGroup
-


Custom script: call RemoveLocation (udg_TempUnitLoc)
-


Custom script: call RemoveLocation (udg_TempTargetLoc)
-
-
-
MeatHook Run
-

Events
-


Time - Every 0.03 seconds of game time
-
-

Conditions
-

Actions
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




(Number of units in MeatHook_HeadGroup) Greater than 0
-
-



Then - Actions
-




Unit Group - Pick every unit in MeatHook_HeadGroup and do (Actions)
-





Loop - Actions
-






Set MeatHook_DummyHead = (Picked unit)
-






Set MeatHook_DummyIndex = (Custom value of MeatHook_DummyHead)
-






Set MeatHook_Bool = MeatHook_BoolIndex[MeatHook_DummyIndex]
-






Set MeatHook_Range = MeatHook_RangeIndex[MeatHook_DummyIndex]
-






Set MeatHook_Radius = MeatHook_RadiusIndex[MeatHook_DummyIndex]
-






Set MeatHook_Speed = MeatHook_SpeedIndex[MeatHook_DummyIndex]
-






Set MeatHook_CasterLocIndex[MeatHook_DummyIndex] = (Position of MeatHook_CasterIndex[MeatHook_DummyIndex])
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If - Conditions
-








MeatHook_Bool Equal to True
-
-







Then - Actions
-








If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-









If - Conditions
-










MeatHook_OffsetIndex[MeatHook_DummyIndex] Less than MeatHook_Range
-
-









Then - Actions
-










Set MeatHook_OffsetIndex[MeatHook_DummyIndex] = (MeatHook_OffsetIndex[MeatHook_DummyIndex] + MeatHook_Speed)
-










Set MeatHook_DummyLoc = (Position of MeatHook_DummyHead)
-










Set MeatHook_OffsetLoc = (MeatHook_DummyLoc offset by MeatHook_Speed towards (Facing of MeatHook_DummyHead) degrees)
-










Custom script: set udg_MeatHook_Z = GetLocationZ(udg_MeatHook_OffsetLoc)
-










Unit - Move MeatHook_DummyHead instantly to MeatHook_OffsetLoc, facing (Facing of MeatHook_DummyHead) degrees
-










Animation - Change MeatHook_DummyHead flying height to (MeatHook_Z - 75.00) at 0.00
-










Unit - Create 1 Meat Hook (Dummy) for (Owner of MeatHook_DummyHead) at (MeatHook_CasterLocIndex[MeatHook_DummyIndex] offset by MeatHook_Speed towards (Angle from MeatHook_CasterLocIndex[MeatHook_DummyIndex] to MeatHook_DummyLoc) degrees) facing (Angle from MeatHook_CasterLocIndex[MeatHook_DummyIndex] to MeatHook_DummyLoc) degrees
-










Unit - Set the custom value of (Last created unit) to MeatHook_DummyIndex
-










Unit Group - Add (Last created unit) to MeatHook_ChainGroup
-










Set MeatHook_Group = (Units within MeatHook_Radius of MeatHook_OffsetLoc matching (((Matching unit) Not equal to MeatHook_CasterIndex[MeatHook_DummyIndex]) and ((((Unit-type of (Matching unit)) Not equal to Hookhead Advanced) and (((Unit-type of (Matching unit)) Not equal to Dumm
-










If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-











If - Conditions
-












(Number of units in MeatHook_Group) Greater than 0
-
-











Then - Actions
-












Unit Group - Pick every unit in (Random 1 units from MeatHook_Group) and do (Actions)
-













Loop - Actions
-














Set MeatHook_BoolIndex[MeatHook_DummyIndex] = False
-














Set MeatHook_TargetIndex[MeatHook_DummyIndex] = (Picked unit)
-














Unit - Cause MeatHook_DummyHead to damage (Picked unit), dealing MeatHook_DamageIndex[MeatHook_DummyIndex] damage of attack type Spells and damage type Normal
-














Unit - Turn collision for (Picked unit) Off
-














Unit - Add Storm Crow Form to (Picked unit)
-














Unit - Remove Storm Crow Form from (Picked unit)
-














Animation - Change (Picked unit) flying height to (MeatHook_Z - 75.00) at 0.00
-














Special Effect - Create a special effect attached to the chest of (Picked unit) using Objects\Spawnmodels\Human\HumanBlood\BloodElfSpellThiefBlood.mdl
-














Set TempFX = (Last created special effect)
-














Special Effect - Destroy TempFX
-
-
-
-











Else - Actions
-
-










Custom script: call RemoveLocation (udg_MeatHook_DummyLoc)
-










Custom script: call RemoveLocation (udg_MeatHook_OffsetLoc)
-
-









Else - Actions
-










Set MeatHook_BoolIndex[MeatHook_DummyIndex] = False
-
-
-
-







Else - Actions
-








If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-









If - Conditions
-










MeatHook_BoolDoneIndex[MeatHook_DummyIndex] Equal to False
-
-









Then - Actions
-










Set MeatHook_DummyLoc = (Position of MeatHook_DummyHead)
-










Set MeatHook_OffsetLoc = (MeatHook_DummyLoc offset by (-1.00 x MeatHook_Speed) towards (Angle from MeatHook_CasterLocIndex[MeatHook_DummyIndex] to MeatHook_DummyLoc) degrees)
-










If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-











If - Conditions
-












(Distance between MeatHook_DummyLoc and MeatHook_CasterLocIndex[MeatHook_DummyIndex]) Greater than or equal to 90.00
-
-











Then - Actions
-












Unit - Move MeatHook_DummyHead instantly to MeatHook_OffsetLoc, facing (Facing of MeatHook_DummyHead) degrees
-












Custom script: set udg_MeatHook_Z = GetLocationZ(udg_MeatHook_OffsetLoc)
-












Animation - Change MeatHook_DummyHead flying height to (MeatHook_Z - 75.00) at 0.00
-












If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-













If - Conditions
-














MeatHook_TargetIndex[MeatHook_DummyIndex] Not equal to No unit
-
-













Then - Actions
-














Unit - Move MeatHook_TargetIndex[MeatHook_DummyIndex] instantly to MeatHook_OffsetLoc, facing Default building facing degrees
-














Unit - Add Storm Crow Form to MeatHook_TargetIndex[MeatHook_DummyIndex]
-














Unit - Remove Storm Crow Form from MeatHook_TargetIndex[MeatHook_DummyIndex]
-














Animation - Change (Picked unit) flying height to (MeatHook_Z - 75.00) at 0.00
-
-













Else - Actions
-
-
-











Else - Actions
-












Unit - Turn collision for MeatHook_TargetIndex[MeatHook_DummyIndex] On
-












Animation - Change MeatHook_TargetIndex[MeatHook_DummyIndex] flying height to 0.00 at 0.00
-












Unit - Remove MeatHook_DummyHead from the game
-












Set MeatHook_BoolDoneIndex[MeatHook_DummyIndex] = True
-
-
-










Custom script: call RemoveLocation (udg_MeatHook_DummyLoc)
-










Custom script: call RemoveLocation (udg_MeatHook_OffsetLoc)
-
-









Else - Actions
-
-
-
-






Custom script: call RemoveLocation (udg_MeatHook_CasterLocIndex[udg_MeatHook_DummyIndex])
-
-
-
-



Else - Actions
-




Trigger - Turn off (This trigger)
-
-
-


Unit Group - Pick every unit in MeatHook_ChainGroup and do (Actions)
-



Loop - Actions
-




If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





If - Conditions
-






MeatHook_BoolIndex[(Custom value of (Picked unit))] Equal to True
-
-





Then - Actions
-






Set MeatHook_DummyHead = (Picked unit)
-






Set MeatHook_DummyIndex = (Custom value of MeatHook_DummyHead)
-






Set MeatHook_DummyLoc = (Position of MeatHook_DummyHead)
-






Set MeatHook_Speed = MeatHook_SpeedIndex[MeatHook_DummyIndex]
-






Set MeatHook_OffsetLoc = (MeatHook_DummyLoc offset by MeatHook_Speed towards (Facing of MeatHook_DummyHead) degrees)
-






Unit - Move MeatHook_DummyHead instantly to MeatHook_OffsetLoc, facing (Facing of MeatHook_DummyHead) degrees
-






Custom script: set udg_MeatHook_Z = GetLocationZ(udg_MeatHook_OffsetLoc)
-






Animation - Change MeatHook_DummyHead flying height to (MeatHook_Z - 75.00) at 0.00
-






Custom script: call RemoveLocation (udg_MeatHook_DummyLoc)
-






Custom script: call RemoveLocation (udg_MeatHook_OffsetLoc)
-
-





Else - Actions
-






Set MeatHook_DummyHead = (Picked unit)
-






Set MeatHook_DummyIndex = (Custom value of MeatHook_DummyHead)
-






Set MeatHook_DummyLoc = (Position of MeatHook_DummyHead)
-






Set MeatHook_Speed = MeatHook_SpeedIndex[MeatHook_DummyIndex]
-






Set MeatHook_CasterLocIndex[MeatHook_DummyIndex] = (Position of MeatHook_CasterIndex[MeatHook_DummyIndex])
-






Set MeatHook_OffsetLoc = (MeatHook_DummyLoc offset by (-1.00 x MeatHook_Speed) towards (Angle from MeatHook_CasterLocIndex[MeatHook_DummyIndex] to MeatHook_DummyLoc) degrees)
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If - Conditions
-








(Distance between MeatHook_DummyLoc and MeatHook_CasterLocIndex[MeatHook_DummyIndex]) Greater than or equal to 90.00
-
-







Then - Actions
-








Unit - Move MeatHook_DummyHead instantly to MeatHook_OffsetLoc, facing (Facing of MeatHook_DummyHead) degrees
-








Custom script: set udg_MeatHook_Z = GetLocationZ(udg_MeatHook_OffsetLoc)
-








Animation - Change MeatHook_DummyHead flying height to (MeatHook_Z - 75.00) at 0.00
-
-







Else - Actions
-








Unit - Remove MeatHook_DummyHead from the game
-
-
-






Custom script: call RemoveLocation (udg_MeatHook_CasterLocIndex[udg_MeatHook_DummyIndex])
-






Custom script: call RemoveLocation (udg_MeatHook_DummyLoc)
-






Custom script: call RemoveLocation (udg_MeatHook_OffsetLoc)
-
-
-
-
-
-
Where do i change the speed of the hook. Also how big distance of the chain.
Also if i gona add so you cant hook through buildings or doodas/trees.
Where do i change this and how do i do?
And do this hook catch units on the way back?
