[Spell] How do I make this spell to only knockback enemies?

Level 13
Joined
Jul 19, 2007
Messages
652
I have imported a spell named "Shade Shield" into my map and it works like this
"The hero creates around him 4 black arrows that rotates around him and if that arrow collide with a unit it will deal 100/200/300 damage and knocks that unit for 200/300/400 distance away, the sheilds last 8 seconds at all levels."
but the problem is that is seems to knockback everything in their way, even buildings! How do I make it to only knockback enemies and NOT buildings or magic immune units?
  • Shade Sheild On
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Spirit Shield
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SS_Skip Equal to 0
        • Then - Actions
          • Trigger - Turn on Shade Sheild Loop <gen>
        • Else - Actions
      • Set VariableSet SS_LEVEL = (Level of Spirit Shield for (Casting unit))
      • Set VariableSet Sheild_How_Many = 4
      • Set VariableSet SS_Number[1] = (360.00 / (Real(Sheild_How_Many)))
      • Set VariableSet SS_Number[2] = SS_Number[1]
      • For each (Integer A) from 1 to Sheild_How_Many, do (Actions)
        • Loop - Actions
          • Set VariableSet SS_Times = (SS_Times + 1)
          • Set VariableSet SS_Skip = (SS_Skip + 1)
          • Set VariableSet SS_Rotate_Off[SS_Times] = True
          • Set VariableSet SS_Knockback_Off[SS_Times] = False
          • -------- ----------------------------------------------------------------------------------------------------------- --------
          • Set VariableSet SS_Hero[SS_Times] = (Casting unit)
          • Set VariableSet SS_Point[1] = (Position of SS_Hero[SS_Times])
          • Set VariableSet SS_Point[2] = (SS_Point[1] offset by 165.00 towards SS_Number[2] degrees.)
          • -------- ----------------------------------------------------------------------------------------------------------- --------
          • Unit - Create 1 Dummy X for (Owner of SS_Hero[SS_Times]) at SS_Point[2] facing ((Angle from SS_Point[1] to SS_Point[2]) + 90.00) degrees
          • Set VariableSet SS_Dummy[SS_Times] = (Last created unit)
          • Special Effect - Create a special effect attached to the chest of SS_Dummy[SS_Times] using Abilities\Spells\NightElf\SpiritOfVengeance\SpiritOfVengeanceBirthMissile.mdl
          • Set VariableSet SS_Special[SS_Times] = (Last created special effect)
          • -------- ----------------------------------------------------------------------------------------------------------- --------
          • Set VariableSet SS_Angle[SS_Times] = SS_Number[2]
          • Set VariableSet SS_Angle_Speed_Rotation[SS_Times] = 6.00
          • Set VariableSet SS_Countdown[SS_Times] = 267
          • -------- ----------------------------------------------------------------------------------------------------------- --------
          • Set VariableSet SS_Damage[SS_Times] = (100.00 x (Real(SS_LEVEL)))
          • Set VariableSet SS_Distance[SS_Times] = (SS_Damage[SS_Times] + 100.00)
          • Set VariableSet SS_Speed[SS_Times] = 15.00
          • Set VariableSet SS_Formula[SS_Times] = (SS_Distance[SS_Times] / SS_Speed[SS_Times])
          • -------- ----------------------------------------------------------------------------------------------------------- --------
          • Set VariableSet SS_Number[2] = (SS_Number[2] + SS_Number[1])
          • Custom script: call RemoveLocation(udg_SS_Point[1])
          • Custom script: call RemoveLocation(udg_SS_Point[2])
      • Set VariableSet SS_LEVEL = 0
      • Set VariableSet Sheild_How_Many = 0
      • Set VariableSet SS_Number[1] = 0.00
      • Set VariableSet SS_Number[2] = 0.00
  • Shade Sheild Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer SS) from 1 to SS_Times, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SS_Rotate_Off[SS] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SS_Countdown[SS] Equal to 0
                • Then - Actions
                  • Set VariableSet SS_Rotate_Off[SS] = False
                  • Set VariableSet SS_Skip = (SS_Skip - 1)
                  • -------- ----------------------------------------------------------------------------------------------------------- --------
                  • Special Effect - Destroy SS_Special[SS]
                  • Unit - Add a 0.03 second Generic expiration timer to SS_Dummy[SS]
                  • Set VariableSet SS_Dummy[SS] = No unit
                  • -------- ----------------------------------------------------------------------------------------------------------- --------
                  • Set VariableSet SS_Angle[SS] = 0.00
                  • Set VariableSet SS_Countdown[SS] = 0
                  • Set VariableSet SS_Angle_Speed_Rotation[SS] = 0.00
                  • Set VariableSet SS_Damage[SS] = 0.00
                  • Set VariableSet SS_Distance[SS] = 0.00
                  • Set VariableSet SS_Speed[SS] = 0.00
                  • Set VariableSet SS_Formula[SS] = 0.00
                  • Set VariableSet SS_Hero[SS] = No unit
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • SS_Skip Equal to 0
                    • Then - Actions
                      • Set VariableSet SS_Times = 0
                      • Trigger - Turn off Shade Sheild Loop <gen>
                    • Else - Actions
                • Else - Actions
                  • Set VariableSet SS_Countdown[SS] = (SS_Countdown[SS] - 1)
                  • -------- ----------------------------------------------------------------------------------------------------------- --------
                  • Set VariableSet SS_Point[3] = (Position of SS_Hero[SS])
                  • Set VariableSet SS_Point[4] = (SS_Point[3] offset by 165.00 towards SS_Angle[SS] degrees.)
                  • Unit - Move SS_Dummy[SS] instantly to SS_Point[4], facing ((Angle from SS_Point[3] to SS_Point[4]) + 90.00) degrees
                  • Set VariableSet SS_Angle[SS] = (SS_Angle[SS] + SS_Angle_Speed_Rotation[SS])
                  • -------- ----------------------------------------------------------------------------------------------------------- --------
                  • Set VariableSet SS_Group[SS] = (Units within 65.00 of SS_Point[4] matching (((Owner of (Matching unit)) Not equal to (Owner of SS_Hero[SS])) and (((Matching unit) is alive) Equal to True)).)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in SS_Group[SS]) Greater than or equal to 1
                    • Then - Actions
                      • Unit Group - Pick every unit in SS_Group[SS] and do (Actions)
                        • Loop - Actions
                          • Set VariableSet SS_Rotate_Off[SS] = False
                          • Set VariableSet SS_Knockback_Off[SS] = True
                          • -------- ----------------------------------------------------------------------------------------------------------- --------
                          • Special Effect - Destroy SS_Special[SS]
                          • Unit - Add a 0.03 second Generic expiration timer to SS_Dummy[SS]
                          • Set VariableSet SS_Dummy[SS] = No unit
                          • Special Effect - Create a special effect at SS_Point[4] using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • -------- ----------------------------------------------------------------------------------------------------------- --------
                          • Set VariableSet SS_Unit[SS] = (Picked unit)
                          • Unit - Cause SS_Hero[SS] to damage SS_Unit[SS], dealing SS_Damage[SS] damage of attack type Spells and damage type Magic
                          • Special Effect - Create a special effect attached to the chest of SS_Unit[SS] using Abilities\Spells\NightElf\SpiritOfVengeance\SpiritOfVengeanceBirthMissile.mdl
                          • Set VariableSet SS_Special[SS] = (Last created special effect)
                          • Set VariableSet SS_Angle[SS] = (SS_Angle[SS] + 90.00)
                          • Set VariableSet SS_Countdown[SS] = 0
                          • -------- ----------------------------------------------------------------------------------------------------------- --------
                          • Set VariableSet SS_Angle_Speed_Rotation[SS] = 0.00
                          • Set VariableSet SS_Damage[SS] = 0.00
                          • Set VariableSet SS_Hero[SS] = No unit
                          • -------- ----------------------------------------------------------------------------------------------------------- --------
                    • Else - Actions
                  • Custom script: call DestroyGroup(udg_SS_Group[udg_SS])
                  • -------- ----------------------------------------------------------------------------------------------------------- --------
                  • Custom script: call RemoveLocation(udg_SS_Point[3])
                  • Custom script: call RemoveLocation(udg_SS_Point[4])
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SS_Knockback_Off[SS] Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • SS_Distance[SS] Less than or equal to 0.00
                          • (SS_Unit[SS] is dead) Equal to True
                    • Then - Actions
                      • Set VariableSet SS_Knockback_Off[SS] = False
                      • Set VariableSet SS_Skip = (SS_Skip - 1)
                      • -------- ----------------------------------------------------------------------------------------------------------- --------
                      • Special Effect - Destroy SS_Special[SS]
                      • Set VariableSet SS_Unit[SS] = No unit
                      • -------- ----------------------------------------------------------------------------------------------------------- --------
                      • Set VariableSet SS_Angle[SS] = 0.00
                      • Set VariableSet SS_Countdown[SS] = 0
                      • Set VariableSet SS_Distance[SS] = 0.00
                      • Set VariableSet SS_Speed[SS] = 0.00
                      • Set VariableSet SS_Formula[SS] = 0.00
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • SS_Skip Equal to 0
                        • Then - Actions
                          • Set VariableSet SS_Times = 0
                          • Trigger - Turn off Shade Sheild Loop <gen>
                        • Else - Actions
                    • Else - Actions
                      • -------- ----------------------------------------------------------------------------------------------------------- --------
                      • Set VariableSet SS_Point[5] = (Position of SS_Unit[SS])
                      • Set VariableSet SS_Speed[SS] = (SS_Distance[SS] / SS_Formula[SS])
                      • Set VariableSet SS_Speed[SS] = (SS_Speed[SS] + 1.00)
                      • Set VariableSet SS_Point[6] = (SS_Point[5] offset by SS_Speed[SS] towards SS_Angle[SS] degrees.)
                      • Unit - Move SS_Unit[SS] instantly to SS_Point[6]
                      • Set VariableSet SS_Countdown[SS] = (SS_Countdown[SS] + 1)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • SS_Countdown[SS] Equal to 4
                        • Then - Actions
                          • Special Effect - Create a special effect at SS_Point[5] using Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
                          • Special Effect - Destroy (Last created special effect)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • SS_Countdown[SS] Equal to 6
                            • Then - Actions
                              • Set VariableSet SS_Countdown[SS] = 0
                              • Special Effect - Create a special effect at SS_Point[5] using Abilities\Spells\NightElf\SpiritOfVengeance\SpiritOfVengeanceBirthMissile.mdl
                              • Special Effect - Destroy (Last created special effect)
                            • Else - Actions
                      • Destructible - Pick every destructible within 150.00 of SS_Point[6] and do (Destructible - Kill (Picked destructible))
                      • Custom script: call RemoveLocation(udg_SS_Point[5])
                      • Custom script: call RemoveLocation(udg_SS_Point[6])
                      • -------- ----------------------------------------------------------------------------------------------------------- --------
                      • Set VariableSet SS_Distance[SS] = (SS_Distance[SS] - SS_Speed[SS])
                • Else - Actions
 
Level 23
Joined
Feb 9, 2009
Messages
1,763
upload_2020-10-15_14-58-16.png


But I'd honestly put in inside the unit group check and use conditions instead of that mess.
Example would be in my Necrotic Beam resource:
upload_2020-10-15_15-0-44.png
 

Attachments

  • upload_2020-10-15_15-0-9.png
    upload_2020-10-15_15-0-9.png
    55.8 KB · Views: 23
Level 12
Joined
Feb 27, 2019
Messages
301
Thank you it works! Btw there is another problem. How can I make the knockback-effect to NOT destroy trees?
Probably just remove this action. You can disable it first and run a test.
  • Destructible - Pick every destructible within 150.00 of SS_Point[6] and do (Destructible - Kill (Picked destructible))
 
Top