Meathook loop
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in MeatHHeads and do (Actions)
Loop - Actions
Set MeatHHead = (Picked unit)
Set MeatHRef = (Custom value of MeatHHead)
Custom script: set udg_MeatHCX = GetUnitX(udg_MeatHC[udg_MeatHRef])
Custom script: set udg_MeatHCY = GetUnitY(udg_MeatHC[udg_MeatHRef])
-------- --------------------------------------------- --------
Unit Group - Pick every unit in MeatHRow[MeatHRef] and do (Actions)
Loop - Actions
Set Temp_Int = (Custom value of (Picked unit))
Set MeatHChainRef[MeatHLst[Temp_Int]] = Temp_Int
Set MeatHChain[MeatHLst[Temp_Int]] = UDexUnits[Temp_Int]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHLaunch[MeatHRef] Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHLockOn[MeatHRef] Not equal to No unit
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHC[MeatHRef] Equal to MeatHLockOn[MeatHRef]
Then - Actions
Set MeatHDeg[MeatHRef] = (Facing of MeatHC[MeatHRef])
Else - Actions
Custom script: set udg_tempX = GetUnitX(udg_MeatHLockOn[udg_MeatHRef])
Custom script: set udg_tempY = GetUnitY(udg_MeatHLockOn[udg_MeatHRef])
Custom script: set udg_MeatHDeg[udg_MeatHRef] = bj_RADTODEG * Atan2(udg_tempY - udg_MeatHChainY[udg_MeatHRef], udg_tempX - udg_MeatHChainX[udg_MeatHRef])
Else - Actions
Set tempX = (MeatHChainX[MeatHRef] + (MeatHSpeed[MeatHRef] x (Cos(MeatHDeg[MeatHRef]))))
Set tempY = (MeatHChainY[MeatHRef] + (MeatHSpeed[MeatHRef] x (Sin(MeatHDeg[MeatHRef]))))
-------- --------------------------------------------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
tempX Less than minX
tempY Less than minY
tempX Greater than maxX
tempY Greater than maxY
Then - Actions
Set UDex = MeatHRef
Set MeatHEvent = 5.00
Set MeatHEvent = 0.00
Set MeatHLaunch[MeatHRef] = False
Else - Actions
Custom script: call SetUnitX(udg_MeatHHead, udg_tempX)
Custom script: call SetUnitY(udg_MeatHHead, udg_tempY)
Set MeatHChainX[MeatHRef] = tempX
Set MeatHChainY[MeatHRef] = tempY
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHLaunch[MeatHRef] Equal to True
Then - Actions
For each (Integer Temp_IntB) from 2 to MeatHSize[MeatHRef], do (Actions)
Loop - Actions
Set Temp_IntC = (Temp_IntB - 1)
Custom script: set udg_Temp_Real = bj_RADTODEG * Atan2(udg_MeatHChainY[udg_MeatHChainRef[udg_Temp_IntB]] - udg_MeatHChainY[udg_MeatHChainRef[udg_Temp_IntC]], udg_MeatHChainX[udg_MeatHChainRef[udg_Temp_IntB]] - udg_MeatHChainX[udg_MeatHChainRef[udg_Temp_IntC]])
Set MeatHChainX[MeatHChainRef[Temp_IntB]] = (MeatHChainX[MeatHChainRef[Temp_IntC]] + (MeatHChainRate[MeatHRef] x (Cos(Temp_Real))))
Set MeatHChainY[MeatHChainRef[Temp_IntB]] = (MeatHChainY[MeatHChainRef[Temp_IntC]] + (MeatHChainRate[MeatHRef] x (Sin(Temp_Real))))
Custom script: call SetUnitX(udg_MeatHChain[udg_Temp_IntB], udg_MeatHChainX[udg_MeatHChainRef[udg_Temp_IntB]])
Custom script: call SetUnitY(udg_MeatHChain[udg_Temp_IntB], udg_MeatHChainY[udg_MeatHChainRef[udg_Temp_IntB]])
Custom script: call SetUnitFacing(udg_MeatHChain[udg_Temp_IntB], udg_Temp_Real)
Set MeatHTraveled[MeatHRef] = (MeatHTraveled[MeatHRef] + MeatHSpeed[MeatHRef])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHTraveled[MeatHRef] Greater than or equal to MeatHDist[MeatHRef]
Then - Actions
Set UDex = MeatHRef
Set MeatHEvent = 5.00
Set MeatHEvent = 0.00
Set MeatHLaunch[MeatHRef] = False
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHGrapple[MeatHRef] Equal to True
MeatHT[MeatHRef] Not equal to No unit
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(MeatHT[MeatHRef] is alive) Equal to True
Then - Actions
-------- --------------------------------------------- --------
Set MeatHNewPoint = (Position of MeatHT[MeatHRef])
Set MeatHChainX[MeatHRef] = (X of MeatHNewPoint)
Set MeatHChainY[MeatHRef] = (Y of MeatHNewPoint)
Custom script: call RemoveLocation(udg_MeatHNewPoint)
Custom script: call SetUnitX(udg_MeatHHead, udg_MeatHChainX[udg_MeatHRef])
Custom script: call SetUnitY(udg_MeatHHead, udg_MeatHChainY[udg_MeatHRef])
For each (Integer Temp_IntB) from 2 to MeatHSize[MeatHRef], do (Actions)
Loop - Actions
Custom script: set udg_Temp_Real = bj_RADTODEG * Atan2(udg_MeatHChainY[udg_MeatHChainRef[udg_Temp_IntB]] - udg_MeatHChainY[udg_MeatHChainRef[udg_Temp_IntB - 1]], udg_MeatHChainX[udg_MeatHChainRef[udg_Temp_IntB]] - udg_MeatHChainX[udg_MeatHChainRef[udg_Temp_IntB - 1]])
Set MeatHChainX[MeatHChainRef[Temp_IntB]] = (MeatHChainX[MeatHChainRef[(Temp_IntB - 1)]] + (MeatHChainRate[MeatHRef] x (Cos(Temp_Real))))
Set MeatHChainY[MeatHChainRef[Temp_IntB]] = (MeatHChainY[MeatHChainRef[(Temp_IntB - 1)]] + (MeatHChainRate[MeatHRef] x (Sin(Temp_Real))))
Custom script: call SetUnitX(udg_MeatHChain[udg_Temp_IntB], udg_MeatHChainX[udg_MeatHChainRef[udg_Temp_IntB]])
Custom script: call SetUnitY(udg_MeatHChain[udg_Temp_IntB], udg_MeatHChainY[udg_MeatHChainRef[udg_Temp_IntB]])
Custom script: call SetUnitFacing(udg_MeatHChain[udg_Temp_IntB], udg_Temp_Real)
Else - Actions
Set MeatHT[MeatHRef] = No unit
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHHooked[(Custom value of MeatHC[MeatHRef])] Equal to 0
Then - Actions
Custom script: set udg_Temp_Real = bj_RADTODEG * Atan2(udg_MeatHChainY[udg_MeatHChainRef[udg_MeatHSize[udg_MeatHRef]]] - udg_MeatHCY, udg_MeatHChainX[udg_MeatHChainRef[udg_MeatHSize[udg_MeatHRef]]] - udg_MeatHCX)
Set MeatHCX = (MeatHCX + (MeatHSpeed[MeatHRef] x (Cos(Temp_Real))))
Set MeatHCY = (MeatHCY + (MeatHSpeed[MeatHRef] x (Sin(Temp_Real))))
Custom script: call SetUnitX(udg_MeatHC[udg_MeatHRef], udg_MeatHCX)
Custom script: call SetUnitY(udg_MeatHC[udg_MeatHRef], udg_MeatHCY)
Else - Actions
Else - Actions
For each (Integer Temp_IntB) from 1 to (MeatHSize[MeatHRef] - 1), do (Actions)
Loop - Actions
Custom script: set udg_Temp_Real = bj_RADTODEG * Atan2(udg_MeatHChainY[udg_MeatHChainRef[udg_Temp_IntB + 1]] - udg_MeatHChainY[udg_MeatHChainRef[udg_Temp_IntB]], udg_MeatHChainX[udg_MeatHChainRef[udg_Temp_IntB + 1]] - udg_MeatHChainX[udg_MeatHChainRef[udg_Temp_IntB]])
Set MeatHChainX[MeatHChainRef[Temp_IntB]] = (MeatHChainX[MeatHChainRef[Temp_IntB]] + (MeatHSpeed[MeatHRef] x (Cos(Temp_Real))))
Set MeatHChainY[MeatHChainRef[Temp_IntB]] = (MeatHChainY[MeatHChainRef[Temp_IntB]] + (MeatHSpeed[MeatHRef] x (Sin(Temp_Real))))
Custom script: call SetUnitX(udg_MeatHChain[udg_Temp_IntB], udg_MeatHChainX[udg_MeatHChainRef[udg_Temp_IntB]])
Custom script: call SetUnitY(udg_MeatHChain[udg_Temp_IntB], udg_MeatHChainY[udg_MeatHChainRef[udg_Temp_IntB]])
Custom script: call SetUnitFacing(udg_MeatHChain[udg_Temp_IntB], udg_Temp_Real)
Custom script: set udg_Temp_Real = bj_RADTODEG * Atan2(udg_MeatHCY - udg_MeatHChainY[udg_MeatHChainRef[udg_MeatHSize[udg_MeatHRef]]], udg_MeatHCX - udg_MeatHChainX[udg_MeatHChainRef[udg_MeatHSize[udg_MeatHRef]]])
Set MeatHChainX[MeatHChainRef[MeatHSize[MeatHRef]]] = (MeatHChainX[MeatHChainRef[MeatHSize[MeatHRef]]] + (MeatHSpeed[MeatHRef] x (Cos(Temp_Real))))
Set MeatHChainY[MeatHChainRef[MeatHSize[MeatHRef]]] = (MeatHChainY[MeatHChainRef[MeatHSize[MeatHRef]]] + (MeatHSpeed[MeatHRef] x (Sin(Temp_Real))))
Custom script: call SetUnitX(udg_MeatHChain[udg_MeatHSize[udg_MeatHRef]], udg_MeatHChainX[udg_MeatHChainRef[udg_MeatHSize[udg_MeatHRef]]])
Custom script: call SetUnitY(udg_MeatHChain[udg_MeatHSize[udg_MeatHRef]], udg_MeatHChainY[udg_MeatHChainRef[udg_MeatHSize[udg_MeatHRef]]])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHT[MeatHRef] Not equal to No unit
Then - Actions
Custom script: call SetUnitX(udg_MeatHT[udg_MeatHRef], udg_MeatHChainX[udg_MeatHRef])
Custom script: call SetUnitY(udg_MeatHT[udg_MeatHRef], udg_MeatHChainY[udg_MeatHRef])
Else - Actions
Custom script: set udg_Temp_Real = distance(udg_MeatHCX, udg_MeatHChainX[udg_MeatHChainRef[udg_MeatHSize[udg_MeatHRef]]], udg_MeatHCY, udg_MeatHChainY[udg_MeatHChainRef[udg_MeatHSize[udg_MeatHRef]]]) - udg_MeatHOffset[udg_MeatHRef]
If (MeatHLaunch[MeatHRef] Equal to False) then do (Set Temp_Real = (Temp_Real - MeatHSpeed[MeatHRef])) else do (-------- ... --------)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHChainRate[MeatHRef] Greater than 0.00
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Temp_Real Greater than MeatHChainRate[MeatHRef]
Then - Actions
Custom script: loop
Custom script: exitwhen udg_Temp_Real < udg_MeatHChainRate[udg_MeatHRef]
Custom script: set udg_MeatHAngle = bj_RADTODEG * Atan2(udg_MeatHCY - udg_MeatHChainY[udg_MeatHChainRef[udg_MeatHSize[udg_MeatHRef]]], udg_MeatHCX - udg_MeatHChainX[udg_MeatHChainRef[udg_MeatHSize[udg_MeatHRef]]])
Set MeatHTempX = (MeatHChainX[MeatHChainRef[MeatHSize[MeatHRef]]] + (MeatHChainRate[MeatHRef] x (Cos(MeatHAngle))))
Set MeatHTempY = (MeatHChainY[MeatHChainRef[MeatHSize[MeatHRef]]] + (MeatHChainRate[MeatHRef] x (Sin(MeatHAngle))))
Custom script: set udg_Temp_Int = GetUnitUserData(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), udg_dummy, udg_MeatHTempX, udg_MeatHTempY, udg_MeatHAngle ))
Unit - Pause UDexUnits[Temp_Int]
Unit Group - Add UDexUnits[Temp_Int] to MeatHRow[MeatHRef]
Set MeatHSize[MeatHRef] = (MeatHSize[MeatHRef] + 1)
Set MeatHLst[Temp_Int] = MeatHSize[MeatHRef]
Set MeatHChainRef[MeatHSize[MeatHRef]] = Temp_Int
Set MeatHChainX[Temp_Int] = MeatHTempX
Set MeatHChainY[Temp_Int] = MeatHTempY
Animation - Change UDexUnits[Temp_Int]'s size to (MeatHChainScale[MeatHRef]%, MeatHChainScale[MeatHRef]%, MeatHChainScale[MeatHRef]%) of its original size
Special Effect - Create a special effect attached to the orign of UDexUnits[Temp_Int] using MeatHChainModel[MeatHRef]
Set MeatHEffect[Temp_Int] = (Last created special effect)
Set MeatHChain[MeatHSize[MeatHRef]] = UDexUnits[Temp_Int]
Set MeatHChainRate[MeatHRef] = (MeatHChainRate[MeatHRef] + 0.10)
Set Temp_Real = (Temp_Real - MeatHChainRate[MeatHRef])
Custom script: endloop
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Temp_Real Less than (1.50 x MeatHSpeed[MeatHRef])
Then - Actions
Custom script: loop
Custom script: exitwhen udg_Temp_Real > udg_MeatHSpeed[udg_MeatHRef]
-------- --------------------------------------------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHSize[MeatHRef] Equal to 1
MeatHLaunch[MeatHRef] Equal to False
Then - Actions
Set UDex = MeatHRef
Set MeatHEvent = 3.00
Set MeatHEvent = 0.00
Trigger - Run Meathook end <gen> (ignoring conditions)
Set Temp_Real = (MeatHSpeed[MeatHRef] + 1.00)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHSize[MeatHRef] Not equal to 1
Then - Actions
Special Effect - Destroy MeatHEffect[MeatHChainRef[MeatHSize[MeatHRef]]]
Unit - Remove MeatHChain[MeatHSize[MeatHRef]] from the game
Set MeatHSize[MeatHRef] = (MeatHSize[MeatHRef] - 1)
Set Temp_Real = (Temp_Real + MeatHChainRate[MeatHRef])
Set MeatHChainRate[MeatHRef] = (MeatHChainRate[MeatHRef] - 0.10)
Else - Actions
Custom script: endloop
Else - Actions
Set UDex = MeatHRef
Set MeatHEvent = 1.00
Set MeatHEvent = 0.00
-------- --------------------------------------------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(MeatHHead is dead) Equal to False
Then - Actions
-------- --------------------------------------------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHFull[MeatHRef] Equal to False
MeatHAoE[MeatHRef] Greater than 0.00
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Config_MeatHIgnore Equal to True
Then - Actions
Custom script: call GroupEnumUnitsInRange(udg_Temp_Targets, udg_MeatHChainX[udg_MeatHRef], udg_MeatHChainY[udg_MeatHRef], udg_MeatHAoE[udg_MeatHRef], function FilterLockedUnit)
Else - Actions
Custom script: call GroupEnumUnitsInRange(udg_Temp_Targets, udg_MeatHChainX[udg_MeatHRef], udg_MeatHChainY[udg_MeatHRef], udg_MeatHAoE[udg_MeatHRef], null)
Unit Group - Pick every unit in Temp_Targets and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHT[MeatHRef] Equal to No unit
Then - Actions
Set Temp_Unit = (Picked unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Temp_Unit Not equal to MeatHC[MeatHRef]
(Temp_Unit is A flying unit) Equal to False
(Temp_Unit is dead) Equal to False
Then - Actions
Set MeatHT[MeatHRef] = Temp_Unit
Set UDex = MeatHRef
Set MeatHEvent = 2.00
Set MeatHEvent = 0.00
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Owner of MeatHT[MeatHRef]) is an enemy of (Owner of MeatHC[MeatHRef])) Equal to True
Then - Actions
Unit - Cause MeatHC[MeatHRef] to damage MeatHT[MeatHRef], dealing MeatHDamage[MeatHRef] damage of attack type MeatHDamageType[MeatHRef] and damage type Normal
Else - Actions
Set MeatHLaunch[MeatHRef] = False
Set MeatHFull[MeatHRef] = True
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHGrapple[MeatHRef] Equal to False
Then - Actions
Unit - Turn collision for MeatHT[MeatHRef] Off
Set MeatHT[MeatHHooked[(Custom value of MeatHT[MeatHRef])]] = No unit
Set MeatHHooked[(Custom value of MeatHT[MeatHRef])] = MeatHRef
Set MeatHLockOn[MeatHRef] = No unit
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHGrapling[(Custom value of MeatHC[MeatHRef])] Not equal to 0
Then - Actions
Set UDex = MeatHGrapling[(Custom value of MeatHC[MeatHRef])]
Trigger - Run Meathook end <gen> (ignoring conditions)
Else - Actions
Set MeatHGrapling[(Custom value of MeatHC[MeatHRef])] = MeatHRef
Unit - Turn collision for MeatHC[MeatHRef] Off
Else - Actions
Else - Actions
Custom script: call GroupClear(udg_Temp_Targets)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Owner of MeatHC[MeatHRef]) is an enemy of (Owner of MeatHT[MeatHRef])) Equal to True
Then - Actions
Unit - Cause MeatHC[MeatHRef] to damage MeatHT[MeatHRef], dealing MeatHDamageLoop[MeatHRef] damage of attack type MeatHDamageType[MeatHRef] and damage type Normal
Custom script: call DestroyEffect(AddSpecialEffectTarget( udg_MeatHSFX[udg_MeatHRef], udg_MeatHT[udg_MeatHRef], "chest" ))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(MeatHT[MeatHRef] is dead) Equal to True
Then - Actions
Set UDex = MeatHRef
Set MeatHEvent = 4.00
Set MeatHEvent = 0.00
Set MeatHT[MeatHRef] = No unit
If (MeatHRecicle[MeatHRef] Equal to True) then do (Set MeatHFull[MeatHRef] = False) else do (-------- ... --------)
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHAoEDamage[MeatHRef] Greater than 0.00
Then - Actions
Custom script: call GroupEnumUnitsInRange(udg_Temp_Targets, udg_MeatHChainX[udg_MeatHRef], udg_MeatHChainY[udg_MeatHRef], udg_MeatHDamageAoE[udg_MeatHRef], null)
Unit Group - Pick every unit in Temp_Targets and do (Actions)
Loop - Actions
Set Temp_Unit = (Picked unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Temp_Unit Not equal to MeatHC[MeatHRef]
Temp_Unit Not equal to MeatHT[MeatHRef]
(Temp_Unit is A flying unit) Equal to False
((Owner of Temp_Unit) is an enemy of (Owner of MeatHC[MeatHRef])) Equal to True
Then - Actions
Unit - Cause MeatHC[MeatHRef] to damage Temp_Unit, dealing MeatHAoEDamage[MeatHRef] damage of attack type MeatHDamageType[MeatHRef] and damage type Normal
Custom script: call DestroyEffect(AddSpecialEffectTarget( udg_MeatHAoESFX[udg_MeatHRef], udg_Temp_Unit, "chest" ))
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MeatHDestroyTrees[MeatHRef] Equal to True
Then - Actions
Set Temp_Rect = (Region((MeatHChainX[MeatHRef] - MeatHDamageAoE[MeatHRef]), (MeatHChainY[MeatHRef] - MeatHDamageAoE[MeatHRef]), (MeatHChainX[MeatHRef] + MeatHDamageAoE[MeatHRef]), (MeatHChainY[MeatHRef] + MeatHDamageAoE[MeatHRef])))
Destructible - Pick every destructible in Temp_Rect and do (Actions)
Loop - Actions
Unit - Order harvester to Harvest (Picked destructible)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Current order of harvester) Equal to (Order(harvest))
Then - Actions
Unit - Order harvester to Stop
Destructible - Kill (Picked destructible)
Else - Actions
Custom script: call RemoveRect(udg_Temp_Rect)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(MeatHLockOn[MeatHRef] is dead) Equal to True
Then - Actions
Set MeatHLockOn[MeatHRef] = No unit
Else - Actions
Else - Actions