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!
The following trigger should recognize if a specific unit is in range, and if yes, just extend the Timed Life of units within the group.
However, the created group which I use to check if someone is in range is always empty, even though the AA_Point[1] literally contains >100 units of this type. This results in the trigger creating 1 Spectral Dagger (Shadow) at AA_PointTemp[1] over and over.
I believe the problem is with the function "unit-type of matching unit equal to XXX". I do not see any mistake here, but maybe I'm handing the function wrong. Can anyone help please?
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(AA_GroupHitHero[AA_Integer] is empty) Equal to False
Then - Actions
Unit Group - Pick every unit in AA_GroupHitHero[AA_Integer] and do (Actions)
Loop - Actions
Set VariableSet AA_Unit = (Picked unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(AA_Unit is alive) Equal to True
Then - Actions
Set VariableSet AA_PointTemp[1] = (Position of AA_Unit)
Custom script: set udg_AA_GroupShadowCheck = CreateGroup()
Set VariableSet AA_GroupShadowCheck = (Units within 120.00 of AA_PointTemp[1] matching ((Unit-type of (Matching unit)) Equal to Spectral Dagger (Shadow)).)
Game - Display to (All players) the text: (String((Number of units in AA_GroupShadowCheck)))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in AA_GroupShadowCheck) Equal to 0
Then - Actions
Game - Display to (All players) the text: Nothing found - Cre...
Unit - Create 1 Spectral Dagger (Shadow) for (Owner of AA_Caster[AA_Integer]) at AA_PointTemp[1] facing Default building facing degrees
Set VariableSet AA_Dummy = (Last created unit)
Ability - Set Ability: (Unit: AA_Dummy's Ability with Ability Code: Spectral Dagger (Self))'s Real Level Field: Movement Speed Increase (%) ('Oae1') of Level: 0 to AA_Speed[AA_Integer]
Ability - Set Ability: (Unit: AA_Dummy's Ability with Ability Code: Spectral Dagger (Enemies))'s Real Level Field: Movement Speed Factor ('Slo1') of Level: 0 to AA_Slow[AA_Integer]
Unit - Add a 7.00 second Generic expiration timer to AA_Dummy
Else - Actions
Unit Group - Pick every unit in AA_GroupShadowCheck and do (Actions)
Loop - Actions
Game - Display to (All players) the text: Found - extend life
Set VariableSet AA_UnitTemp = (Picked unit)
Unit - Cancel Timed Life for AA_UnitTemp
Unit - Add a 7.00 second Generic expiration timer to AA_UnitTemp
It's a quite a long trigger (possibly the longest I've ever done), but please see below. The skill I'm replicating is Spectra Dagger from Dota Spectre
There are 3 main parts:
Set up: The important part here is to distinguish if a unit or point has been selected
The loop: Based on what was done in #1, two different pats are chosen. Here is also where my problem arises, within "CHECK IF MORE SHADOW PATHS NEEDED"
Used to turn on / off the collision of the caster while in the Shadow Path
Spectral Dagger
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Spectral Dagger
Actions
Set VariableSet AA_Index = (AA_Index + 1)
Set VariableSet AA_Caster[AA_Index] = (Triggering unit)
Set VariableSet AA_Damage[AA_Index] = (20.00 + (55.00 x (Real((Level of Spectral Dagger for AA_Caster[AA_Index])))))
Set VariableSet AA_Speed[AA_Index] = (0.06 + (0.04 x (Real((Level of Spectral Dagger for AA_Caster[AA_Index])))))
Set VariableSet AA_Slow[AA_Index] = (-0.06 - (0.04 x (Real((Level of Spectral Dagger for AA_Caster[AA_Index])))))
Set VariableSet AA_Counter[AA_Index] = 0.00
Set VariableSet AA_CounterInteger[AA_Index] = 0
Set VariableSet AA_BooleanHit[AA_Index] = False
-------- --------
Set VariableSet AA_Point[AA_Index] = (Position of AA_Caster[AA_Index])
-------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Target unit of ability being cast) Equal to No unit
Then - Actions
Game - Display to (All players) the text: Point
Set VariableSet AA_BooleanTarget[AA_Index] = False
Set VariableSet AA_Boolean[AA_Index] = False
Set VariableSet AA_PointTemp[1] = (Target point of ability being cast)
Set VariableSet AA_Distance[AA_Index] = 0.00
Else - Actions
Game - Display to (All players) the text: Target Unit
Set VariableSet AA_BooleanTarget[AA_Index] = True
Set VariableSet AA_Target[AA_Index] = (Target unit of ability being cast)
Set VariableSet AA_PointTemp[1] = (Position of AA_Target[AA_Index])
-------- --------
Set VariableSet AA_Angle[AA_Index] = (Angle from AA_Point[AA_Index] to AA_PointTemp[1])
-------- --------
Unit - Create 1 Spectral Dagger (Shadow) for (Owner of AA_Caster[AA_Index]) at AA_Point[AA_Index] facing Default building facing degrees
Set VariableSet AA_Dummy = (Last created unit)
Unit - Add Marker (Main Shadow Path) to AA_Dummy
Ability - Set Ability: (Unit: AA_Dummy's Ability with Ability Code: Spectral Dagger (Self))'s Real Level Field: Movement Speed Increase (%) ('Oae1') of Level: 0 to AA_Speed[AA_Index]
Ability - Set Ability: (Unit: AA_Dummy's Ability with Ability Code: Spectral Dagger (Enemies))'s Real Level Field: Movement Speed Factor ('Slo1') of Level: 0 to AA_Slow[AA_Index]
Unit - Add a 12.00 second Generic expiration timer to AA_Dummy
Unit Group - Add AA_Dummy to SpectralDagger_Shadow_Group
-------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
AA_BooleanTarget[AA_Index] Equal to True
Then - Actions
Unit - Create 1 Spectral Dagger (Projectile) for (Owner of AA_Caster[AA_Index]) at AA_Point[AA_Index] facing AA_Angle[AA_Index] degrees
Set VariableSet AA_MissileUnit[AA_Index] = (Last created unit)
Unit - Add Crow Form to AA_MissileUnit[AA_Index]
Unit - Remove Crow Form from AA_MissileUnit[AA_Index]
Animation - Change AA_MissileUnit[AA_Index] flying height to 125.00 at 0.00
Custom script: set udg_AA_GroupHit[udg_AA_Index] = CreateGroup()
Custom script: set udg_AA_GroupHitHero[udg_AA_Index] = CreateGroup()
-------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
AA_Index Equal to 1
Then - Actions
Game - Display to (All players) the text: ON
Countdown Timer - Start AA_Timer as a Repeating timer that will expire in 0.03 seconds
Trigger - Turn on Spectral Dagger Collision <gen>
Trigger - Turn on Spectral Dagger Loop <gen>
Else - Actions
Spectral Dagger Loop
Events
Time - AA_Timer expires
Conditions
Actions
For each (Integer AA_Integer) from 1 to AA_Index, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
AA_BooleanHit[AA_Integer] Equal to False
Then - Actions
-------- AS LONG AS NO HIT, MOVE THE DAGGER --------
-------- BASED ON TARGET CHOSEN, A DIFFERENT PATH IS TAKEN --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
AA_BooleanTarget[AA_Integer] Equal to False
Then - Actions
-------- --------
-------- TARGET = POINT --------
-------- --------
Set VariableSet AA_Distance[AA_Integer] = (AA_Distance[AA_Integer] + 40.00)
Set VariableSet AA_PointTemp[1] = (AA_Point[AA_Integer] offset by AA_Distance[AA_Integer] towards AA_Angle[AA_Integer] degrees.)
Set VariableSet AA_Pos_X = (X of AA_PointTemp[1])
Set VariableSet AA_Pos_Y = (Y of AA_PointTemp[1])
Custom script: set udg_AA_Boolean_Map = IsPointInMap(udg_AA_Pos_X, udg_AA_Pos_Y)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
AA_Boolean_Map Equal to True
Then - Actions
Custom script: set udg_AA_Z = GetLocationZ(udg_AA_PointTemp[1])
Special Effect - Set Position of AA_MissileSFX[AA_Integer] to x: (X of AA_PointTemp[1]), y: (Y of AA_PointTemp[1]), z: (AA_Z + 125.00)
-------- --------
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units within 125.00 of AA_PointTemp[1].) and do (Actions)
Loop - Actions
Set VariableSet AA_Unit = (Picked unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(AA_Unit is alive) Equal to True
(AA_Unit is A structure) Equal to False
(AA_Unit is Magic Immune) Equal to False
(AA_Unit belongs to an enemy of (Owner of AA_Caster[AA_Integer]).) Equal to True
(AA_Unit is in AA_GroupHit[AA_Integer].) Equal to False
Then - Actions
Unit Group - Add AA_Unit to AA_GroupHit[AA_Integer]
Sound - Play SpectralDagger <gen> at 100.00% volume, attached to AA_Unit
Unit - Cause AA_Caster[AA_Integer] to damage AA_Unit, dealing AA_Damage[AA_Integer] damage of attack type Spells and damage type Magic
-------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(AA_Unit is A Hero) Equal to True
Then - Actions
Game - Display to (All players) the text: Hero Hit
Unit Group - Add AA_Unit to AA_GroupHitHero[AA_Integer]
Else - Actions
Else - Actions
Else - Actions
Set VariableSet AA_Boolean[AA_Integer] = True
-------- --------
Set VariableSet AA_CounterInteger[AA_Integer] = (AA_CounterInteger[AA_Integer] + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(AA_CounterInteger[AA_Integer] mod 3) Equal to 0
Then - Actions
Unit - Create 1 Spectral Dagger (Shadow) for (Owner of AA_Caster[AA_Integer]) at AA_PointTemp[1] facing Default building facing degrees
Set VariableSet AA_Dummy = (Last created unit)
Unit - Add Marker (Main Shadow Path) to AA_Dummy
Ability - Set Ability: (Unit: AA_Dummy's Ability with Ability Code: Spectral Dagger (Self))'s Real Level Field: Movement Speed Increase (%) ('Oae1') of Level: 0 to AA_Speed[AA_Integer]
Ability - Set Ability: (Unit: AA_Dummy's Ability with Ability Code: Spectral Dagger (Enemies))'s Real Level Field: Movement Speed Factor ('Slo1') of Level: 0 to AA_Slow[AA_Integer]
Unit - Add a 12.00 second Generic expiration timer to AA_Dummy
Unit Group - Add AA_Dummy to SpectralDagger_Shadow_Group
Unit Group - Pick every unit in (Units within 125.00 of AA_PointTemp[3].) and do (Actions)
Loop - Actions
Set VariableSet AA_Unit = (Picked unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(AA_Unit is alive) Equal to True
(AA_Unit is A structure) Equal to False
(AA_Unit is Magic Immune) Equal to False
(AA_Unit belongs to an enemy of (Owner of AA_Caster[AA_Integer]).) Equal to True
(AA_Unit is in AA_GroupHit[AA_Integer].) Equal to False
Then - Actions
Unit Group - Add AA_Unit to AA_GroupHit[AA_Integer]
Sound - Play SpectralDagger <gen> at 100.00% volume, attached to AA_Unit
Unit - Cause AA_Caster[AA_Integer] to damage AA_Unit, dealing AA_Damage[AA_Integer] damage of attack type Spells and damage type Magic
-------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(AA_Unit is A Hero) Equal to True
Then - Actions
Game - Display to (All players) the text: Hero Hit
Unit Group - Add AA_Unit to AA_GroupHitHero[AA_Integer]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
AA_Unit Equal to AA_Target[AA_Integer]
Then - Actions
-------- HIT --------
Set VariableSet AA_BooleanHit[AA_Integer] = True
Unit - Kill AA_MissileUnit[AA_Integer]
Else - Actions
Else - Actions
-------- --------
Set VariableSet AA_CounterInteger[AA_Integer] = (AA_CounterInteger[AA_Integer] + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(AA_CounterInteger[AA_Integer] mod 3) Equal to 0
Then - Actions
Unit - Create 1 Spectral Dagger (Shadow) for (Owner of AA_Caster[AA_Integer]) at AA_PointTemp[3] facing Default building facing degrees
Set VariableSet AA_Dummy = (Last created unit)
Unit - Add Marker (Main Shadow Path) to AA_Dummy
Ability - Set Ability: (Unit: AA_Dummy's Ability with Ability Code: Spectral Dagger (Self))'s Real Level Field: Movement Speed Increase (%) ('Oae1') of Level: 0 to AA_Speed[AA_Integer]
Ability - Set Ability: (Unit: AA_Dummy's Ability with Ability Code: Spectral Dagger (Enemies))'s Real Level Field: Movement Speed Factor ('Slo1') of Level: 0 to AA_Slow[AA_Integer]
Unit - Add a 12.00 second Generic expiration timer to AA_Dummy
Unit Group - Add AA_Dummy to SpectralDagger_Shadow_Group
Set VariableSet AA_Counter[AA_Integer] = (AA_Counter[AA_Integer] + 0.03)
-------- --------
-------- CHECK IF MORE SHADOW PATHS NEEDED --------
-------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(AA_GroupHitHero[AA_Integer] is empty) Equal to False
Then - Actions
Unit Group - Pick every unit in AA_GroupHitHero[AA_Integer] and do (Actions)
Loop - Actions
Set VariableSet AA_Unit = (Picked unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(AA_Unit is alive) Equal to True
Then - Actions
Set VariableSet AA_PointTemp[1] = (Position of AA_Unit)
Custom script: set udg_AA_GroupShadowCheck = CreateGroup()
Set VariableSet AA_GroupShadowCheck = (Units within 120.00 of AA_PointTemp[1] matching ((Unit-type of (Matching unit)) Equal to Spectral Dagger (Shadow)).)
Game - Display to (All players) the text: (String((Number of units in AA_GroupShadowCheck)))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(AA_GroupShadowCheck is empty) Equal to True
Then - Actions
Game - Display to (All players) the text: Nothing found - Cre...
Unit - Create 1 Spectral Dagger (Shadow) for (Owner of AA_Caster[AA_Integer]) at AA_PointTemp[1] facing Default building facing degrees
Set VariableSet AA_Dummy = (Last created unit)
Ability - Set Ability: (Unit: AA_Dummy's Ability with Ability Code: Spectral Dagger (Self))'s Real Level Field: Movement Speed Increase (%) ('Oae1') of Level: 0 to AA_Speed[AA_Integer]
Ability - Set Ability: (Unit: AA_Dummy's Ability with Ability Code: Spectral Dagger (Enemies))'s Real Level Field: Movement Speed Factor ('Slo1') of Level: 0 to AA_Slow[AA_Integer]
Unit - Add a 7.00 second Generic expiration timer to AA_Dummy
Unit Group - Add AA_Dummy to SpectralDagger_Shadow_Group
Else - Actions
Unit Group - Pick every unit in AA_GroupShadowCheck and do (Actions)
Loop - Actions
Game - Display to (All players) the text: Found - extend life
Set VariableSet AA_UnitTemp = (Picked unit)
Unit - Cancel Timed Life for AA_UnitTemp
Unit - Add a 7.00 second Generic expiration timer to AA_UnitTemp
Does Spectral Dagger (Shadow) have the locust ability? Or are they hidden by triggers? Both will prevent them from being detected by area searches like Units within 120.00 of AA_PointTemp[1] matching. Both the locust ability and hiding units by trigger will remove them from area search logic such as that function. They can still be detected by player unit searches, or if referenced directly.
If the daggers are part of the ability (not coming from other sources) then you can track them as part of the ability state and then check their position using a standard distance between points checks. In theory you could do this for all units matching the appropriate type owned by the player but that suffers scaling issues, especially if the player owns a lot of units (should be fine if just a single hero like a MOBA or RPG).
Thanks a lot, I adjusted it (can this be done more efficiently?). But there is a problem: I believe "Cancel Timed Life for Unit" is bugged...?
Instead of removing the timed life, it simply kills the unit. So currently, as soon as a Spectral Dagger (Shadow) matches the condition for being "within less than 120 range" (see below), it kills the Spectral Dagger (Shadow). Instead, I want such a unit to have its timed life reset to 7 seconds.
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(AA_GroupHitHero[AA_Integer] is empty) Equal to False
Then - Actions
Unit Group - Pick every unit in AA_GroupHitHero[AA_Integer] and do (Actions)
Loop - Actions
Set VariableSet AA_Unit = (Picked unit)
Set VariableSet AA_DistanceCheck[1] = 120.00
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(AA_Unit is alive) Equal to True
Then - Actions
Set VariableSet AA_PointTemp[1] = (Position of AA_Unit)
Unit Group - Pick every unit in AA_GroupShadow and do (Actions)
Loop - Actions
Set VariableSet AA_UnitTemp = (Picked unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of AA_UnitTemp) Equal to (Owner of AA_Caster[AA_Integer])
Then - Actions
Set VariableSet AA_PointTemp[2] = (Position of AA_UnitTemp)
Set VariableSet AA_DistanceCheck[2] = (Distance between AA_PointTemp[1] and AA_PointTemp[2])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
AA_DistanceCheck[2] Less than 120.00
Then - Actions
Game - Display to (All players) the text: Found - extend life
Unit - Cancel Timed Life for AA_UnitTemp
Unit - Add a 7.00 second Generic expiration timer to AA_UnitTemp
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
AA_DistanceCheck[2] Less than AA_DistanceCheck[1]
Then - Actions
Set VariableSet AA_DistanceCheck[1] = AA_Distance[2]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
AA_DistanceCheck[1] Greater than or equal to 120.00
Then - Actions
Game - Display to (All players) the text: Nothing found - Cre...
Unit - Create 1 Spectral Dagger (Shadow) for (Owner of AA_Caster[AA_Integer]) at AA_PointTemp[1] facing Default building facing degrees
Set VariableSet AA_Dummy = (Last created unit)
Ability - Set Ability: (Unit: AA_Dummy's Ability with Ability Code: Spectral Dagger (Self))'s Real Level Field: Movement Speed Increase (%) ('Oae1') of Level: 0 to AA_Speed[AA_Integer]
Ability - Set Ability: (Unit: AA_Dummy's Ability with Ability Code: Spectral Dagger (Enemies))'s Real Level Field: Movement Speed Factor ('Slo1') of Level: 0 to AA_Slow[AA_Integer]
Unit - Add a 7.00 second Generic expiration timer to AA_Dummy
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.