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 The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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