• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Knockback 2d Bug

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
So I'm making an ability using the Knockback 2D system developed by Bribe.

http://www.hiveworkshop.com/forums/spells-569/knockback-2d-203180/index4.html

Unit activates his "Great Swing" which makes his next attack knockback the units. This video demonstrates the problem:

https://www.youtube.com/watch?v=95tY0SnW2YA&feature=youtu.be

If enemy units cluster together, units are being thrown around everywhere. I was hoping ONLY enemies near and in the way of the original unit that was attacked (with the ability) gets knocked back. Unfortunately, a chain reaction is occuring where every unit near any knockback unit is pushed away. I'm not sure how to tweak the system because I have no Jass knowledge. Can anybody help me out?
 
Level 12
Joined
May 22, 2015
Messages
1,051
Man that looks pretty funny lol. The system is quite complex and it is very hard to read in GUI lol. As far as I can tell, the system doesn't cause other units to bounce when a unit being moved bumps into another unit. Did you add that part in yourself or am I just missing it?

You would basically have to make the units not bounce when they run into something. This is not hard to do on its own, but you would have to also handle situations so that the units don't slide through solid objects and map boundaries.

So first, I would like to know if you added in the units causing other units to bounce part yourself. Also, are you using this system for anything else, and would it have to work differently for anything else?
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
As far as I can tell, the system doesn't cause other units to bounce when a unit being moved bumps into another unit. Did you add that part in yourself or am I just missing it?

I didn't create this part. It was an add'on by Bribe himself. Here's the code.

  • Knockback Collider
    • Events
      • Time - K2DTimer expires
    • Conditions
    • Actions
      • Custom script: local unit u
      • Custom script: local real x
      • Custom script: local real y
      • Custom script: local integer i = udg_K2DNext[0]
      • Custom script: loop
      • Custom script: exitwhen i == 0
      • Custom script: set udg_TempUnit = udg_UDexUnits[i]
      • Custom script: set x = GetUnitX(udg_TempUnit)
      • Custom script: set y = GetUnitY(udg_TempUnit)
      • Custom script: call GroupEnumUnitsInRange(udg_LeaklessGroup, x, y, 160, null)
      • Unit Group - Remove TempUnit from LeaklessGroup
      • Custom script: loop
      • Custom script: set u = FirstOfGroup(udg_LeaklessGroup)
      • Custom script: exitwhen u == null
      • Custom script: call GroupRemoveUnit(udg_LeaklessGroup, u)
      • Custom script: if IsUnitInRange(u, udg_TempUnit, udg_K2DRadius[i] * 32) and IsUnitAlly(u, GetOwningPlayer(udg_TempUnit)) and not IsUnitType(u, UNIT_TYPE_DEAD) then
      • Custom script: set udg_Knockback2DUnit = u
      • Custom script: set udg_Knockback2DTime = udg_K2DTimeLeft[i]
      • Custom script: set udg_Knockback2DDistance = udg_K2DVelocity[i] / udg_K2DTimeout * udg_K2DTimeLeft[i] / 2
      • Custom script: set udg_Knockback2DAngle = bj_RADTODEG * Atan2(GetUnitY(u) - y, GetUnitX(u) - x)
      • Trigger - Run Knockback 2D <gen> (ignoring conditions)
      • Custom script: endif
      • Custom script: endloop
      • Custom script: set i = udg_K2DNext[i]
      • Custom script: endloop
      • Custom script: set u = null
If I turn this trigger off, only the original unit will be knocked back, and no extra units will be pushed away.

I've decided to change what the ability does to simplify this question. How do I knockback more than 1 unit (without the Knockback collider)?

Added this to my trigger, but still only the original unit gets pushed back. If I turn the Unit collider on, it works, but other units are added to the group as units are pushed back.

  • Set TempUnitGroup = (Units within 250.00 of TargetPoint matching (((Matching unit) belongs to an enemy of (Owner of Knockback2DCastUnit)) Equal to True))
  • Unit Group - Add all units of TempUnitGroup to LeaklessGroup
 
Level 12
Joined
May 22, 2015
Messages
1,051
How did you knockback the original unit? I haven't used this system before lol. Is it with a spell or something?
 
Level 12
Joined
May 22, 2015
Messages
1,051
Yes. you don't check links right?

I was reading the code for that trigger and I didn't see how it is added. It's probably on there somewhere, but I didn't see it. I figured he would know if he was able to knockback one unit already.
 
Status
Not open for further replies.
Top