- Joined
- Mar 1, 2013
- Messages
- 555
I'm trying to develop a decent, efficient, GUI meat hook spell with help from Bribe's unit indexer but I am far from finish >.<
PROBLEM: the chain in the last 'else' function won't get removed. Can anyone please explain why? The problem is either in the 'if' statement or where var X is set
STRATEGY: I'm trying to insert the chain elements into a virtual 2D array where X - Spell ID (custom value of chain head) and Y - the amount of 'chains' of current spell + 1. I want to find a specific chain using IF (X = Custom value) AND (Y = Length +/- n) for future chain manipulation.
I know there is plenty of leaks and stuff but that can wait. Help will be greatly appreciated.
-
Meathook cast
-
Events
-
Unit - A unit Starts the effect of an ability
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Meat Hook2
-
-
Actions
-
Custom script: if IsUnitGroupEmptyBJ(udg_MeatHooksGroup) == true then
-
Custom script: call EnableTrigger( gg_trg_Meathook_loop )
-
Custom script: endif
-
Set Temp_Unit = (Triggering unit)
-
Set Temp_Point = (Position of Temp_Unit)
-
Set Temp_Point2 = (Target point of ability being cast)
-
Set Temp_Real = (Angle from Temp_Point to Temp_Point2)
-
Unit - Create 1 Meat Hook (Head) for (Owner of Temp_Unit) at Temp_Point facing Temp_Real degrees
-
Custom script: call RemoveLocation(udg_Temp_Point)
-
Custom script: call RemoveLocation(udg_Temp_Point2)
-
Unit Group - Add (Last created unit) to MeatHooksGroup
-
Set Temp_Int = (Custom value of (Last created unit))
-
Set MeatHookC[Temp_Int] = Temp_Unit
-
Set MeatHookDistance[Temp_Int] = 800.00
-
Set MeatHookTraveled[Temp_Int] = 0.00
-
Set MeatHookLength[Temp_Int] = 0
-
Set MeatHookLaunch[Temp_Int] = True
-
-
-
===============================
-
Meathook loop
-
Events
-
Time - Every 0.03 seconds of game time
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in MeatHooksGroup and do (Actions)
-
Loop - Actions
-
Set MeatHookHead = (Picked unit)
-
Set MeatHookCustom = (Custom value of MeatHookHead)
-
Set Temp_Point = (Position of MeatHookHead)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
MeatHookLaunch[MeatHookCustom] Equal to True
-
-
Then - Actions
-
Set Temp_Point2 = (Temp_Point offset by 10.00 towards (Facing of MeatHookHead) degrees)
-
Unit - Move MeatHookHead instantly to Temp_Point2
-
Unit - Create 1 Meat Hook (Dummy) for Neutral Passive at Temp_Point facing (Facing of MeatHookHead) degrees
-
Set MeatHookChainX[(Custom value of (Last created unit))] = MeatHookCustom
-
Set MeatHookChainY[(Custom value of (Last created unit))] = MeatHookLength[MeatHookCustom]
-
Set MeatHookLength[MeatHookCustom] = (MeatHookLength[MeatHookCustom] + 1)
-
Set MeatHookTraveled[MeatHookCustom] = (MeatHookTraveled[MeatHookCustom] + 10.00)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
MeatHookTraveled[MeatHookCustom] Greater than MeatHookDistance[MeatHookCustom]
-
-
Then - Actions
-
Set MeatHookLaunch[MeatHookCustom] = False
-
-
Else - Actions
-
-
-
Else - Actions
-
Set Temp_Point2 = (Temp_Point offset by 10.00 towards ((Facing of MeatHookHead) + 180.00) degrees)
-
Unit - Move MeatHookHead instantly to Temp_Point2
-
Unit Group - Pick every unit in (Units within 100000000.00 of (Center of (Playable map area)) matching (MeatHookChainX[(Custom value of (Matching unit))] Equal to MeatHookCustom)) and do (Actions)
-
Loop - Actions
-
Unit - Remove (Picked unit) from the game
-
-
-
Set MeatHookLength[MeatHookCustom] = (MeatHookLength[MeatHookCustom] - 1)
-
-
-
-
-
-
PROBLEM: the chain in the last 'else' function won't get removed. Can anyone please explain why? The problem is either in the 'if' statement or where var X is set
STRATEGY: I'm trying to insert the chain elements into a virtual 2D array where X - Spell ID (custom value of chain head) and Y - the amount of 'chains' of current spell + 1. I want to find a specific chain using IF (X = Custom value) AND (Y = Length +/- n) for future chain manipulation.
I know there is plenty of leaks and stuff but that can wait. Help will be greatly appreciated.
UPDATE:
This spell is pretty much finished. All I'm having problem with is the curve. I will be grateful if someone can help me. Also please point out any leaks or bad coding if you can find any. This spell will support levels soon. Credit and rep will be given.
-
Meathook cast
-
Events
-
Unit - A unit Starts the effect of an ability
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Meat Hook2
-
-
Actions
-
Custom script: if IsUnitGroupEmptyBJ(udg_MeatHHeads) == true then
-
Custom script: call EnableTrigger( gg_trg_Meathook_loop )
-
Custom script: endif
-
Set Temp_Unit = (Triggering unit)
-
Set Temp_Point = (Position of Temp_Unit)
-
Set Temp_Point2 = (Target point of ability being cast)
-
Set Temp_Real = (Angle from Temp_Point to Temp_Point2)
-
Unit - Create 1 Meat Hook (Head) for (Owner of Temp_Unit) at Temp_Point facing Temp_Real degrees
-
Custom script: call RemoveLocation(udg_Temp_Point)
-
Custom script: call RemoveLocation(udg_Temp_Point2)
-
Unit Group - Add (Last created unit) to MeatHHeads
-
Set Temp_Int = (Custom value of (Last created unit))
-
Set MeatHC[Temp_Int] = Temp_Unit
-
Set MeatHookTraveled[Temp_Int] = 0.00
-
Set MeatHLength[Temp_Int] = 0
-
Set MeatHT[Temp_Int] = No unit
-
Set MeatHLaunch[Temp_Int] = True
-
-------- CUSTOM PROPERTIES --------
-
Set MeatHDistance[Temp_Int] = 1200.00
-
Set MeatHSpeed[Temp_Int] = 20.00
-
Set MeatHDamage[Temp_Int] = 100.00
-
Set MeatHDamageLoop[Temp_Int] = 1.00
-
Set MeatHAoE[Temp_Int] = 75.00
-
-
-
====================================
-
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 CValue = (Custom value of MeatHHead)
-
Set Temp_Point = (Position of MeatHHead)
-
-------- index chain into array --------
-
Unit Group - Pick every unit in MeatHChains and do (Actions)
-
Loop - Actions
-
Set Temp_Unit = (Picked unit)
-
-------- Pick chains that belongs to head --------
-
-------- 2D Array: A - fliter chains that belongs to head/spell --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
MeatHA[(Custom value of Temp_Unit)] Equal to CValue
-
-
Then - Actions
-
-------- 2D Array: B - index inside spell A --------
-
Set MeatHChain[MeatHB[(Custom value of Temp_Unit)]] = Temp_Unit
-
-
Else - Actions
-
-
-
-
Custom script: call DestroyGroup(GetLastCreatedGroup())
-
For each (Integer i) from 1 to MeatHLength[CValue], do (Actions)
-
Loop - Actions
-
-------- CURVE --------
-
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
MeatHLaunch[CValue] Equal to True
-
-
Then - Actions
-
Set Temp_Point2 = (Temp_Point offset by MeatHSpeed[CValue] towards (Facing of MeatHHead) degrees)
-
Unit - Move MeatHHead instantly to Temp_Point2
-
Set MeatHLength[CValue] = (MeatHLength[CValue] + 1)
-
Unit - Create 1 Meat Hook (Dummy) for Neutral Passive at Temp_Point facing (Facing of MeatHHead) degrees
-
Unit Group - Add (Last created unit) to MeatHChains
-
-------- 2D Array where A = Spell index (custom value/CValue) and B = index of chain inside spell (MeathHLength[]) --------
-
Set MeatHA[(Custom value of (Last created unit))] = CValue
-
Set MeatHB[(Custom value of (Last created unit))] = MeatHLength[CValue]
-
-------- End 2D Array --------
-
Set MeatHookTraveled[CValue] = (MeatHookTraveled[CValue] + MeatHSpeed[CValue])
-
Set Temp_Group = (Units within MeatHAoE[CValue] of Temp_Point2 matching (((Matching unit) Not equal to MeatHC[CValue]) and ((Unit-type of (Matching unit)) Not equal to Meat Hook (Head))))
-
Custom script: call RemoveLocation(udg_Temp_Point2)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Temp_Group is empty) Equal to False
-
-
Then - Actions
-
Set MeatHT[CValue] = (Random unit from Temp_Group)
-
Unit - Turn collision for MeatHT[CValue] Off
-
Unit - Cause MeatHC[CValue] to damage MeatHT[CValue], dealing MeatHDamage[CValue] damage of attack type Normal and damage type Normal
-
Set MeatHLaunch[CValue] = False
-
-
Else - Actions
-
-
Custom script: call DestroyGroup(udg_Temp_Group)
-
Custom script: if udg_MeatHookTraveled[udg_CValue] > udg_MeatHDistance[udg_CValue] then
-
Custom script: set udg_MeatHLaunch[udg_CValue] = false
-
Custom script: endif
-
-
Else - Actions
-
Set Temp_Point2 = (Temp_Point offset by (MeatHSpeed[CValue] x -1.00) towards (Facing of MeatHHead) degrees)
-
Unit - Move MeatHHead instantly to Temp_Point2
-
Custom script: call SetUnitX(udg_MeatHT[udg_CValue], GetLocationX(udg_Temp_Point2))
-
Custom script: call SetUnitY(udg_MeatHT[udg_CValue], GetLocationY(udg_Temp_Point2))
-
Custom script: call RemoveLocation(udg_Temp_Point2)
-
Unit - Cause MeatHC[CValue] to damage MeatHT[CValue], dealing MeatHDamageLoop[CValue] damage of attack type Normal and damage type Normal
-
-------- Removes last 'piece' of chain --------
-
Unit - Remove MeatHChain[MeatHLength[CValue]] from the game
-
Set MeatHLength[CValue] = (MeatHLength[CValue] - 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(MeatHLength[CValue] Equal to 0) or ((MeatHC[CValue] is dead) Equal to True)
-
-
Then - Actions
-
Unit - Turn collision for MeatHT[CValue] On
-
Set MeatHT[CValue] = No unit
-
For each (Integer i) from 1 to MeatHLength[CValue], do (Actions)
-
Loop - Actions
-
Unit - Remove MeatHChain[i] from the game
-
-
-
Unit Group - Remove MeatHHead from MeatHHeads
-
Unit - Remove MeatHHead from the game
-
Custom script: if IsUnitGroupEmptyBJ(udg_MeatHHeads) == true then
-
-------- Trigger gets disabled, therefore Temp_Point at the bottom won't be remove. --------
-
Custom script: call RemoveLocation(udg_Temp_Point)
-
Custom script: call DisableTrigger(GetTriggeringTrigger())
-
Custom script: endif
-
-
Else - Actions
-
-
-
-
Custom script: call RemoveLocation(udg_Temp_Point)
-
-
-
-
Note: if you want to download the map, use the Meathook folder, not the spell folder. the spell folder was coded by RiotApe.
Attachments
Last edited: