• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[GUI] Component Knockback System with 3D 1.03

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: Shade Da Scout
Component Knockback System with 3D

Description
A knockback system that supports vertical/3D movement. I found plenty of knockback systems in the spells section, but no GUI systems that support 3D motion. Uses friction to reduce speed and reach an exit condition instead of duration.

  • MUI
  • Component/vector based - if you add multiple angles and speeds of knockback on a unit, they all add up to a resultant angle and speed.
  • Smooth gravity motion. Takes cliffs and terrain height changes into account.
  • Knock-on effect - when a unit is knocked into another unit, that unit will also be knocked back (you can enable/disable)
  • Friction-based. Units lose a percentage of their speed every loop, and are removed from the system when there speed is detected to be near-zero.

Installation
0. Install prerequisites, if you haven't already:
- UnitIndexer
- GUI AutoFly
- GetUnitCollisionSize
1. Copy the Component Knockback System trigger category into your map, making sure the Automatically Create Unknown Variables is enabled on your editor.
2. Configure in the CKBS Config trigger, and check the Readme for how to use the system.

Triggers

  • CKBS Config
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Every 0.03 seconds, the ground speed is multiplied by this value, which means a (1 - Friction) % lost per loop --------
      • Set CKBS_FrictionGround = 0.94
      • -------- Same as above, but applied only to flying knocked back units. --------
      • Set CKBS_FrictionAir = 0.97
      • -------- How fast flying units will accelerate to earth as they fall --------
      • Set CKBS_Gravity = 3.50
      • -------- How slow a unit must be moving to be considered "stopped" --------
      • Set CKBS_SpeedExitCond = 1.00
      • -------- How fast a unit must be moving in order to apply the knock-on effect --------
      • Set CKBS_KnockOnSpeedRequired = 5.00
      • -------- Collision size added to check for knock-on --------
      • Set CKBS_KnockOnAddCollision = 48.00
      • -------- The height at which the unit must be flying to collide with other units and doodads --------
      • Set CKBS_CollisionMaxHeight = 70.00
      • -------- --------------------------------------------------------------------------------------------------------------------- --------
      • Set tempLoc1 = (Center of (Playable map area))
      • Unit - Create 1 Peasant for Neutral Passive at tempLoc1 facing Default building facing degrees
      • Set CKBS_TreeCutter = (Last created unit)
      • Unit - Hide (Last created unit)
      • Custom script: call UnitAddAbility(GetLastCreatedUnit(), 'Aloc')
      • Custom script: call RemoveLocation(udg_tempLoc1)
  • CKBS Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CKBS_Group and do (Actions)
        • Loop - Actions
          • -------- Enum unit data --------
          • Set CKBS_tempPicked = (Picked unit)
          • Set CKBS_tempId = (Custom value of CKBS_tempPicked)
          • -------- Change the unit's position --------
          • Custom script: call SetUnitX( udg_CKBS_tempPicked, GetUnitX(udg_CKBS_tempPicked) + udg_CKBS_dx[udg_CKBS_tempId] )
          • Custom script: call SetUnitY( udg_CKBS_tempPicked, GetUnitY(udg_CKBS_tempPicked) + udg_CKBS_dy[udg_CKBS_tempId] )
          • -------- Exit condition: unit is out of map bounds --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Playable map area) contains CKBS_tempPicked) Equal to False
            • Then - Actions
              • Set CKBS_StopUnit = CKBS_tempPicked
              • Trigger - Run CKBS Stop <gen> (ignoring conditions)
            • Else - Actions
          • -------- Change the unit's height --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CKBS_Flies[CKBS_tempId] Equal to True
            • Then - Actions
              • -------- ------------------------------------------------------------ --------
              • -------- FLYING UNIT --------
              • -------- ------------------------------------------------------------ --------
              • -------- Apply air friction/drag --------
              • Set CKBS_dx[CKBS_tempId] = (CKBS_dx[CKBS_tempId] x CKBS_FrictionAir)
              • Set CKBS_dy[CKBS_tempId] = (CKBS_dy[CKBS_tempId] x CKBS_FrictionAir)
              • -------- Compare ground height --------
              • Set tempLoc1 = (Position of CKBS_tempPicked)
              • Custom script: set udg_CKBS_tempHeight = GetLocationZ(udg_tempLoc1)
              • -------- Change height --------
              • Animation - Change CKBS_tempPicked flying height to ((Current flying height of CKBS_tempPicked) + (CKBS_dz[CKBS_tempId] + (CKBS_LastGroundZ[CKBS_tempId] - CKBS_tempHeight))) at 0.00
              • Set CKBS_dz[CKBS_tempId] = (CKBS_dz[CKBS_tempId] - CKBS_Gravity)
              • Set CKBS_LastGroundZ[CKBS_tempId] = CKBS_tempHeight
              • Custom script: call RemoveLocation(udg_tempLoc1)
              • -------- Exit condition: height has reached zero --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Current flying height of CKBS_tempPicked) + CKBS_dz[CKBS_tempId]) Less than or equal to 0.00
                • Then - Actions
                  • Set CKBS_StopUnit = CKBS_tempPicked
                  • Trigger - Run CKBS Stop <gen> (ignoring conditions)
                • Else - Actions
            • Else - Actions
              • -------- ------------------------------------------------------------ --------
              • -------- SLIDING UNIT --------
              • -------- ------------------------------------------------------------ --------
              • -------- Apply ground friction --------
              • Set CKBS_dx[CKBS_tempId] = (CKBS_dx[CKBS_tempId] x CKBS_FrictionGround)
              • Set CKBS_dy[CKBS_tempId] = (CKBS_dy[CKBS_tempId] x CKBS_FrictionGround)
              • -------- Exit condition: speed is near zero --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CKBS_dx[CKBS_tempId] Less than or equal to CKBS_SpeedExitCond
                  • CKBS_dy[CKBS_tempId] Less than or equal to CKBS_SpeedExitCond
                  • CKBS_dx[CKBS_tempId] Greater than or equal to (CKBS_SpeedExitCond x -1.00)
                  • CKBS_dy[CKBS_tempId] Greater than or equal to (CKBS_SpeedExitCond x -1.00)
                • Then - Actions
                  • Set CKBS_StopUnit = CKBS_tempPicked
                  • Trigger - Run CKBS Stop <gen> (ignoring conditions)
                • Else - Actions
          • -------- Exit condition: point is unpathable --------
          • Set tempLoc2 = (Position of CKBS_tempPicked)
          • Set tempLoc3 = (tempLoc2 offset by ((CKBS_dx[CKBS_tempId] x 2.00), (CKBS_dy[CKBS_tempId] x 2.00)))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain pathing at tempLoc3 of type Walkability is off) Equal to True
              • (Current flying height of CKBS_tempPicked) Less than or equal to CKBS_CollisionMaxHeight
              • CKBS_dz[CKBS_tempId] Less than or equal to 0.00
            • Then - Actions
              • Set CKBS_StopUnit = CKBS_tempPicked
              • Trigger - Run CKBS Stop <gen> (ignoring conditions)
            • Else - Actions
          • Custom script: call RemoveLocation(udg_tempLoc3)
          • Custom script: call RemoveLocation(udg_tempLoc2)
          • -------- Check collision --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CKBS_Collides[CKBS_tempId] Equal to True
              • (Current flying height of CKBS_tempPicked) Less than or equal to CKBS_CollisionMaxHeight
              • CKBS_dz[CKBS_tempId] Less than or equal to 0.00
            • Then - Actions
              • -------- Get collision size --------
              • Set GUCS_U = CKBS_tempPicked
              • Trigger - Run GetUnitCollisionSize <gen> (ignoring conditions)
              • -------- Find units within collision size --------
              • Set tempLoc1 = (Position of CKBS_tempPicked)
              • Set CKBS_tempGroup = (Units within (Real(GUCS_Size)) of tempLoc1 matching ((((Matching unit) is A ground unit) Equal to True) and (((Matching unit) is dead) Equal to False)))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (CKBS_tempGroup is empty) Equal to False
                • Then - Actions
                  • Set CKBS_StopUnit = CKBS_tempPicked
                  • Trigger - Run CKBS Stop <gen> (ignoring conditions)
                • Else - Actions
              • Custom script: call DestroyGroup(udg_CKBS_tempGroup)
              • Custom script: call RemoveLocation(udg_tempLoc1)
            • Else - Actions
          • -------- Check for knock-on --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CKBS_TransferKnockback[CKBS_tempId] Equal to True
              • (Current flying height of CKBS_tempPicked) Less than or equal to CKBS_CollisionMaxHeight
              • CKBS_dz[CKBS_tempId] Less than or equal to 0.00
            • Then - Actions
              • -------- Get collision size --------
              • Set GUCS_U = CKBS_tempPicked
              • Trigger - Run GetUnitCollisionSize <gen> (ignoring conditions)
              • -------- Find units within collision size --------
              • Set tempLoc1 = (Position of CKBS_tempPicked)
              • Set CKBS_tempGroup = (Units within ((Real(GUCS_Size)) + CKBS_KnockOnAddCollision) of tempLoc1 matching ((((Matching unit) is A ground unit) Equal to True) and (((Matching unit) is dead) Equal to False)))
              • Unit Group - Remove CKBS_tempPicked from CKBS_tempGroup
              • Set CKBS_tempFactor = ((Real((Number of units in CKBS_tempGroup))) + 1.00)
              • -------- Get the unit's speed, we will divide this among all units being knocked back --------
              • Set CKBS_tempSpeed = (Square root(((Power(CKBS_dx[CKBS_tempId], 2.00)) + (Power(CKBS_dy[CKBS_tempId], 2.00)))))
              • Set CKBS_tempSpeed = (CKBS_tempSpeed / CKBS_tempFactor)
              • -------- Find the unit's current angle --------
              • Set tempLoc2 = (tempLoc1 offset by (CKBS_dx[CKBS_tempId], CKBS_dy[CKBS_tempId]))
              • Set CKBS_tempAngle = (Angle from tempLoc1 to tempLoc2)
              • Custom script: call RemoveLocation(udg_tempLoc2)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (CKBS_tempGroup is empty) Equal to False
                  • CKBS_tempSpeed Greater than or equal to CKBS_KnockOnSpeedRequired
                • Then - Actions
                  • -------- Reduce the unit's speed accordingly --------
                  • Set CKBS_dx[CKBS_tempId] = (CKBS_dx[CKBS_tempId] / CKBS_tempFactor)
                  • Set CKBS_dy[CKBS_tempId] = (CKBS_dy[CKBS_tempId] / CKBS_tempFactor)
                  • -------- Apply knockback to all new units --------
                  • Unit Group - Pick every unit in CKBS_tempGroup and do (Actions)
                    • Loop - Actions
                      • Set tempLoc2 = (Position of (Picked unit))
                      • -------- ------------------------- --------
                      • Set CKBS_NewAngle = (Angle from tempLoc1 to tempLoc2)
                      • Set CKBS_NewSpeed = CKBS_tempSpeed
                      • Set CKBS_NewUnit = (Picked unit)
                      • Set CKBS_NewVerticalSpeed = 0.00
                      • Set CKBS_NewDestroyTrees = CKBS_DestroyTrees[CKBS_tempId]
                      • Set CKBS_NewCollides = CKBS_Collides[CKBS_tempId]
                      • Set CKBS_NewTransferKnockback = CKBS_TransferKnockback[CKBS_tempId]
                      • Trigger - Run CKBS New <gen> (ignoring conditions)
                      • -------- ------------------------- --------
                      • -------- Apply half the speed in the same direction as the main unit --------
                      • Set CKBS_dx[CKBS_NewId] = (CKBS_dx[CKBS_NewId] x 0.50)
                      • Set CKBS_dy[CKBS_NewId] = (CKBS_dy[CKBS_NewId] x 0.50)
                      • Set CKBS_dx[CKBS_NewId] = (CKBS_dx[CKBS_NewId] + ((CKBS_NewSpeed x 0.50) x (Cos(CKBS_tempAngle))))
                      • Set CKBS_dy[CKBS_NewId] = (CKBS_dy[CKBS_NewId] + ((CKBS_NewSpeed x 0.50) x (Sin(CKBS_tempAngle))))
                      • -------- ------------------------- --------
                      • Custom script: call RemoveLocation(udg_tempLoc2)
                • Else - Actions
              • Custom script: call DestroyGroup(udg_CKBS_tempGroup)
              • Custom script: call RemoveLocation(udg_tempLoc1)
            • Else - Actions
          • -------- Destroy trees --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CKBS_DestroyTrees[CKBS_tempId] Equal to True
            • Then - Actions
              • -------- Get collision size --------
              • Set GUCS_U = CKBS_tempPicked
              • Trigger - Run GetUnitCollisionSize <gen> (ignoring conditions)
              • Set tempLoc1 = (Position of CKBS_tempPicked)
              • Destructible - Pick every destructible within ((Real(GUCS_Size)) + CKBS_KnockOnAddCollision) of tempLoc1 and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked destructible) is dead) Equal to False
                      • (Current flying height of CKBS_tempPicked) Less than or equal to (Occlusion height of (Picked destructible))
                    • Then - Actions
                      • Unit - Order CKBS_TreeCutter to Harvest (Picked destructible)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Current order of CKBS_TreeCutter) Equal to (Order(harvest))
                        • Then - Actions
                          • Destructible - Kill (Picked destructible)
                          • -------- Reduce the unit's speed --------
                          • Set CKBS_dx[CKBS_tempId] = (CKBS_dx[CKBS_tempId] x 0.60)
                          • Set CKBS_dy[CKBS_tempId] = (CKBS_dy[CKBS_tempId] x 0.60)
                        • Else - Actions
                      • Unit - Order CKBS_TreeCutter to Stop
                    • Else - Actions
              • Custom script: call RemoveLocation(udg_tempLoc1)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (CKBS_Group is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • CKBS New
    • Events
    • Conditions
    • Actions
      • Set CKBS_NewId = (Custom value of CKBS_NewUnit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (CKBS_NewUnit is in CKBS_Group) Equal to True
        • Then - Actions
          • -------- Unit already in system - change values --------
          • Set CKBS_dx[CKBS_NewId] = (CKBS_dx[CKBS_NewId] + (CKBS_NewSpeed x (Cos(CKBS_NewAngle))))
          • Set CKBS_dy[CKBS_NewId] = (CKBS_dy[CKBS_NewId] + (CKBS_NewSpeed x (Sin(CKBS_NewAngle))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CKBS_NewVerticalSpeed Not equal to 0.00
            • Then - Actions
              • Set CKBS_dz[CKBS_NewId] = (CKBS_dz[CKBS_NewId] + CKBS_NewVerticalSpeed)
              • Set CKBS_Flies[CKBS_NewId] = True
            • Else - Actions
          • -------- Set options --------
          • Set CKBS_Collides[CKBS_NewId] = CKBS_NewCollides
          • Set CKBS_TransferKnockback[CKBS_NewId] = CKBS_NewTransferKnockback
          • Set CKBS_DestroyTrees[CKBS_NewId] = CKBS_NewDestroyTrees
        • Else - Actions
          • -------- New knockback unit --------
          • Unit Group - Add CKBS_NewUnit to CKBS_Group
          • Unit - Pause CKBS_NewUnit
          • -------- Create SFX --------
          • Special Effect - Create a special effect attached to the origin of CKBS_NewUnit using CKBS_NewSFX
          • Set CKBS_SFX[CKBS_NewId] = (Last created special effect)
          • -------- Set initial velocity --------
          • Set CKBS_dx[CKBS_NewId] = (CKBS_NewSpeed x (Cos(CKBS_NewAngle)))
          • Set CKBS_dy[CKBS_NewId] = (CKBS_NewSpeed x (Sin(CKBS_NewAngle)))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CKBS_NewVerticalSpeed Not equal to 0.00
            • Then - Actions
              • Set CKBS_dz[CKBS_NewId] = CKBS_NewVerticalSpeed
              • Set CKBS_Flies[CKBS_NewId] = True
            • Else - Actions
          • -------- Set options --------
          • Set CKBS_Collides[CKBS_NewId] = CKBS_NewCollides
          • Set CKBS_TransferKnockback[CKBS_NewId] = CKBS_NewTransferKnockback
          • Set CKBS_DestroyTrees[CKBS_NewId] = CKBS_NewDestroyTrees
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (CKBS Loop <gen> is on) Equal to False
            • Then - Actions
              • Trigger - Turn on CKBS Loop <gen>
            • Else - Actions
  • CKBS Stop
    • Events
    • Conditions
    • Actions
      • Set CKBS_StopId = (Custom value of CKBS_StopUnit)
      • -------- If an air unit, it has just landed, so check knock on and tree destruction --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CKBS_TransferKnockback[CKBS_tempId] Equal to True
        • Then - Actions
          • -------- Get collision size --------
          • Set GUCS_U = CKBS_StopUnit
          • Trigger - Run GetUnitCollisionSize <gen> (ignoring conditions)
          • -------- Find units within collision size --------
          • Set tempLoc1 = (Position of CKBS_StopUnit)
          • Set CKBS_tempGroup = (Units within ((Real(GUCS_Size)) + CKBS_KnockOnAddCollision) of tempLoc1 matching ((((Matching unit) is A ground unit) Equal to True) and (((Matching unit) is dead) Equal to False)))
          • Unit Group - Remove CKBS_StopUnit from CKBS_tempGroup
          • Set CKBS_tempFactor = ((Real((Number of units in CKBS_tempGroup))) + 1.00)
          • -------- Get the unit's speed, we will divide this among all units being knocked back --------
          • Set CKBS_tempSpeed = (Square root(((Power(CKBS_dx[CKBS_StopId], 2.00)) + (Power(CKBS_dy[CKBS_StopId], 2.00)))))
          • Set CKBS_tempSpeed = (CKBS_tempSpeed / CKBS_tempFactor)
          • -------- Find the unit's current angle --------
          • Set tempLoc2 = (tempLoc1 offset by (CKBS_dx[CKBS_StopId], CKBS_dy[CKBS_StopId]))
          • Set CKBS_tempAngle = (Angle from tempLoc1 to tempLoc2)
          • Custom script: call RemoveLocation(udg_tempLoc2)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (CKBS_tempGroup is empty) Equal to False
              • CKBS_tempSpeed Greater than or equal to CKBS_KnockOnSpeedRequired
            • Then - Actions
              • -------- Reduce the unit's speed accordingly --------
              • Set CKBS_dx[CKBS_StopId] = (CKBS_dx[CKBS_StopId] / CKBS_tempFactor)
              • Set CKBS_dy[CKBS_StopId] = (CKBS_dy[CKBS_StopId] / CKBS_tempFactor)
              • -------- Apply knockback to all new units --------
              • Unit Group - Pick every unit in CKBS_tempGroup and do (Actions)
                • Loop - Actions
                  • Set tempLoc2 = (Position of (Picked unit))
                  • -------- ------------------------- --------
                  • Set CKBS_NewAngle = (Angle from tempLoc1 to tempLoc2)
                  • Set CKBS_NewSpeed = CKBS_tempSpeed
                  • Set CKBS_NewUnit = (Picked unit)
                  • Set CKBS_NewVerticalSpeed = 0.00
                  • Set CKBS_NewDestroyTrees = CKBS_DestroyTrees[CKBS_StopId]
                  • Set CKBS_NewCollides = CKBS_Collides[CKBS_StopId]
                  • Set CKBS_NewTransferKnockback = CKBS_TransferKnockback[CKBS_StopId]
                  • Trigger - Run CKBS New <gen> (ignoring conditions)
                  • -------- ------------------------- --------
                  • -------- Apply half the speed in the same direction as the main unit --------
                  • Set CKBS_dx[CKBS_NewId] = (CKBS_dx[CKBS_NewId] x 0.50)
                  • Set CKBS_dy[CKBS_NewId] = (CKBS_dy[CKBS_NewId] x 0.50)
                  • Set CKBS_dx[CKBS_NewId] = (CKBS_dx[CKBS_NewId] + ((CKBS_NewSpeed x 0.50) x (Cos(CKBS_tempAngle))))
                  • Set CKBS_dy[CKBS_NewId] = (CKBS_dy[CKBS_NewId] + ((CKBS_NewSpeed x 0.50) x (Sin(CKBS_tempAngle))))
                  • -------- ------------------------- --------
                  • Custom script: call RemoveLocation(udg_tempLoc2)
            • Else - Actions
          • Custom script: call DestroyGroup(udg_CKBS_tempGroup)
          • Custom script: call RemoveLocation(udg_tempLoc1)
        • Else - Actions
      • -------- Destroy trees --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CKBS_DestroyTrees[CKBS_StopId] Equal to True
        • Then - Actions
          • -------- Get collision size --------
          • Set GUCS_U = CKBS_StopUnit
          • Trigger - Run GetUnitCollisionSize <gen> (ignoring conditions)
          • Set tempLoc1 = (Position of CKBS_StopUnit)
          • Destructible - Pick every destructible within ((Real(GUCS_Size)) + CKBS_KnockOnAddCollision) of tempLoc1 and do (Actions)
            • Loop - Actions
              • Unit - Order CKBS_TreeCutter to Harvest (Picked destructible)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Current order of CKBS_TreeCutter) Equal to (Order(harvest))
                • Then - Actions
                  • Destructible - Kill (Picked destructible)
                • Else - Actions
              • Unit - Order CKBS_TreeCutter to Stop
          • Custom script: call RemoveLocation(udg_tempLoc1)
        • Else - Actions
      • Animation - Change CKBS_StopUnit flying height to 0.00 at 600.00
      • Unit Group - Remove CKBS_StopUnit from CKBS_Group
      • Unit - Unpause CKBS_StopUnit
      • Special Effect - Destroy CKBS_SFX[CKBS_StopId]
      • Set CKBS_Flies[CKBS_StopId] = False
      • Set tempLoc1 = (Position of CKBS_StopUnit)
      • Unit - Move CKBS_StopUnit instantly to tempLoc1
      • Custom script: call RemoveLocation(udg_tempLoc1)


  • Thunder Clap
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Clap
    • Actions
      • Set tempLoc1 = (Position of (Triggering unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 250.00 of tempLoc1 matching (((Owner of (Triggering unit)) is an enemy of (Owner of (Matching unit))) Equal to True)) and do (Actions)
        • Loop - Actions
          • Set tempLoc2 = (Position of (Picked unit))
          • -------- ------------------------- --------
          • Set CKBS_NewSFX = Abilities\Spells\Other\GeneralAuraTarget\GeneralAuraTarget.mdl
          • Set CKBS_NewAngle = (Angle from tempLoc1 to tempLoc2)
          • Set CKBS_NewSpeed = 45.00
          • Set CKBS_NewUnit = (Picked unit)
          • Set CKBS_NewVerticalSpeed = 30.00
          • Set CKBS_NewDestroyTrees = True
          • Set CKBS_NewCollides = True
          • Set CKBS_NewTransferKnockback = True
          • Trigger - Run CKBS New <gen> (ignoring conditions)
          • -------- ------------------------- --------
          • Custom script: call RemoveLocation(udg_tempLoc2)
      • Custom script: call RemoveLocation(udg_tempLoc1)
Credits
Bribe for Unit Indexer
Magtheridon96 for GUI AutoFly
Radamantus for GetUnitCollisionSize

Changelog
1.03
  • Changed the tree height collision detection to use occlusion height instead.
  • Loop trigger is now turned off if group is empty.
1.02
  • Added a maximum height at which flying units will destroy trees, and a different max height at which flying units will collide with doodads and units (thanks Maker for the suggestion)
1.01
  • Fixed the tree killing to only affect trees (thanks Radamantus for pointing out the fix)
  • Tree collisions now also reduce the unit's knockback speed (thanks Ironside for the suggestion)

Keywords:
knockback, slide, 3d knockback, knock back, 3d slide,
Contents

Component Knockback System 1.03 (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. Required changes: Don't pause units. Pausing units pauses buffs also There's an empty if/then/else in the stop trigger The spell knocks units over pathing blockers Suggested...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

Reviewed by Maker, GUI Component Knockback System with 3D 1.03, 14th Jan 2013

Required changes:
  • Don't pause units. Pausing units pauses buffs also
  • There's an empty if/then/else in the stop trigger
  • The spell knocks units over pathing blockers

Suggested changes:
  • The collision hashtable isn't initialized
  • Knocking units over Blizzard cliffs is troublesome since units can get caught in places
    they can't get out of
 
Does this have any unit indexer?

Also GhostHunter,Paladon's is the ugliest KB system i have ever seen.
Mine is better than Paladon's
http://www.hiveworkshop.com/forums/...1-6-v1-0-a-223634/?prev=status=a&u=Radamantus

I am disappointed on you rulerofiron :((

Dont you know how to destroy trees ??

Btw,thanks for using my system :D I love you

Also,before you use Cos/Sin on an angle,multiply the angle first to 3.14159/180 so that it converts to Degrees

Do you use any arc method?


Because i saw this,gonna update my knockback system from 2D to 3D
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Does this have any unit indexer?

It uses Bribe's UnitIndexer, as stated.

I am disappointed on you rulerofiron :((

Dont you know how to destroy trees ??

This system is destroying trees/destructibles as intended. I had a look at the way you destroy trees in your system, and I'm happy with my system also being able to destroy Rock Chunks.

Also,before you use Cos/Sin on an angle,multiply the angle first to 3.14159/180 so that it converts to Degrees

No need.

Do you use any arc method?

Gravity causes it to arc by itself.

Because i saw this,gonna update my knockback system from 2D to 3D

It's gonna be good :)
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
btw,make the peasant locust :D
hided units w/ are not invul can be damaged,hence,get killed.

Did you somehow get some codes/ideas from the Cokemonkey11's Knockback 3d?

The peasant is hidden, hidden units cannot be enumed or damaged.

All of the codes/ideas are based on things I have made before, and things I learnt from studying Physics.

I took nothing from Codemonkey11's system, but as stated I did take the tree cutting from your system.

I think there's no need to pause units, and no need to order the harvester to stop if the order is not harvest.
You could detect collision with trees when flying, not only when landing to prevent units being trapped in the middle of trees.

Looks like a good system.

Thanks.

I pause the units so that they cannot cast/move while being knocked back - since I use SetUnitX/Y instead of MoveUnit.

I will add a height threshold for tree collision detection.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
You can use destructable occluder height for the height collision detection, but that requires every destructable to have the height set correctly.

I'd use stun instead of pause. Or use hidden ability based on Channel and make it disable other abilities. I try to avoid pause at all costs.

I want to avoid using stun, as that requires more object editor work and importing. As the system is right now, it requires only trigger importing.

Are there bugs involved with using pause? Or is it mainly that the unit's buffs and such are paused?

UPDATES:
- Now using occlusion height
- Tree cutter has to be ordered to stop, otherwise he'll go and harvest a nearby tree
 
  • Destructible - Pick every destructible within ((Real(GUCS_Size)) + CKBS_KnockOnAddCollision) of tempLoc1 and do (Actions)
    • Loop - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • ((Picked destructible) is dead) Equal to False
    • (Current flying height of CKBS_tempPicked) Less than or equal to (Occlusion height of (Picked destructible))
    • Then - Actions
    • Unit - Order CKBS_TreeCutter to Harvest (Picked destructible)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • (Current order of CKBS_TreeCutter) Equal to (Order(harvest))
    • Then - Actions
    • Destructible - Kill (Picked destructible)
    • -------- Reduce the unit's speed --------
    • Set CKBS_dx[CKBS_tempId] = (CKBS_dx[CKBS_tempId] x 0.60)
    • Set CKBS_dy[CKBS_tempId] = (CKBS_dy[CKBS_tempId] x 0.60)
    • Else - Actions
    • Unit - Order CKBS_TreeCutter to Stop
    • Else - Actions
    • Custom script: call RemoveLocation(udg_tempLoc1)
This isnt leak? I mean Destructible group.
 
Top