Knockback trouble..

Daskunk

SC2 Forum MVP - TheSkunk #386
Reaction score
186
I have a knock back spell that works fine. (Besides lag.)

However, It slides them every 0.01 seconds, and I though it would be best if it was closer to 0.05. I did that, and It worked fine. But then it slides too slow, so I changed the amount it slides them at, and it no longer slides them in the correct directions.

The spell is a Area of effect spell.

Triggger 1:
Code:
Cast Knockback
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Sword Smash
    Actions
        Set SwordsmanP = (Position of (Casting unit))
        Set Unitgroup[6] = (Units within 260.00 of SwordsmanP matching ((Owner of (Matching unit)) Equal to Player 4 (Purple)))
        Unit Group - Pick every unit in Unitgroup[6] and do (Actions)
            Loop - Actions
                Unit Group - Add (Picked unit) to Shove
                Unit - Turn collision for (Picked unit) Off
        Custom script:   call DestroyGroup(udg_Unitgroup[6])
        Wait 0.60 seconds
        Custom script:   call RemoveLocation (udg_SwordsmanP)
        Unit Group - Pick every unit in Shove and do (Actions)
            Loop - Actions
                Unit Group - Remove (Picked unit) from Shove
                Unit - Turn collision for (Picked unit) On

Trigger 2: [ The bolded text is the number that, when changed, ruins the trigger. ]
Code:
Shove Copy Copy 2
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in Shove and do (Actions)
            Loop - Actions
                Set Leak[1] = ((Position of (Picked unit)) offset by [B]4.50[/B] towards (360.00 - (Degrees((Angle from (Position of (Picked unit)) to SwordsmanP)))) degrees)
                Unit - Move (Picked unit) instantly to Leak[1]
                Custom script:   call RemoveLocation (udg_Leak[1])

Trigger 2 After being changed, which does not work:
Code:
Shove Copy Copy 2
    Events
        Time - Every 0.04 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in Shove and do (Actions)
            Loop - Actions
                Set Leak[1] = ((Position of (Picked unit)) offset by 18.00 towards (360.00 - (Degrees((Angle from (Position of (Picked unit)) to SwordsmanP)))) degrees)
                Unit - Move (Picked unit) instantly to Leak[1]
                Custom script:   call RemoveLocation (udg_Leak[1])

I know the triggers are very poorly made, but I cannot see how changing that number makes them not slide correctly. . .
 

Dinowc

don't expect anything, prepare for everything
Reaction score
223
here is my knockback, although a passive one (like Spirit Breaker's)
it's MUI, lagless, leakless

it works just fine

Trigger:
  • Knockback
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Random real number between 1.00 and 100.00) Less than or equal to (<=) Knock_chance[(Level of Knockback for (Attacking unit))]
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Knockback for (Attacking unit)) Greater than or equal to (>=) 1
        • Then - Actions
          • -------- This will make the ability MUI since it will increase by 1 every time the spell effect fires --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Knock_count Less than (<) 1000
            • Then - Actions
              • Set Knock_count = (Knock_count + 1)
            • Else - Actions
              • Set Knock_count = 0
          • -------- With this we will determine the knock distance --------
          • Set Knock_real[Knock_count] = 0.00
          • Set Knocker[Knock_count] = (Attacking unit)
          • Set Knock_target[Knock_count] = (Attacked unit)
          • Unit Group - Add Knock_target[Knock_count] to Knock_group
          • Unit - Set the custom value of Knock_target[Knock_count] to Knock_count
          • Set Knocker_point = (Position of Knocker[Knock_count])
          • Set Knock_point[Knock_count] = (Position of Knock_target[Knock_count])
          • -------- With this we set the actual angle, cause we want the target to slide straight of the attacker --------
          • Set Knock_angle[Knock_count] = (Angle from Knocker_point to Knock_point[Knock_count])
          • Custom script: call RemoveLocation(udg_Knocker_point)
          • Custom script: call RemoveLocation(udg_Knock_point[udg_Knock_count])
          • Unit - Cause Knocker[Knock_count] to damage Knock_target[Knock_count], dealing (25.00 x (Real((Level of Knockback for Knocker[Knock_count])))) damage of attack type Spells and damage type Normal
          • -------- This is everything we need here, now we go to the next trigger --------
        • Else - Actions


Trigger:
  • Knock effect
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
      • (Number of units in Knock_group) Greater than (>) 0
    • Actions
      • Unit Group - Pick every unit in Knock_group and do (Actions)
        • Loop - Actions
          • Set Knock_value = (Custom value of (Picked unit))
          • Set Knock_target[Knock_value] = (Picked unit)
          • -------- This value is not necessary, but it saves you a lot of time --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Knock_real[Knock_value] Less than or equal to (<=) (1.00 + (0.50 x (Real((Level of Knockback for Knocker[Knock_value])))))
            • Then - Actions
              • Set Knock_point[Knock_value] = (Position of Knock_target[Knock_value])
              • -------- We set the point where we want the target to slide --------
              • Set Knock_dist[Knock_value] = (Knock_point[Knock_value] offset by 10.00 towards Knock_angle[Knock_value] degrees)
              • Unit - Move Knock_target[Knock_value] instantly to Knock_dist[Knock_value]
              • -------- For an eye candy, we add a special effect --------
              • Special Effect - Create a special effect attached to the chest of Knock_target[Knock_value] using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
              • Special Effect - Destroy (Last created special effect)
              • Special Effect - Create a special effect attached to the chest of Knock_target[Knock_value] using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
              • Special Effect - Destroy (Last created special effect)
              • -------- To make it look cool, we destroy any destructible the target reaches --------
              • -------- Destructible groups don&#039;t leak so no worries <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite2" alt=";)" title="Wink ;)" loading="lazy" data-shortname=";)" /> --------
              • Destructible - Pick every destructible within 150.00 of Knock_dist[Knock_value] and do (Actions)
                • Loop - Actions
                  • Destructible - Kill (Picked destructible)
              • -------- Remove points to get rid of the leaks --------
              • Custom script: call RemoveLocation(udg_Knock_point[udg_Knock_value])
              • Custom script: call RemoveLocation(udg_Knock_dist[udg_Knock_value])
              • -------- This will count the distance target has covered --------
              • Set Knock_real[Knock_value] = (Knock_real[Knock_value] + 0.10)
            • Else - Actions
              • -------- And when the distance gets to desired value, we stop the knockback effect by removing the target from the group --------
              • Unit Group - Remove Knock_target[Knock_value] from Knock_group


speed depends on Knock_dist offset
distance depends on Knock_real

so you can change those 2 values
 

simonake

New Member
Reaction score
72
Simple but might help

It's based on sliding system
Code:
Events
Unit - Unit start the effect of an ability
Conditions
(Ability being cast) Equal to Sword Smash
Actions
Set tempPoint = Position of unit (Target unit of ability being cast)
For each (Integer A) from 1 to 50, do (Actions)
         Loop Actions -
         Unit - Move (Target unit of ability being cast) to(tempPoint0 offset by 10 towards (Facing of(Casting unit)
         Wait 0.01 seconds.

Then you can add the special effects that you want...
 

Daskunk

SC2 Forum MVP - TheSkunk #386
Reaction score
186
Im not interested in a passive knockback spell like that. I know how to search for premade knockback spells if I need to.
What I want to know is why mine stops working when I made that modification...

But thanks anyways. :)


And its and Area of effect spell based off of thunderclap, if you couldn't tell from the triggers.
 

Dinowc

don't expect anything, prepare for everything
Reaction score
223
Im not interested in a passive knockback spell like that

when you cast the spell, just add the target unit of ability being cast to Knock_group and it will work just fine (but you still need the integer count variable to make it MUI)

And its and Area of effect spell based off of thunderclap, if you couldn't tell from the triggers.

Code:
set caster_pos = position of casting unit
set clap_group = units within x of caster...
pick every unit in clap_group and do actions
   set picked_pos = position of picked unit
   set angle[MUI_count] = angle between caster_pos and picked_pos
   set target[MUI_count] = picked unit
   add picked to Knock_group
   set the custom value of picked unit to MUI_count
   set MUI_count = MUI_count + 1

that's it.. now you have a knocking thunder clap (ignore the leaks, that's not the point here)
you slide the unit based on that angle[] value
if you want I can make it

the Knock_effect trigger is actually universal knockback trigger, you just need to set unit's values, MUI counts and add him to the group and rest will be done

that's how I made the knocking Water form spell (it's included with the map)
 

Daskunk

SC2 Forum MVP - TheSkunk #386
Reaction score
186
when you cast the spell, just add the target unit of ability being cast to Knock_group and it will work just fine (but you still need the integer count variable to make it MUI)



Code:
set caster_pos = position of casting unit
set clap_group = units within x of caster...
pick every unit in clap_group and do actions
   set picked_pos = position of picked unit
   set angle[MUI_count] = angle between caster_pos and picked_pos
   set target[MUI_count] = picked unit
   add picked to Knock_group
   set the custom value of picked unit to MUI_count
   set MUI_count = MUI_count + 1

that's it.. now you have a knocking thunder clap (ignore the leaks, that's not the point here)
you slide the unit based on that angle[] value
if you want I can make it

the Knock_effect trigger is actually universal knockback trigger, you just need to set unit's values, MUI counts and add him to the group and rest will be done

that's how I made the knocking Water form spell (it's included with the map)
Thanks for the help. However, I fixed my triggers! :D

The problem was this: Set Leak[1] = ((Position of (Picked unit)) offset by 18.00 towards (360.00 - (Degrees((Angle from (Position of (Picked unit)) to SwordsmanP)))) degrees)

Originally, I couldn't make it be just: (Degrees((Angle from (Position of (Picked unit)) to SwordsmanP)))) degrees) Becuase that pulled units to me. I changed it to: (360.00 - (Degrees((Angle from (Position of (Picked unit)) to SwordsmanP)))) degrees) to make it push away. It worked untill I changed the number.

Now I changed it to just this: ((Position of (Picked unit)) offset by 18.00 towards (Angle from SwordsmanP to (Position of (Picked unit))) degrees) Instead of (Degrees((Angle from (Position of (Picked unit)) to SwordsmanP)))) degrees) and it works! o_O

And trust me, I had been working on this for hours before asking here. :p

But if you can point out leaks in my triggers, thats fine. :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top