Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
Since so many people are using hashtables and since I wanted to make an unlimited chain hook spell I decided to make this.
This is just an example
(don't contact me if you just want to modify it but please tell me if you use it and give Credits)
For specific description see Tooltip on Screenshot (however it has to say 10 - not 5)
Known bug:
Removing the caster while the spell is running will screw things up.
So don't use "Remove unit" while the spell loop is running
Unfortunately it seems like hashtables still return a unit if it has left the map already so I don't know how to detect it :S
The consequence of all the stuff is the following:
I won't use hashtables ever again unless there really is no other way to do it 'cause they are SLOW!
Have fun with it anyway
Events
Map initialization
Conditions
Actions
-------- Initialize the used hashtable and a dummy to check if a destructable is a tree --------
Hashtable - Create a hashtable
Set Hook_Hashtable = (Last created hashtable)
Set loc = (Point(0.00, 0.00))
Unit - Create 1 Peasant for Neutral Passive at loc facing 0.00 degrees
Unit - Hide (Last created unit)
Unit - Make (Last created unit) Invulnerable
Set harvester = (Last created unit)
Custom script: call RemoveLocation(udg_loc)
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Bane Web
Actions
-------- WARNING! --------
-------- This spell is extremely complex so you should not change anything besides the values marked with XXXXX/YYYYY unless you've got an advanced understanding of GUI --------
-------- This trigger picks 10 units within range and creates a hook for every one of them --------
Set i2 = 0
-------- XXXXXXXXXX --------
-------- Caster --------
Set u = (Triggering unit)
-------- YYYYYYYYYY --------
Set loc = (Position of u)
Custom script: set bj_wantDestroyGroup = true
-------- XXXXXXXXXX --------
-------- 500 + 100 per Level = Distance --------
Unit Group - Pick every unit in (Units within (500.00 + (100.00 x (Real((Level of (Ability being cast) for u))))) of loc matching ((((((Matching unit) is Magic Immune) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of u)) Equal to True)) and (((Matching unit) is A flyin and do (Actions)
Loop - Actions
-------- 10 = maximum of targeted units --------
-------- This is very useful if your pc sucks and you want to save performance --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
i2 Equal to 10
Then - Actions
-------- YYYYYYYYYY --------
Skip remaining actions
Else - Actions
-------- Create the first hook segment facing its target and adding it to a group --------
Set loc2 = (Position of (Picked unit))
Set a = (Angle from loc to loc2)
Custom script: call RemoveLocation( udg_loc2)
Unit - Create 1 Hook_Dummy for (Owner of u) at loc facing a degrees
Animation - Change (Last created unit) flying height to 75.00 at 0.00
Unit Group - Add (Last created unit) to Hook_Heads
-------- An expiration timer to remove dummys if the caster got removed from the game somehow --------
Unit - Add a 20.00 second Generic expiration timer to (Last created unit)
Set i = (Key (Last created unit))
-------- XXXXXXXXXX --------
-------- Save target --------
Hashtable - Save Handle Of(Picked unit) as i of 0 in Hook_Hashtable
-------- Save caster --------
Hashtable - Save Handle Ofu as i of 1 in Hook_Hashtable
-------- Shoot speed --------
Hashtable - Save 15.00 as 2 of i in Hook_Hashtable
-------- Distance between each segment --------
-------- Increasing this is also a very useful way to increase performance --------
-------- If it looks ugly just increase the units scaling size --------
Hashtable - Save 50.00 as 3 of i in Hook_Hashtable
-------- Return Speed --------
Hashtable - Save 17.00 as 4 of i in Hook_Hashtable
-------- Pull Damage --------
Hashtable - Save ((30.00 + (15.00 x (Real((Level of (Ability being cast) for u))))) / 33.00) as 5 of i in Hook_Hashtable
-------- Impact Damage --------
Hashtable - Save (50.00 + (25.00 x (Real((Level of (Ability being cast) for u))))) as 6 of i in Hook_Hashtable
-------- YYYYYYYYYY --------
Set i2 = (i2 + 1)
Custom script: call RemoveLocation( udg_loc )
-------- run --------
Trigger - Turn on HookLoop <gen>
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
-------- WARNING! --------
-------- You should not modify anything of this trigger unless you know what you are doing --------
-------- Real values --------
-------- 0 of i: max number of segments --------
-------- 1 of i: 0 = hook is moving twords target; 1 = hook is returning --------
-------- 2 of i: shoot speed --------
-------- 3 of i: distance between segments --------
-------- 4 of i: return speed --------
-------- 5 of i: pull dmg --------
-------- 6 of i: impact dmg --------
-------- Integers --------
-------- i: id of the Picked Unit --------
-------- i2: array slot for hook segments --------
-------- Units --------
-------- i of 0: target --------
-------- i of 1: caster --------
-------- Picked Unit (same as GetEnumUnit()): first hook segment --------
-------- i2 of i: array containing all hook segments --------
-------- Description --------
-------- The first half of the trigger moves the first segment towards the target until it reaches it and creates new segments to fill the gap between the caster and the last segment --------
-------- The second half moves them back to the caster and kills them if they come too close and moves the target with them --------
Unit Group - Pick every unit in Hook_Heads and do (Actions)
Loop - Actions
Set i = (Key (Picked unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Load 1 of i from Hook_Hashtable) Equal to 0
Then - Actions
-------- This basicly is the same as "Move unit to (position of this unit) offset by (distance) towards (angle between this unit and the target)" --------
-------- Except this is enhanced with JASS --------
Set r = (Load 2 of i from Hook_Hashtable)
Set u = (Load i of 0 in Hook_Hashtable)
Custom script: set udg_x = GetUnitX(GetEnumUnit())
Custom script: set udg_y = GetUnitY(GetEnumUnit())
Unit - Cause (Load i of 1 in Hook_Hashtable) to damage u, dealing (Load 5 of i from Hook_Hashtable) damage of attack type Spells and damage type Normal
Custom script: call SetUnitX(udg_u, udg_x)
Custom script: call SetUnitY(udg_u, udg_y)
-------- Desroy trees within range --------
Set loc = (Point(x2, y2))
Destructible - Pick every destructible within 150.00 of loc and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Current life of (Picked destructible)) Greater than 0.00
Then - 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
Destructible - Kill (Picked destructible)
Else - Actions
Unit - Order harvester to Stop
Else - Actions
Else - Actions
-------- Damage the target --------
Unit - Cause (Load i of 1 in Hook_Hashtable) to damage (Load i of 0 in Hook_Hashtable), dealing (Load 6 of i from Hook_Hashtable) damage of attack type Spells and damage type Normal
-------- Unstuck it --------
Set u = (Load i of 0 in Hook_Hashtable)
Unit - Order u to Stop
-------- Remove any leaks --------
Unit Group - Remove (Picked unit) from Hook_Heads
Hashtable - Clear all child hashtables of child i in Hook_Hashtable
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Hook_Heads is empty) Equal to True
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
Events
Unit - A unit Dies
Conditions
(Unit-type of (Triggering unit)) Equal to Hook_Dummy
Actions
-------- We don't want the unit but we want the death effect so we wait until the effect is over and remove the unit after that --------
EDIT: in the loop (one of your first actions) but i don't know if you have done this somewhere else
-------- This basicly is the same as "Move unit to (position of this unit) offset by (distance) towards (angle between this unit and the target)" --------
-------- Except this is enhanced with JASS --------
Set r = (Load 2 of i from Hook_Hashtable)
Set u = (Load i of 0 in Hook_Hashtable)
Custom script: set udg_x = GetUnitX(GetEnumUnit())
Custom script: set udg_y = GetUnitY(GetEnumUnit())
unitgroupARRAYS screw up cause only the first one is created on default
so all other array slots have to be initialized with
JASS:
set udg_GroupArray[udg_i] = CreateGroup()
however in this case there might appear a "bug" with bj_wantDestroyGroup which would destroy the group as soon as it's used so you have to set it to false first
also thanks for all the comments everyone
@hellgate
I want to load the target and not the first group segment so it's correct
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.