- Joined
- Sep 3, 2020
- Messages
- 6
How can I make a spell that damages(or effects in anyway) only undead units? For example I want a crushing wave spell that instantly kills any undead units in front of it, but does no harm to living enemies.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Custom Shockwave Cast

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Custom Shockwave

Actions


-------- Increase the Index --------


Set VariableSet SW_Index = (SW_Index + 1)


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


-------- Set Caster --------


Set VariableSet SW_Caster[SW_Index] = (Triggering unit)


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


-------- Set Points --------


Set VariableSet SW_Point[SW_Index] = (Position of SW_Caster[SW_Index])


Set VariableSet SW_Point[0] = (Target point of ability being cast)


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


-------- Create Special Effect --------


Special Effect - Create a special effect at SW_Point[SW_Index] using Abilities\Spells\Orc\Shockwave\ShockwaveMissile.mdl


Set VariableSet SW_Missile[SW_Index] = (Last created special effect)


Special Effect - Set Scale of SW_Missile[SW_Index] to 1.00


Set VariableSet SW_Angle[SW_Index] = (Angle from SW_Point[SW_Index] to SW_Point[0])


Special Effect - Set Yaw of SW_Missile[SW_Index] to: (SW_Angle[SW_Index] x (Pi / 180.00))


Custom script: call RemoveLocation (udg_SW_Point[0])


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


-------- ======================================== --------


-------- CONFIGURE Settings: --------


Set VariableSet SW_Damage[SW_Index] = 100.00


Set VariableSet SW_DamageType[SW_Index] = Magic


Set VariableSet SW_AttackType[SW_Index] = Spells


Set VariableSet SW_Speed[SW_Index] = 25.00


Set VariableSet SW_Height[SW_Index] = 60.00


Set VariableSet SW_AoE[SW_Index] = 200.00


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


-------- Counter is increased by 1 every 0.03 seconds. Once this Counter reaches SW_CounterMax the missile is destroyed --------


-------- By default I set CounterMax to 40, which is equal to 1.20 seconds ---> 0.03 * 40 = 1.20 --------


Set VariableSet SW_CounterMax[SW_Index] = 40


-------- ======================================== --------


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


-------- Apply Some Final Settings --------


Set VariableSet SW_Counter[SW_Index] = 0


Set VariableSet SW_Distance[SW_Index] = 0.00


Special Effect - Set Height of SW_Missile[SW_Index] to: ((Position - Z of SW_Missile[SW_Index].) + SW_Height[SW_Index])


Custom script: set udg_SW_HitGroup[udg_SW_Index] = CreateGroup()


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


-------- Start Timer (If it's currently off) --------


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



If - Conditions




SW_Index Equal to 1



Then - Actions




Countdown Timer - Start SW_Timer as a Repeating timer that will expire in 0.03 seconds



Else - Actions
Custom Shockwave Timer

Events


Time - SW_Timer expires

Conditions

Actions


For each (Integer SW_Loop) from 1 to SW_Index, do (Actions)



Loop - Actions




-------- Increase the Distance traveled and move the Shockwave Special Effect --------




Set VariableSet SW_Distance[SW_Loop] = (SW_Distance[SW_Loop] + SW_Speed[SW_Loop])




Set VariableSet SW_Point[0] = (SW_Point[SW_Loop] offset by SW_Distance[SW_Loop] towards SW_Angle[SW_Loop] degrees.)




Custom script: set udg_SW_Z = GetLocationZ(udg_SW_Point[0])




Special Effect - Set Position of SW_Missile[SW_Loop] to x: (X of SW_Point[0]), y: (Y of SW_Point[0]), z: (SW_Z + SW_Height[SW_Loop])




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




-------- ======================================== --------




-------- Search for units around the Shockwave and deal Damage (You could add other effects here besides damage) --------




Custom script: set bj_wantDestroyGroup = true




Unit Group - Pick every unit in (Units within SW_AoE[SW_Loop] of SW_Point[0].) and do (Actions)





Loop - Actions






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







If - Conditions








((Picked unit) belongs to an enemy of (Owner of SW_Caster[SW_Index]).) Equal to True








((Picked unit) is alive) Equal to True








((Picked unit) is A ground unit) Equal to True








((Picked unit) is Magic Immune) Equal to False








((Picked unit) is hidden) Equal to False








((Picked unit) is invulnerable) Equal to False








((Picked unit) is in SW_HitGroup[SW_Loop].) Equal to False







Then - Actions








Unit Group - Add (Picked unit) to SW_HitGroup[SW_Loop]








Unit - Cause SW_Caster[SW_Loop] to damage (Picked unit), dealing SW_Damage[SW_Loop] damage of attack type SW_AttackType[SW_Loop] and damage type SW_DamageType[SW_Loop]







Else - Actions




Custom script: call RemoveLocation (udg_SW_Point[0])




-------- ======================================== --------




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




-------- Increase Counter --------




Set VariableSet SW_Counter[SW_Loop] = (SW_Counter[SW_Loop] + 1)




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




-------- Check if the Shockwave is finished (Counter is equal to CounterMax) --------




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





If - Conditions






SW_Counter[SW_Loop] Equal to SW_CounterMax[SW_Loop]





Then - Actions






-------- Destroy the Missile/Missile Point/Hit Group --------






Special Effect - Destroy SW_Missile[SW_Loop]






Custom script: call RemoveLocation (udg_SW_Point[udg_SW_Loop])






Custom script: call DestroyGroup (udg_SW_HitGroup[udg_SW_Loop])






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






-------- Adjust Index/Loop Variables (Explained: https://www.hiveworkshop.com/threads/visualize-dynamic-indexing.241896/) --------






Set VariableSet SW_Caster[SW_Loop] = SW_Caster[SW_Index]






Set VariableSet SW_Point[SW_Loop] = SW_Point[SW_Index]






Set VariableSet SW_Angle[SW_Loop] = SW_Angle[SW_Index]






Set VariableSet SW_Missile[SW_Loop] = SW_Missile[SW_Index]






Set VariableSet SW_Speed[SW_Loop] = SW_Speed[SW_Index]






Set VariableSet SW_Height[SW_Loop] = SW_Height[SW_Index]






Set VariableSet SW_Counter[SW_Loop] = SW_Counter[SW_Index]






Set VariableSet SW_CounterMax[SW_Loop] = SW_CounterMax[SW_Loop]






Set VariableSet SW_Distance[SW_Loop] = SW_Distance[SW_Index]






Set VariableSet SW_Damage[SW_Loop] = SW_Damage[SW_Index]






Set VariableSet SW_DamageType[SW_Loop] = SW_DamageType[SW_Index]






Set VariableSet SW_AttackType[SW_Loop] = SW_AttackType[SW_Index]






Set VariableSet SW_AoE[SW_Loop] = SW_AoE[SW_Index]






Set VariableSet SW_HitGroup[SW_Loop] = SW_HitGroup[SW_Index]






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






Set VariableSet SW_Index = (SW_Index - 1)






Set VariableSet SW_Loop = (SW_Loop - 1)






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






-------- Turn off the Timer if there are no more Shockwaves --------






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







If - Conditions








SW_Index Equal to 0







Then - Actions








Countdown Timer - Pause SW_Timer







Else - Actions





Else - Actions
Actions

-------- CONFIGURE Settings: --------

Set VariableSet SW_Damage[SW_Index] = 100.00

Set VariableSet SW_DamageType[SW_Index] = Magic

Set VariableSet SW_AttackType[SW_Index] = Spells

Set VariableSet SW_Speed[SW_Index] = 25.00

Set VariableSet SW_Height[SW_Index] = 60.00

Set VariableSet SW_AoE[SW_Index] = 200.00

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

-------- Counter is increased by 1 every 0.03 seconds. Once this Counter reaches SW_CounterMax the missile is destroyed --------

-------- By default I set CounterMax to 40, which is equal to 1.20 seconds ---> 0.03 * 40 = 1.20 --------

Set VariableSet SW_CounterMax[SW_Index] = 40
Unit Group - Pick every unit in (Units within SW_AoE[SW_Loop] of SW_Point[0].) and do (Actions)

Loop - Actions


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



If - Conditions




((Picked unit) belongs to an enemy of (Owner of SW_Caster[SW_Index]).) Equal to True




((Picked unit) is alive) Equal to True




((Picked unit) is A ground unit) Equal to True




((Picked unit) is Magic Immune) Equal to False




((Picked unit) is hidden) Equal to False




((Picked unit) is invulnerable) Equal to False




((Picked unit) is in SW_HitGroup[SW_Loop].) Equal to False



Then - Actions




Unit Group - Add (Picked unit) to SW_HitGroup[SW_Loop]




Unit - Cause SW_Caster[SW_Loop] to damage (Picked unit), dealing SW_Damage[SW_Loop] damage of attack type SW_AttackType[SW_Loop] and damage type SW_DamageType[SW_Loop]



Else - Actions
