• 🏆 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!

Help dont understand this spell

Status
Not open for further replies.
Level 6
Joined
Aug 5, 2015
Messages
202
i already copied, all variable type already right, but after done, the function of this skill is different from his map, the random impale should be generates to all degrees possible, but on my map its only generates to 1 direction only (to south direction only)

the original spell link - http://www.hiveworkshop.com/forums/...v1-0-a-243109/?prev=search=impale&d=list&r=20

  • IS Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ------------------------ --------
      • -------- The Mega Impale Shock Ability that used in the spell --------
      • Set IS_Ability = Impale Shock - Ability
      • -------- ------------------------ --------
      • -------- The Impale shock dummy unit that used model in dummy.mdl --------
      • Set IS_DummyUnitType = IS Dummy
      • -------- ------------------------ --------
      • -------- The dummy ability of the dummy caster ( stun ) --------
      • Set IS_DummyStunAbility = Impale Shock - DummyStunAbility
      • -------- ------------------------ --------
      • -------- The dummy ability of the dummy caster ( impale ) --------
      • Set IS_DummyImpaleAbility = Impale Shock - DummyImpaleAbility
      • -------- ------------------------ --------
      • -------- Determines the speed of the primary impale ( distance per second ) --------
      • Set IS_ImpaleSpeed[1] = 400.00
      • Set IS_ImpaleSpeed[2] = 500.00
      • Set IS_ImpaleSpeed[3] = 600.00
      • -------- ------------------------ --------
      • -------- Determines collision size or radius of the primary impale. --------
      • Set IS_ImpaleCollisionSize[1] = 100.00
      • Set IS_ImpaleCollisionSize[2] = 100.00
      • Set IS_ImpaleCollisionSize[3] = 100.00
      • -------- ------------------------ --------
      • -------- Determines the damage when it meets a enemy unit in the primary impale's collision size. --------
      • Set IS_ImpaleCollisionDamage[1] = 100.00
      • Set IS_ImpaleCollisionDamage[2] = 150.00
      • Set IS_ImpaleCollisionDamage[3] = 200.00
      • -------- ------------------------ --------
      • -------- Determines the attacktype of the primary impale when it meets some enemies in it's collision size. --------
      • Set IS_ImpaleAttackType = Spells
      • -------- ------------------------ --------
      • -------- Determines the damagetype of the primary impale when it meets some enemies in it's collision size. --------
      • Set IS_ImpaleDamageType = Normal
      • -------- ------------------------ --------
      • -------- Determines the releasing time of the secondary impale. --------
      • Set IS_SecondaryImpaleReleaseTime[1] = 0.60
      • Set IS_SecondaryImpaleReleaseTime[2] = 0.50
      • Set IS_SecondaryImpaleReleaseTime[3] = 0.40
      • -------- ------------------------ --------
      • -------- Determines the bonus range into the targeted point. Formulation: ( Distance Between Caster, Target + Bonus Range ) --------
      • Set IS_ImpaleBonusRange[1] = 100.00
      • Set IS_ImpaleBonusRange[2] = 100.00
      • Set IS_ImpaleBonusRange[3] = 100.00
      • -------- ------------------------ --------
      • -------- Determines the casting factor offset of the secondary impale. Formulation [ 0.00 and Wave Distance of DummyImpaleAbility ( 500 ) ] --------
      • Set IS_ImpaleReleaseOffsetFactor[1] = (Random real number between 0.00 and 500.00)
      • Set IS_ImpaleReleaseOffsetFactor[2] = (Random real number between 0.00 and 500.00)
      • Set IS_ImpaleReleaseOffsetFactor[3] = (Random real number between 0.00 and 500.00)
      • -------- ------------------------ --------
      • -------- Determines the secondary special effect of the leading impale effect. --------
      • Set IS_ImpaleEffect = Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
      • -------- ------------------------ --------
      • -------- Determines the size of the Impale Special Effect --------
      • Set IS_ImpaleEffectSize[1] = 100.00
      • Set IS_ImpaleEffectSize[2] = 125.00
      • Set IS_ImpaleEffectSize[3] = 150.00
      • -------- ------------------------ --------
      • -------- Determines the special effect of the leading impale. --------
      • Set IS_ImpaleLeadEffect = Abilities\Spells\Undead\Impale\ImpaleMissTarget.mdl
      • -------- ------------------------ --------
      • -------- Determines the size of the leading impale special effect. --------
      • Set IS_ImpaleLeadSize[1] = 125.00
      • Set IS_ImpaleLeadSize[2] = 150.00
      • Set IS_ImpaleLeadSize[3] = 175.00
      • -------- ------------------------ --------
      • -------- Determines the special effect of the unit when the primary impale's collision meets an enemy unit in the line. --------
      • Set IS_CollideUnitEffect = Abilities\Spells\Undead\Impale\ImpaleMissTarget.mdl
      • -------- ------------------------ --------
      • -------- Determines the collide effect attachent in the unit. --------
      • Set IS_CollideUnitEffectAttach = origin
      • -------- ------------------------ --------
      • -------- Determines the chance of the lead impale special effect to occurs. --------
      • Set IS_ChanceLeadEffect = 25
      • -------- ------------------------ --------
      • -------- Determines the chance of the impale special effect to occurs. --------
      • Set IS_ChanceEffect = 35
      • -------- ------------------------ --------
      • -------- Determines the impact effect when the primary impale reached the final target point. --------
      • Set IS_ImpactEffect = Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
      • -------- ------------------------ --------
      • -------- Determines the impact radius. --------
      • Set IS_ImpactRadius[1] = 300.00
      • Set IS_ImpactRadius[2] = 350.00
      • Set IS_ImpactRadius[3] = 400.00
      • -------- ------------------------ --------
      • -------- Determines the damage in the impact radius. --------
      • Set IS_ImpactDamage[1] = 100.00
      • Set IS_ImpactDamage[2] = 200.00
      • Set IS_ImpactDamage[3] = 300.00
      • -------- ------------------------ --------
      • -------- Determines the attacktype of the impact. --------
      • Set IS_ImpactAttackType = Siege
      • -------- ------------------------ --------
      • -------- Determines the damage type of the impact. --------
      • Set IS_ImpactDamageType = Demolition
      • -------- ------------------------ --------
      • -------- Acceleration, Speed Added/s to the KB speed --------
      • Set IS_KB_Acceleration[1] = -500.00
      • Set IS_KB_Acceleration[2] = -500.00
      • Set IS_KB_Acceleration[3] = -500.00
      • -------- ------------------------ --------
      • -------- Set this to false if you don't want to crash your map. Set this to true if you want to crash your map. --------
      • -------- ^ xD. Set this to false to not allow the knockbacked unit throughout in the map playable bounds or borders --------
      • Set IS_KB_AllowThroughBorders = False
      • -------- ------------------------ --------
      • -------- Set this to true if you want to destroy trees while knockbacking the target. Set this to false if you don't want to destroy trees --------
      • Set IS_KB_DestroyTree = False
      • -------- ------------------------ --------
      • -------- Set this to true if you want to disable the unit when being knockback, false if you don't. --------
      • Set IS_KB_DisableUnit = True
      • -------- ------------------------ --------
      • -------- The knockback damage every looping second. --------
      • Set IS_KB_LoopDamage[1] = 50.00
      • Set IS_KB_LoopDamage[2] = 75.00
      • Set IS_KB_LoopDamage[3] = 100.00
      • -------- ------------------------ --------
      • -------- Determines the special effect of the unit when knockbacked. --------
      • Set IS_KB_LoopEffect = Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
      • -------- ------------------------ --------
      • -------- ^Attachment of the effect. --------
      • Set IS_KB_LoopEffectAttach = chest
      • -------- ------------------------ --------
      • -------- Determines the ZOffset or the desired max height of the unit when knockbacked --------
      • Set IS_KB_MaxHeight[1] = 300.00
      • Set IS_KB_MaxHeight[2] = 350.00
      • Set IS_KB_MaxHeight[3] = 400.00
      • -------- ------------------------ --------
      • -------- Determines the max distance of the knockback --------
      • Set IS_KB_Range[1] = 350.00
      • Set IS_KB_Range[2] = 500.00
      • Set IS_KB_Range[3] = 650.00
      • -------- ------------------------ --------
      • -------- Determines the speed of the knockback, distance per second. --------
      • Set IS_KB_Speed[1] = 300.00
      • Set IS_KB_Speed[2] = 400.00
      • Set IS_KB_Speed[3] = 500.00
      • -------- ------------------------ --------
      • -------- Determines the attacktype of the knockback looping damage. --------
      • Set IS_KB_AttackType = Magic
      • -------- ------------------------ --------
      • -------- Determines the damagetype of the knockback looping damage. --------
      • Set IS_KB_DamageType = Normal
      • -------- ------------------------ --------
      • -------- Determines the trail effect of the knockbacked unit. --------
      • Set IS_KB_TrailEffect = Abilities\Weapons\AvengerMissile\AvengerMissile.mdl
      • -------- ------------------------ --------
      • -------- Determines the collision size of the unit or radius of the unit. --------
      • Set IS_KB_UnitCollision[1] = 100.00
      • Set IS_KB_UnitCollision[2] = 125.00
      • Set IS_KB_UnitCollision[3] = 150.00
      • -------- ------------------------ --------
      • -------- Set this to true if you want to stop in unpathable area. --------
      • Set IS_KB_UnpathableStop = True
      • -------- ------------------------ --------
  • IS Execution
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to IS_Ability
    • Actions
      • -------- ------------------------ --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IS_MaxIndex Equal to 0
        • Then - Actions
          • Trigger - Turn on IS Loop <gen>
        • Else - Actions
      • -------- ------------------------ --------
      • Set IS_MaxIndex = (IS_MaxIndex + 1)
      • -------- ------------------------ --------
      • Set IS_Caster[IS_MaxIndex] = (Triggering unit)
      • -------- ------------------------ --------
      • Set IS_Player[IS_MaxIndex] = (Triggering player)
      • -------- ------------------------ --------
      • Set IS_CasterPosition = (Position of IS_Caster[IS_MaxIndex])
      • -------- ------------------------ --------
      • Set IS_Level[IS_MaxIndex] = (Level of IS_Ability for IS_Caster[IS_MaxIndex])
      • -------- ------------------------ --------
      • Set IS_TargetLocation[IS_MaxIndex] = (Target point of ability being cast)
      • -------- ------------------------ --------
      • Set IS_ImpaleAngle[IS_MaxIndex] = (Angle from IS_CasterPosition to IS_TargetLocation[IS_MaxIndex])
      • -------- ------------------------ --------
      • Set IS_ImpaleRangeDistance[IS_MaxIndex] = ((Distance between IS_CasterPosition and IS_TargetLocation[IS_MaxIndex]) + IS_ImpaleBonusRange[IS_Level[IS_MaxIndex]])
      • -------- ------------------------ --------
      • Set IS_ImpaleSpeedCounter[IS_MaxIndex] = 0.00
      • -------- ------------------------ --------
      • Set IS_SecondaryImpaleTimeCounter[IS_MaxIndex] = 0.00
      • -------- ------------------------ --------
      • Set IS_ImpaleSpeedCalculation[IS_MaxIndex] = (IS_ImpaleSpeed[IS_Level[IS_MaxIndex]] x 0.03)
      • -------- ------------------------ --------
      • Custom script: set udg_IS_GroupContainer [ udg_IS_MaxIndex ] = CreateGroup ( )
      • -------- ------------------------ --------
      • Unit - Create 1 IS_DummyUnitType for IS_Player[IS_MaxIndex] at IS_CasterPosition facing Default building facing degrees
      • -------- ------------------------ --------
      • Set IS_ImpaleDummyUnit[IS_MaxIndex] = (Last created unit)
      • -------- ------------------------ --------
      • Custom script: call RemoveLocation ( udg_IS_CasterPosition )
      • -------- ------------------------ --------
  • IS Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- ------------------------ --------
      • Custom script: local real getX
      • Custom script: local real getY
      • -------- ------------------------ --------
      • For each (Integer IS_CurrentIndex) from 1 to IS_MaxIndex, do (Actions)
        • Loop - Actions
          • -------- ------------------------ --------
          • Set IS_SecondaryImpaleTimeCounter[IS_MaxIndex] = (IS_SecondaryImpaleTimeCounter[IS_MaxIndex] + 0.03)
          • -------- ------------------------ --------
          • Set IS_ImpaleDummyUnitPosition = (Position of IS_ImpaleDummyUnit[IS_CurrentIndex])
          • -------- ------------------------ --------
          • Set IS_ImpaleMovementLocation = (IS_ImpaleDummyUnitPosition offset by IS_ImpaleSpeedCalculation[IS_CurrentIndex] towards IS_ImpaleAngle[IS_CurrentIndex] degrees)
          • -------- ------------------------ --------
          • Custom script: set getX = GetLocationX ( udg_IS_ImpaleMovementLocation )
          • Custom script: set getY = GetLocationY ( udg_IS_ImpaleMovementLocation )
          • -------- ------------------------ --------
          • Custom script: call SetUnitX ( udg_IS_ImpaleDummyUnit [ udg_IS_CurrentIndex ], getX )
          • Custom script: call SetUnitY ( udg_IS_ImpaleDummyUnit [ udg_IS_CurrentIndex ], getY )
          • -------- ------------------------ --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less than or equal to IS_ChanceLeadEffect
            • Then - Actions
              • -------- ------------------------ --------
              • Unit - Create 1 IS_DummyUnitType for IS_Player[IS_CurrentIndex] at IS_ImpaleMovementLocation facing Default building facing degrees
              • -------- ------------------------ --------
              • Set IS_ImpaleLeadDummyUnit = (Last created unit)
              • -------- ------------------------ --------
              • Animation - Change IS_ImpaleLeadDummyUnit's size to (IS_ImpaleLeadSize[IS_Level[IS_CurrentIndex]]%, 0.00%, 0.00%) of its original size
              • -------- ------------------------ --------
              • Special Effect - Create a special effect attached to the origin of IS_ImpaleLeadDummyUnit using IS_ImpaleLeadEffect
              • -------- ------------------------ --------
              • Special Effect - Destroy (Last created special effect)
              • -------- ------------------------ --------
              • Unit - Add a 0.50 second Generic expiration timer to IS_ImpaleLeadDummyUnit
              • -------- ------------------------ --------
            • Else - Actions
          • -------- ------------------------ --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random integer number between 1 and 100) Less than or equal to IS_ChanceEffect
            • Then - Actions
              • -------- ------------------------ --------
              • Unit - Create 1 IS_DummyUnitType for IS_Player[IS_CurrentIndex] at IS_ImpaleMovementLocation facing Default building facing degrees
              • -------- ------------------------ --------
              • Set IS_ImpaleEffectDummyUnit = (Last created unit)
              • -------- ------------------------ --------
              • Animation - Change IS_ImpaleEffectDummyUnit's size to (IS_ImpaleEffectSize[IS_Level[IS_CurrentIndex]]%, 0.00%, 0.00%) of its original size
              • -------- ------------------------ --------
              • Special Effect - Create a special effect attached to the origin of IS_ImpaleEffectDummyUnit using IS_ImpaleEffect
              • -------- ------------------------ --------
              • Special Effect - Destroy (Last created special effect)
              • -------- ------------------------ --------
              • Unit - Add a 0.50 second Generic expiration timer to IS_ImpaleEffectDummyUnit
              • -------- ------------------------ --------
            • Else - Actions
          • -------- ------------------------ --------
          • Set IS_ImpaleSpeedCounter[IS_CurrentIndex] = (IS_ImpaleSpeedCounter[IS_CurrentIndex] + IS_ImpaleSpeedCalculation[IS_CurrentIndex])
          • -------- ------------------------ --------
          • Custom script: set bj_wantDestroyGroup = true
          • -------- ------------------------ --------
          • Unit Group - Pick every unit in (Units within IS_ImpaleCollisionSize[IS_Level[IS_CurrentIndex]] of IS_ImpaleMovementLocation) and do (Actions)
            • Loop - Actions
              • Set IS_CollideUnit = (Picked unit)
              • -------- ------------------------ --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (IS_CollideUnit is dead) Not equal to True
                  • (Unit-type of IS_CollideUnit) Not equal to No unit-type
                  • (IS_CollideUnit belongs to an enemy of IS_Player[IS_CurrentIndex]) Equal to True
                  • (IS_CollideUnit is in IS_GroupContainer[IS_CurrentIndex]) Not equal to True
                  • (IS_CollideUnit is A structure) Not equal to True
                  • (IS_CollideUnit is Magic Immune) Not equal to True
                  • (IS_CollideUnit is A flying unit) Not equal to True
                  • (IS_CollideUnit is Mechanical) Not equal to True
                • Then - Actions
                  • -------- ------------------------ --------
                  • Set IS_CollideUnitPosition = (Position of IS_CollideUnit)
                  • -------- ------------------------ --------
                  • Unit - Cause IS_Caster[IS_CurrentIndex] to damage IS_CollideUnit, dealing IS_ImpaleCollisionDamage[IS_Level[IS_CurrentIndex]] damage of attack type IS_ImpaleAttackType and damage type IS_ImpaleDamageType
                  • -------- ------------------------ --------
                  • Special Effect - Create a special effect attached to the IS_CollideUnitEffectAttach of IS_CollideUnit using IS_CollideUnitEffect
                  • -------- ------------------------ --------
                  • Special Effect - Destroy (Last created special effect)
                  • -------- ------------------------ --------
                  • Unit - Create 1 IS_DummyUnitType for IS_Player[IS_CurrentIndex] at IS_CollideUnitPosition facing Default building facing degrees
                  • -------- ------------------------ --------
                  • Set IS_ImpaleDummyUnitStunCaster = (Last created unit)
                  • -------- ------------------------ --------
                  • Unit - Add a 1.00 second Generic expiration timer to IS_ImpaleDummyUnitStunCaster
                  • -------- ------------------------ --------
                  • Unit - Add IS_DummyStunAbility to IS_ImpaleDummyUnitStunCaster
                  • -------- ------------------------ --------
                  • Unit - Set level of IS_DummyStunAbility for IS_ImpaleDummyUnitStunCaster to IS_Level[IS_CurrentIndex]
                  • -------- ------------------------ --------
                  • Unit - Order IS_ImpaleDummyUnitStunCaster to Human Mountain King - Storm Bolt IS_CollideUnit
                  • -------- ------------------------ --------
                  • Unit Group - Add IS_CollideUnit to IS_GroupContainer[IS_CurrentIndex]
                  • -------- ------------------------ --------
                  • Custom script: call RemoveLocation ( udg_IS_CollideUnitPosition )
                  • -------- ------------------------ --------
                • Else - Actions
              • -------- ------------------------ --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (IS_CollideUnit is dead) Not equal to True
                  • (Unit-type of IS_CollideUnit) Not equal to No unit-type
                  • (IS_CollideUnit belongs to an enemy of IS_Player[IS_CurrentIndex]) Equal to True
                  • (IS_CollideUnit is in IS_GroupContainer[IS_CurrentIndex]) Not equal to True
                  • (IS_CollideUnit is A flying unit) Not equal to True
                • Then - Actions
                  • -------- ------------------------ --------
                  • Unit - Cause IS_Caster[IS_CurrentIndex] to damage IS_CollideUnit, dealing IS_ImpaleCollisionDamage[IS_Level[IS_CurrentIndex]] damage of attack type IS_ImpaleAttackType and damage type IS_ImpaleDamageType
                  • -------- ------------------------ --------
                  • Unit Group - Add IS_CollideUnit to IS_GroupContainer[IS_CurrentIndex]
                  • -------- ------------------------ --------
                • Else - Actions
              • -------- ------------------------ --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IS_SecondaryImpaleTimeCounter[IS_CurrentIndex] Greater than or equal to IS_SecondaryImpaleReleaseTime[IS_Level[IS_CurrentIndex]]
            • Then - Actions
              • -------- ------------------------ --------
              • Unit - Create 1 IS_DummyUnitType for IS_Player[IS_CurrentIndex] at IS_ImpaleMovementLocation facing Default building facing degrees
              • -------- ------------------------ --------
              • Set IS_ImpaleDummyUnitImpaleCaster = (Last created unit)
              • -------- ------------------------ --------
              • Unit - Add a 1.00 second Generic expiration timer to IS_ImpaleDummyUnitImpaleCaster
              • -------- ------------------------ --------
              • Set IS_ImpaleReleaseAngle = (Random angle)
              • -------- ------------------------ --------
              • Set IS_ImpaleDummyUnitPosition = (Position of IS_ImpaleDummyUnitImpaleCaster)
              • -------- ------------------------ --------
              • Set IS_ImpaleReleaseLocation = (IS_ImpaleDummyUnitPosition offset by IS_ImpaleReleaseOffsetFactor[IS_Level[IS_CurrentIndex]] towards IS_ImpaleReleaseAngle degrees)
              • -------- ------------------------ --------
              • Unit - Add IS_DummyImpaleAbility to IS_ImpaleDummyUnitImpaleCaster
              • -------- ------------------------ --------
              • Unit - Set level of IS_DummyImpaleAbility for IS_ImpaleDummyUnitImpaleCaster to IS_Level[IS_CurrentIndex]
              • -------- ------------------------ --------
              • Unit - Order IS_ImpaleDummyUnitImpaleCaster to Undead Crypt Lord - Impale IS_ImpaleReleaseLocation
              • -------- ------------------------ --------
              • Set IS_SecondaryImpaleTimeCounter[IS_CurrentIndex] = 0.00
              • -------- ------------------------ --------
              • Custom script: call RemoveLocation ( udg_IS_ImpaleDummyUnitPosition )
              • Custom script: call RemoveLocation ( udg_IS_ImpaleReleaseLocation )
              • -------- ------------------------ --------
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IS_ImpaleSpeedCounter[IS_CurrentIndex] Greater than or equal to IS_ImpaleRangeDistance[IS_CurrentIndex]
            • Then - Actions
              • -------- ------------------------ --------
              • Set IS_ImpactScaleRatio = (IS_ImpactRadius[IS_Level[IS_CurrentIndex]] x 0.53)
              • -------- ------------------------ --------
              • Unit - Create 1 IS_DummyUnitType for IS_Player[IS_CurrentIndex] at IS_ImpaleMovementLocation facing Default building facing degrees
              • -------- ------------------------ --------
              • Set IS_ImpactDummyUnit = (Last created unit)
              • -------- ------------------------ --------
              • Animation - Change IS_ImpactDummyUnit's size to (IS_ImpactScaleRatio%, 0.00%, 0.00%) of its original size
              • -------- ------------------------ --------
              • Special Effect - Create a special effect attached to the origin of IS_ImpactDummyUnit using IS_ImpactEffect
              • -------- ------------------------ --------
              • Special Effect - Destroy (Last created special effect)
              • -------- ------------------------ --------
              • Unit - Add a 1.00 second Generic expiration timer to IS_ImpactDummyUnit
              • -------- ------------------------ --------
              • Set IS_ImpaleScaleRatio = (IS_ImpactRadius[IS_Level[IS_CurrentIndex]] x 0.53)
              • -------- ------------------------ --------
              • Unit - Create 1 IS_DummyUnitType for IS_Player[IS_CurrentIndex] at IS_ImpaleMovementLocation facing Default building facing degrees
              • -------- ------------------------ --------
              • Set IS_ImpactImpaleUnit = (Last created unit)
              • -------- ------------------------ --------
              • Animation - Change IS_ImpactImpaleUnit's size to (IS_ImpaleScaleRatio%, 0.00%, 0.00%) of its original size
              • -------- ------------------------ --------
              • Special Effect - Create a special effect attached to the origin of IS_ImpactImpaleUnit using IS_ImpaleLeadEffect
              • -------- ------------------------ --------
              • Special Effect - Destroy (Last created special effect)
              • -------- ------------------------ --------
              • Unit - Add a 1.00 second Generic expiration timer to IS_ImpactImpaleUnit
              • -------- ------------------------ --------
              • Custom script: set bj_wantDestroyGroup = true
              • -------- ------------------------ --------
              • Unit Group - Pick every unit in (Units within IS_ImpactRadius[IS_Level[IS_CurrentIndex]] of IS_ImpaleMovementLocation) and do (Actions)
                • Loop - Actions
                  • -------- ------------------------ --------
                  • Set IS_PickedUnit = (Picked unit)
                  • -------- ------------------------ --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (IS_PickedUnit is dead) Not equal to True
                      • (Unit-type of IS_PickedUnit) Not equal to No unit-type
                      • (IS_PickedUnit belongs to an enemy of IS_Player[IS_CurrentIndex]) Equal to True
                      • (IS_PickedUnit is A structure) Not equal to True
                      • (IS_PickedUnit is Magic Immune) Not equal to True
                      • (IS_PickedUnit is Mechanical) Not equal to True
                    • Then - Actions
                      • -------- ------------------------ --------
                      • Unit - Cause IS_Caster[IS_CurrentIndex] to damage IS_PickedUnit, dealing IS_ImpactDamage[IS_Level[IS_CurrentIndex]] damage of attack type IS_ImpactAttackType and damage type IS_ImpactDamageType
                      • -------- ------------------------ --------
                      • Set IS_PickedUnitPosition = (Position of IS_PickedUnit)
                      • -------- ------------------------ --------
                      • Set KB3D_Accel = IS_KB_Acceleration[IS_Level[IS_CurrentIndex]]
                      • -------- ------------------------ --------
                      • Set KB3D_AllowOutSiding = IS_KB_AllowThroughBorders
                      • -------- ------------------------ --------
                      • Set KB3D_Angle = (Angle from IS_ImpaleMovementLocation to IS_PickedUnitPosition)
                      • -------- ------------------------ --------
                      • Set KB3D_AttackType = IS_KB_AttackType
                      • -------- ------------------------ --------
                      • Set KB3D_DamageType = IS_KB_DamageType
                      • -------- ------------------------ --------
                      • Set KB3D_Damager = IS_Caster[IS_CurrentIndex]
                      • -------- ------------------------ --------
                      • Set KB3D_DestroyTree = IS_KB_DestroyTree
                      • -------- ------------------------ --------
                      • Set KB3D_DisableUnit = IS_KB_DisableUnit
                      • -------- ------------------------ --------
                      • Set KB3D_Fx = IS_KB_LoopEffect
                      • -------- ------------------------ --------
                      • Set KB3D_Fx_Attach = IS_KB_LoopEffectAttach
                      • -------- ------------------------ --------
                      • Set KB3D_LoopDamage = IS_KB_LoopDamage[IS_Level[IS_CurrentIndex]]
                      • -------- ------------------------ --------
                      • Set KB3D_Range = IS_KB_Range[IS_Level[IS_CurrentIndex]]
                      • -------- ------------------------ --------
                      • Set KB3D_Speed = IS_KB_Speed[IS_Level[IS_CurrentIndex]]
                      • -------- ------------------------ --------
                      • Set KB3D_Targeted_Unit = No unit
                      • -------- ------------------------ --------
                      • Set KB3D_TrailFx = IS_KB_TrailEffect
                      • -------- ------------------------ --------
                      • Set KB3D_Unit = IS_PickedUnit
                      • -------- ------------------------ --------
                      • Set KB3D_UnpathableStop = IS_KB_UnpathableStop
                      • -------- ------------------------ --------
                      • Set KB3D_Zoffset = IS_KB_MaxHeight[IS_Level[IS_CurrentIndex]]
                      • -------- ------------------------ --------
                      • Trigger - Run KB3D_Registration (checking conditions)
                      • -------- ------------------------ --------
                      • Custom script: call RemoveLocation ( udg_IS_PickedUnitPosition )
                      • -------- ------------------------ --------
                    • Else - Actions
                  • -------- ------------------------ --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (IS_PickedUnit is dead) Not equal to True
                      • (Unit-type of IS_PickedUnit) Not equal to No unit-type
                      • (IS_PickedUnit belongs to an enemy of IS_Player[IS_CurrentIndex]) Equal to True
                      • (IS_PickedUnit is Magic Immune) Not equal to True
                    • Then - Actions
                      • -------- ------------------------ --------
                      • Unit - Cause IS_Caster[IS_CurrentIndex] to damage IS_PickedUnit, dealing IS_ImpactDamage[IS_Level[IS_CurrentIndex]] damage of attack type IS_ImpactAttackType and damage type IS_ImpactDamageType
                      • -------- ------------------------ --------
                    • Else - Actions
                  • -------- ------------------------ --------
              • -------- ------------------------ --------
              • Unit Group - Remove all units from IS_GroupContainer[IS_CurrentIndex]
              • Unit - Remove IS_ImpaleDummyUnit[IS_CurrentIndex] from the game
              • -------- ------------------------ --------
              • Custom script: call DestroyGroup ( udg_IS_GroupContainer [ udg_IS_CurrentIndex ] )
              • Custom script: call RemoveLocation ( udg_IS_TargetLocation [ udg_IS_CurrentIndex ] )
              • -------- ------------------------ --------
              • Set IS_Caster[IS_CurrentIndex] = IS_Caster[IS_MaxIndex]
              • Set IS_GroupContainer[IS_CurrentIndex] = IS_GroupContainer[IS_MaxIndex]
              • Set IS_ImpaleAngle[IS_CurrentIndex] = IS_ImpaleAngle[IS_MaxIndex]
              • Set IS_ImpaleDummyUnit[IS_CurrentIndex] = IS_ImpaleDummyUnit[IS_MaxIndex]
              • Set IS_ImpaleRangeDistance[IS_CurrentIndex] = IS_ImpaleRangeDistance[IS_MaxIndex]
              • Set IS_ImpaleSpeedCalculation[IS_CurrentIndex] = IS_ImpaleSpeedCalculation[IS_MaxIndex]
              • Set IS_ImpaleSpeedCounter[IS_CurrentIndex] = IS_ImpaleSpeedCounter[IS_MaxIndex]
              • Set IS_SecondaryImpaleTimeCounter[IS_CurrentIndex] = IS_SecondaryImpaleTimeCounter[IS_MaxIndex]
              • Set IS_Level[IS_CurrentIndex] = IS_Level[IS_MaxIndex]
              • Set IS_Player[IS_CurrentIndex] = IS_Player[IS_MaxIndex]
              • Set IS_TargetLocation[IS_CurrentIndex] = IS_TargetLocation[IS_MaxIndex]
              • -------- ------------------------ --------
              • Set IS_MaxIndex = (IS_MaxIndex - 1)
              • Set IS_CurrentIndex = (IS_CurrentIndex - 1)
              • -------- ------------------------ --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IS_MaxIndex Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
              • -------- ------------------------ --------
            • Else - Actions
          • -------- ------------------------ --------
          • Custom script: call RemoveLocation ( udg_IS_ImpaleMovementLocation )
          • Custom script: call RemoveLocation ( udg_IS_ImpaleDummyUnitPosition )
          • -------- ------------------------ --------
      • -------- ------------------------ --------

and this is
JASS:
/////////////////////////////////////////////////////////////////////////////
//                                                                         //
//           Knock-Back 3D  v. 1.4.2     [JASS - GUI]                      //
//                                                by JAD aka DotCa         //
//                                                                         //
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//                                                                         //
//           System Informations:                                          //
//                                                                         //
//  The System is a well performing, ultra-purpose knockback (see uses     //
//  below ) Coded in JASS making it possible for all users to take         //
//  advantage of it, and GUI friendly to use, see Examples in the triggers //
//  above                                                                  //
//               Configurations have default values:                       //
//                                                                         //
//     - KB3D_DestroyTree      ==> FALSE by default                        //
//     - KB3D_DisableUnit      ==> FALSE by default                        //
//     - KB3D_UnpathaableStop  ==> TRUE  by default                        //
//     - KB3D_AttackType       ==> ATTACK_TYPE_NORMAL                      //
//     - KB3D_DamageType       ==> DAMAGE_TYPE_MAGIC                       //
//                                                                         //
//  The System also uses Always positive values for some configurations    //
//  to not make the knockback go worng, those configurations are:          //
//                                                                         //
//         "KB3D_Range"  -  "KB3D_Speed"  -  "KB3D_ZOffset"                //
//                                                                         //
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//                                                                         //
//           System Requirements:   Basic WE - (NONE)                      //
//                                                                         //
//  The System uses implemented CheckWalkability System by PurgeandFire    //
//  You "can" remove the initialization trigger of PnF's System since      //
//  it is directly implemented in the System, all will work fine with or   //
//  without removing your Initializer trigger                              //
//                                                                         //
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//                                                                         //
//           Credits:                                                      //
//                                                                         //
//    *WEHZ & TS Helpers Group for helping in Script Fixes                 //
//    *Barry the Moose for helping in main codes and fixes                 //
//    *PurgeandFire for his CheckWalkability System                        //
//    *Vexorian / Nestharus for the GetCollision function                  //
//    *Rheiko for Beta Stages Testings                                     //
//                                                                         //
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//                                                                         //
//           How to Import?                                                //
//                                                                         //
//  1. Check that Create Unknown Variables is ticked in your WE Settings   //
//  2. Copy the Paste this Trigger                                         //
//  3. Congratulations, the System is now implemented in your map          //
//                                                                         //
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//                                                                         //
//           How to Use?                                                   //
//                                                                         //
//  1. There are 3 Examples of use in the KB3D Example Folder              //
//  2. Documentations are there in each of the 5 examples to help you      //
//  3. The KB3D System is an Ultra-Purpose System where you can use it for://
//     -Projectiles, the system supports homing so a projectile is easy    //
//     -Jump, the System's smoothness in the fly is useful for a jump spell//
//     -And of course, a 2D Knock-Back                                     //
//     -And More depending on your imagination                             //
//                                                                         //
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//                                                                         //
//           Bug Reports - Feedbacks                                       //
//                                                                         //
//  * We count on you to report bugs in the system, also telling the source//
//  * Feedbacks about the system are much appreciated                      //
//  * We mostly hope suggestions about enhancements for the System         //
//                                                                         //
/////////////////////////////////////////////////////////////////////////////

function SaveAttackTypeHandle takes hashtable hash, integer parentKey, integer childKey, attacktype at returns nothing
    call SaveInteger(hash, parentKey, childKey, GetHandleId(at))
endfunction
function LoadAttackTypeHandle takes hashtable hash, integer parentKey, integer childKey returns attacktype
    return ConvertAttackType(LoadInteger(hash, parentKey, childKey))
endfunction

function SaveDamageTypeHandle takes hashtable hash, integer parentKey, integer childKey, damagetype dt returns nothing
    call SaveInteger(hash, parentKey, childKey, GetHandleId(dt))
endfunction
function LoadDamageTypeHandle takes hashtable hash, integer parentKey, integer childKey returns damagetype
    return ConvertDamageType(LoadInteger(hash, parentKey, childKey))
endfunction

function KB3D_AlwaysNeg takes real R returns real//Used for redering some values always lower than 0
    if R > 0 then
        set R = R * -1
    endif
    return R
endfunction

function KB3D_AlwaysPos takes real R returns real//Used for redering some values always higher than 0
    if R < 0 then
        set R = R * -1
    endif
    return R
endfunction

function KB3D_InBetween takes real Min, real R, real Max returns real//Used to maintain values between 2 others
    if R < Min then
        set R = Min
    elseif R > Max then
        set R = Max
    endif
    return R
endfunction

function KB3D_IsInBetween takes real Min, real R, real Max returns boolean//Used to maintain values between 2 others
    if R < Min then
        return false
    elseif R > Max then
        return false
    endif
    return true
endfunction

function KB3D_RegisterUnitCollision takes unit u, real x, real y, integer i returns real //Somehow a library for UnitCollision function
    local real l = 0
    local real h = 300
    local real m = 150
    local real nm  
    loop
        if (IsUnitInRangeXY(u, x+m, y, 0)) then
            set l = m
        else
            set h = m
        endif
        set nm = (l+h)/2
        exitwhen nm+.001 >  m and nm-.001 < m
        set m = nm
    endloop
    set m = R2I(m*10)/10.
    call SaveReal( udg_KB3D_HA, 16, GetUnitTypeId(u), m )
    return m
endfunction

function KB3D_GetUnitCollision takes unit u returns real//Used to know the collision of a unit //Credits to Netharus// converted by malhorne
    local integer i = GetUnitTypeId(u)
    if HaveSavedReal( udg_KB3D_HA, 16, i) then
        return LoadReal(udg_KB3D_HA, 16, i)
    endif
    return KB3D_RegisterUnitCollision(u, GetUnitX(u), GetUnitY(u), i)
endfunction

function KB3D_Tree_Check takes destructable D returns boolean //Checks if a destructable is a tree
    local boolean B
    set B = IssueTargetOrder( udg_KB3D_Harvester, "harvest", D )
    call IssueImmediateOrder(udg_KB3D_Harvester, "stop")
    return B
endfunction

function KB3D_KillifTree takes destructable D returns nothing //Kills a destructable if it is a tree
    if ( KB3D_Tree_Check(D) ) then
        call KillDestructable(D)
    endif
endfunction

function KB3D_KillEnumDest takes nothing returns nothing //Function used in Enumeration loop
    call KB3D_KillifTree(GetEnumDestructable())
endfunction

function KB3D_CircleTreeKill takes real radius, real x, real y returns nothing//To destroy trees around the unit
    local rect r = Rect(x-radius, y-radius, x+radius, y+radius)
    call EnumDestructablesInRect(r, null, function KB3D_KillEnumDest)
    call RemoveRect(r)
    set r = null
endfunction

function KB3D_CW_Loop takes nothing returns nothing//function for item group loop for Check Walkability System
    if IsItemVisible(GetEnumItem()) then
        set udg_CP_HiddenItems[udg_CP_HiddenItemsIndex] = GetEnumItem()
        call SetItemVisible(udg_CP_HiddenItems[udg_CP_HiddenItemsIndex], false)
        set udg_CP_HiddenItemsIndex = ( udg_CP_HiddenItemsIndex + 1 )
    endif
endfunction

function KB3D_CW takes real x, real y returns boolean//Check Walkability System by PnF
    local real x2 = 0
    local real y2 = 0
    call MoveRectTo(udg_CP_Rect, x, y)
    call EnumItemsInRect(udg_CP_Rect, null, function KB3D_CW_Loop )
    call SetItemPosition(udg_CP_Item, x, y)
    set x2 = GetItemX(udg_CP_Item)
    set y2 = GetItemY(udg_CP_Item)
    call SetItemVisible(udg_CP_Item, false)
    loop
        exitwhen udg_CP_HiddenItemsIndex <= 0
        set udg_CP_HiddenItemsIndex = udg_CP_HiddenItemsIndex - 1
        call SetItemVisible(udg_CP_HiddenItems[udg_CP_HiddenItemsIndex], true)
        set udg_CP_HiddenItems[udg_CP_HiddenItemsIndex] = null
    endloop
    set udg_CP_PointIsWalkable = ((x2-x)*(x2-x) + (y2-y)*(y2-y) <= 100) and (not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY))
    return udg_CP_PointIsWalkable
endfunction

function KB3D_ClearInstance takes integer i returns nothing
    local integer x = 0
    call DestroyGroup(LoadGroupHandle(udg_KB3D_HA, 27, i))
    loop
        exitwhen x > 34
        call RemoveSavedHandle(udg_KB3D_HA, x, i)
        call SaveReal(udg_KB3D_HA, x, i, 0)
        set x = x +1
    endloop
endfunction

function MoveUnit_3D takes unit U, real x, real y, real z, real MaxZ, boolean B, boolean end, boolean OS, boolean KiOS returns nothing
    if (end) then
        call SetUnitFlyHeight(U, KB3D_InBetween(GetUnitDefaultFlyHeight(U), z, MaxZ), 750)
    else
        call SetUnitFlyHeight(U, KB3D_InBetween(GetUnitDefaultFlyHeight(U), z, MaxZ), 0)
    endif
    if ( not(B) or ( KB3D_CW(x, y) ) or (OS) ) then
        if (OS) then
            call SetUnitX(U, KB3D_InBetween(udg_KB3D_Reals[6], x, udg_KB3D_Reals[5]))
            call SetUnitY(U, KB3D_InBetween(udg_KB3D_Reals[8], y, udg_KB3D_Reals[7]))
            if (KiOS) and (not(KB3D_IsInBetween(udg_KB3D_Reals[2], x, udg_KB3D_Reals[1])) or not(KB3D_IsInBetween(udg_KB3D_Reals[4], x, udg_KB3D_Reals[3]))) then
                call KillUnit(U)
            endif
        else
            call SetUnitX(U, KB3D_InBetween(udg_KB3D_Reals[2], x, udg_KB3D_Reals[1]))
            call SetUnitY(U, KB3D_InBetween(udg_KB3D_Reals[4], y, udg_KB3D_Reals[3]))
        endif
    endif
endfunction

function KB3D_LineDamageLoop takes nothing returns boolean
    local unit U = GetFilterUnit()
    local integer Loop = R2I(udg_KB3D_Reals[0])
    local unit Damager = LoadUnitHandle(udg_KB3D_HA, 22, Loop)
    local attacktype AType = LoadAttackTypeHandle(udg_KB3D_HA, 20, Loop)
    local damagetype DType = LoadDamageTypeHandle(udg_KB3D_HA, 21, Loop)
    local real LineD = LoadReal(udg_KB3D_HA, 28, Loop)
    local unit U1 = LoadUnitHandle(udg_KB3D_HA, 0, Loop)
    local group G = LoadGroupHandle(udg_KB3D_HA, 27, Loop)
    if ( not( IsUnitType(U, UNIT_TYPE_STRUCTURE) ) and not( IsUnitType(U, UNIT_TYPE_MECHANICAL) ) and( IsUnitEnemy(U, GetOwningPlayer(U1))) and not ( IsUnitInGroup(U, G) ) ) then
        call GroupAddUnit(G, U)
        call UnitDamageTarget(Damager, U, LineD, true, false, AType, DType, WEAPON_TYPE_WHOKNOWS)
    endif
    set G = null
    set U = null
    set U1 = null
    set Damager = null
    return false
endfunction

function KB3D_AoEDamageLoop takes nothing returns boolean
    local unit U = GetFilterUnit()
    local integer Loop = R2I(udg_KB3D_Reals[0])
    local unit Damager = LoadUnitHandle(udg_KB3D_HA, 22, Loop)
    local attacktype AType = LoadAttackTypeHandle(udg_KB3D_HA, 20, Loop)
    local damagetype DType = LoadDamageTypeHandle(udg_KB3D_HA, 21, Loop)
    local real AoED = LoadReal(udg_KB3D_HA, 32, Loop)
    local unit U1 = LoadUnitHandle(udg_KB3D_HA, 0, Loop)
    if ( not( IsUnitType(U, UNIT_TYPE_STRUCTURE) ) and not( IsUnitType(U, UNIT_TYPE_MECHANICAL) ) and( IsUnitEnemy(U, GetOwningPlayer(U1))) ) then
        call UnitDamageTarget(Damager, U, AoED * 0.031250000, true, false, AType, DType, WEAPON_TYPE_WHOKNOWS)
    endif
    set U = null
    set U1 = null
    set Damager = null
    return false
endfunction

function KB3D_Loop takes integer Loop returns nothing//Main Trigger Loop
    //Create all the nessesary locals
    local unit U = LoadUnitHandle(udg_KB3D_HA, 0, Loop)
    local real X = GetUnitX(U)
    local real Y = GetUnitY(U)
    local real Z = GetUnitFlyHeight(U)
    local real x
    local real y
    local real z
    local real Range = LoadReal(udg_KB3D_HA, 1, Loop)
    local real Speed = LoadReal(udg_KB3D_HA, 2, Loop)
    local real Zoffset = LoadReal(udg_KB3D_HA, 3, Loop)
    local real Accel = LoadReal(udg_KB3D_HA, 4, Loop)
    local real Angle
    local real ZSpeed = LoadReal(udg_KB3D_HA, 12, Loop)
    local real ZAccel = LoadReal(udg_KB3D_HA, 13, Loop)
    local real ImpactD = LoadReal(udg_KB3D_HA, 17, Loop)
    local real LoopD = LoadReal(udg_KB3D_HA, 18, Loop)
    local real TargetD = LoadReal(udg_KB3D_HA, 19, Loop)
    local real LineD = LoadReal(udg_KB3D_HA, 28, Loop)
    local real AoE = LoadReal(udg_KB3D_HA, 29, Loop)
    local real ZT = LoadReal(udg_KB3D_HA, 26, Loop)
    local real AoED = LoadReal(udg_KB3D_HA, 32, Loop)
    local unit Target = LoadUnitHandle(udg_KB3D_HA, 5, Loop)
    local unit Damager = LoadUnitHandle(udg_KB3D_HA, 22, Loop)
    local boolean DisableUnit = LoadBoolean(udg_KB3D_HA, 6, Loop)
    local boolean UnpathableStop = LoadBoolean(udg_KB3D_HA, 7, Loop)
    local boolean DestroyTree = LoadBoolean(udg_KB3D_HA, 8, Loop)
    local boolean KillWhenHit = LoadBoolean(udg_KB3D_HA, 24, Loop)
    local boolean EndWhenHit = LoadBoolean(udg_KB3D_HA, 25, Loop)
    local boolean KiOS = LoadBoolean(udg_KB3D_HA, 33, Loop)
    local boolean OS = LoadBoolean(udg_KB3D_HA, 34, Loop)
    local boolean B = false
    local string Fx = LoadStr(udg_KB3D_HA, 9, Loop)
    local string Attach = LoadStr(udg_KB3D_HA, 10, Loop)
    local attacktype AType = LoadAttackTypeHandle(udg_KB3D_HA, 20, Loop)
    local damagetype DType = LoadDamageTypeHandle(udg_KB3D_HA, 21, Loop)
    local group g
    //end of locals
    if not (LoopD == 0) and not (Damager == null ) then//damage target with loop damage
        call UnitDamageTarget(Damager, U, LoopD, true, false, AType, DType, WEAPON_TYPE_WHOKNOWS)
    endif
    if ( Target == null ) then//know the angle of knockback line
        set Angle = LoadReal(udg_KB3D_HA, 5, Loop) + LoadReal(udg_KB3D_HA, 30, Loop)//if there is no unit target
    else
        set Angle = Atan2(GetUnitY(Target) - Y, GetUnitX(Target) - X)//if there is a unit target
    endif
    if LoadBoolean(udg_KB3D_HA, 31, Loop) then
        call SetUnitFacing(U, Angle * (180 / 3.14159))
    endif
    set Speed = Speed + ( Accel )//Increase the KB speed depending on the Acceleration
    set Range = Range - ( Speed )//Decrease distance traveled
    set ZSpeed = ZSpeed + ( ZAccel )//change the fly changing rate //Acceleration is for smoothness
    set x = X + ( Speed * Cos(Angle) )//new X location of the KBed unit
    set y = Y + ( Speed * Sin(Angle) )//new Y location of the KBed unit
    set z = Z + ( ZSpeed * 0.031250000 )//new Z Offset of the KBed unit
    set ZT = ZT + ( ZSpeed * 0.031250000 )//Total Height Changings
    if ( (Speed <= 0) or ( Range <= 0 ) or ( GetWidgetLife(U) <= 0 ) ) then
        set B = true
    endif
    call MoveUnit_3D(U, x, y, z, Zoffset, UnpathableStop, B, OS, KiOS)//Move the unit according to the X, Y, Z
    if (DestroyTree) then//Check if Destroy Tree is enabled
        call KB3D_CircleTreeKill( KB3D_InBetween(100, 4 * KB3D_GetUnitCollision(U), 500), x, y )//Destroy trees around target
    endif
    if not (Fx == "") then//create an effect on the unit
        if ( z > 20 ) then
            if not (Attach == "") then
                call DestroyEffect(AddSpecialEffectTarget(Fx, U, Attach))//attach the effect on the unit if he is flying
            endif
        else
            call DestroyEffect(AddSpecialEffect(Fx, x, y))//create the effect on his location if he is not flying
        endif
    endif
    if ( (UnpathableStop) and not ( KB3D_CW(x, y) ) ) and (not (ImpactD == 0) and not (Damager == null ) ) then//if the terrain is unpathable or if unpathable stop is disabled then..
        if ( KB3D_CW(x, y) ) then
            call SaveBoolean(udg_KB3D_HA, 23, Loop, true)
        endif
        if ( LoadBoolean(udg_KB3D_HA, 23, Loop) ) then
            call UnitDamageTarget(Damager, U, ImpactD, true, false, AType, DType, WEAPON_TYPE_WHOKNOWS)//Apply Impact Damage to the unit
            call SaveBoolean(udg_KB3D_HA, 23, Loop, false)
        endif
    endif
    if not(LineD == 0) and not(Damager == null) and not(AoE == 0) then//LineDamage
        set g = CreateGroup()
        set udg_KB3D_Reals[0] = I2R(Loop)
        call GroupEnumUnitsInRange(udg_KB3D_Group, x, y, KB3D_AlwaysPos(AoE), Filter(function KB3D_LineDamageLoop))
        call DestroyGroup(g)
        set g = null
    endif
    if not(AoED == 0) and not(Damager == null) and not(AoE == 0) then//LoopDamage
        set g = CreateGroup()
        set udg_KB3D_Reals[0] = I2R(Loop)
        call GroupEnumUnitsInRange(udg_KB3D_Group, x, y, KB3D_AlwaysPos(AoE), Filter(function KB3D_AoEDamageLoop))
        call DestroyGroup(g)
        set g = null
    endif
    if ( DisableUnit ) then//disable the unit partially
        call SetUnitPropWindow(U, 0)
        call SetUnitTurnSpeed(U, 0)
    endif
    if not(Target == null) then
        if (SquareRoot ( ( GetUnitX(Target) - x ) * ( GetUnitX(Target) - x ) + ( GetUnitY(Target) - y ) * ( GetUnitY(Target) - y ) ) < KB3D_InBetween(75, KB3D_GetUnitCollision(U) + KB3D_GetUnitCollision(Target), 999)) then
            if not (TargetD == 0) and not(Damager == null) then
                call UnitDamageTarget(Damager, Target, TargetD, true, false, AType, DType, WEAPON_TYPE_WHOKNOWS)
                call SaveReal(udg_KB3D_HA, 19, Loop, 0)
            endif
            if (KillWhenHit) then
                call KillUnit(U)
            endif
            if (EndWhenHit) then
                call SaveReal(udg_KB3D_HA, 4, Loop, KB3D_AlwaysNeg(Speed))
                call SaveReal(udg_KB3D_HA, 3, Loop, GetUnitFlyHeight(U) - ZT)
            endif
        endif
    endif
    ////// Stop All
    if ( (Speed <= 0) or ( Range <= 0 ) or ( GetWidgetLife(U) <= 0 ) ) then
        call SaveBoolean(udg_KB3D_HA, 55, Loop, false)
        set udg_KB3D_Instances = udg_KB3D_Instances - 1
        if ( GetWidgetLife(U) <= 0 ) then
            call SetUnitFlyHeight(U, GetUnitDefaultFlyHeight(U), 750 )
        endif
        call SetUnitPropWindow(U, LoadReal(udg_KB3D_HA, 15, Loop)*3.14159/180)
        call SetUnitTurnSpeed(U, GetUnitDefaultTurnSpeed(U))
        if HaveSavedHandle(udg_KB3D_HA, 14, Loop) then
            call DestroyEffect(LoadEffectHandle(udg_KB3D_HA, 14, Loop))
        endif
        call KB3D_ClearInstance(Loop)
    else
        ////// Save Changes
        call SaveReal(udg_KB3D_HA, 1, Loop, Range)
        call SaveReal(udg_KB3D_HA, 2, Loop, Speed)
        call SaveReal(udg_KB3D_HA, 5, Loop, Angle)
        call SaveReal(udg_KB3D_HA, 12, Loop, ZSpeed)
        call SaveReal(udg_KB3D_HA, 26, Loop, ZT)
    endif
    ////// Clear
    set U = null
    set Target = null
    set Damager = null
endfunction

function KB3D_Loop_Actions takes nothing returns nothing//loop triggerer
    local integer x = 0
    loop
        exitwhen x >= udg_KB3D_Counter
        set x = x + 1
        if ( LoadBoolean(udg_KB3D_HA, 55, x) ) then
            call KB3D_Loop(x)
        endif
    endloop
    if ( udg_KB3D_Instances == 0 ) then
        set udg_KB3D_Counter = 0
        call PauseTimer(udg_KB3D_Timer)
    endif
endfunction

function KB3D_Registration takes nothing returns boolean//register an instance in the System
    local real Time
    local real R
    local real R1
    set udg_KB3D_Arc = KB3D_InBetween(-10, udg_KB3D_Arc, 10)
    set udg_KB3D_Range = KB3D_InBetween(0.01, KB3D_AlwaysPos(udg_KB3D_Range), KB3D_AlwaysPos(udg_KB3D_Range))
    set udg_KB3D_Speed = KB3D_InBetween(0.01, KB3D_AlwaysPos(udg_KB3D_Speed), KB3D_AlwaysPos(udg_KB3D_Speed))
    set udg_KB3D_Counter = udg_KB3D_Counter + 1
    set udg_KB3D_Instances = udg_KB3D_Instances + 1
    set udg_KB3D_Zoffset = (1.85 * KB3D_AlwaysPos(udg_KB3D_Zoffset))+GetUnitDefaultFlyHeight(udg_KB3D_Unit)
    call SaveUnitHandle( udg_KB3D_HA, 0, udg_KB3D_Counter, udg_KB3D_Unit )
    call SaveReal( udg_KB3D_HA, 1, udg_KB3D_Counter, udg_KB3D_Range )
    call SaveReal( udg_KB3D_HA, 2, udg_KB3D_Counter, udg_KB3D_Speed * 0.031250000 )
    call SaveReal( udg_KB3D_HA, 4, udg_KB3D_Counter, udg_KB3D_Accel * 0.031250000 * 0.031250000 )
    if ( udg_KB3D_Targeted_Unit == null ) then
        call SaveReal( udg_KB3D_HA, 5, udg_KB3D_Counter, udg_KB3D_Angle * 3.14159 / 180 )
    else
        call SaveUnitHandle( udg_KB3D_HA, 5, udg_KB3D_Counter, udg_KB3D_Targeted_Unit )
    endif
    call SaveBoolean( udg_KB3D_HA, 6, udg_KB3D_Counter, udg_KB3D_DisableUnit )
    call SaveBoolean( udg_KB3D_HA, 7, udg_KB3D_Counter, udg_KB3D_UnpathableStop )
    call SaveBoolean( udg_KB3D_HA, 8, udg_KB3D_Counter, udg_KB3D_DestroyTree )
    call SaveStr( udg_KB3D_HA, 9, udg_KB3D_Counter, udg_KB3D_Fx )
    call SaveStr( udg_KB3D_HA, 10, udg_KB3D_Counter, udg_KB3D_Fx_Attach )
    if ( udg_KB3D_Accel == 0.00 ) then
        set Time = udg_KB3D_Range / (udg_KB3D_Speed)//calculating time for the knockback if Acceleration = 0
    else
        if ( udg_KB3D_Accel > 0 ) then
            set Time = (( -2*(udg_KB3D_Speed) + SquareRoot((4*udg_KB3D_Speed) + (8*udg_KB3D_Accel*udg_KB3D_Range ) ) / (2*udg_KB3D_Accel) ))//calculating time for the knockback if Acceleration > 0
        endif
        if ( udg_KB3D_Accel < 0 ) then
            set R = ( - 1 * (udg_KB3D_Speed) / udg_KB3D_Accel )
            set R1 = (0.5 * udg_KB3D_Accel * R * R) + ((udg_KB3D_Speed) * R)
            if R1 < udg_KB3D_Range then
                set Time = R//calculating time for the knockback if Acceleration < 0 and if the speed will be = 0 before reaching max range
            else
                set Time = KB3D_AlwaysPos(( -2*(udg_KB3D_Speed) + SquareRoot(KB3D_AlwaysPos((4*(udg_KB3D_Speed)*(udg_KB3D_Speed)) + (8*udg_KB3D_Accel*udg_KB3D_Range) )) ) / (2*udg_KB3D_Accel) )//calculating time for the knockback if Acceleration < 0 and if the speed will be > 0 before reaching max range
            endif
        endif
    endif
    call SaveReal( udg_KB3D_HA, 11, udg_KB3D_Counter, Time )
    call SaveBoolean( udg_KB3D_HA, 55, udg_KB3D_Counter, true )
    if UnitAddAbility(udg_KB3D_Unit, 'Amrf') then
        call UnitRemoveAbility(udg_KB3D_Unit, 'Amrf')
    endif
    call SaveReal( udg_KB3D_HA, 3, udg_KB3D_Counter, udg_KB3D_Zoffset )
    call SaveReal( udg_KB3D_HA, 12, udg_KB3D_Counter, (udg_KB3D_Zoffset / ( Time / 2)) )
    call SaveReal( udg_KB3D_HA, 13, udg_KB3D_Counter, KB3D_AlwaysNeg(( -1 * udg_KB3D_Zoffset / ( Time / 2) ) / ( Time / 2)) * 0.031250000 )
    if not (udg_KB3D_TrailFx == "") and not (udg_KB3D_Fx_Attach == "") then
        call SaveEffectHandle(udg_KB3D_HA, 14, udg_KB3D_Counter, AddSpecialEffectTarget(udg_KB3D_TrailFx, udg_KB3D_Unit, udg_KB3D_Fx_Attach))
    endif
    call SaveReal( udg_KB3D_HA, 15, udg_KB3D_Counter, GetUnitDefaultPropWindow(udg_KB3D_Unit) )
    call SaveReal( udg_KB3D_HA, 17, udg_KB3D_Counter, udg_KB3D_ImpactDamage )
    call SaveReal( udg_KB3D_HA, 18, udg_KB3D_Counter, udg_KB3D_LoopDamage * 0.031250000 )
    call SaveReal( udg_KB3D_HA, 19, udg_KB3D_Counter, udg_KB3D_TargetDamage )
    call SaveAttackTypeHandle( udg_KB3D_HA, 20, udg_KB3D_Counter, udg_KB3D_AttackType )
    call SaveDamageTypeHandle( udg_KB3D_HA, 21, udg_KB3D_Counter, udg_KB3D_DamageType )
    call SaveUnitHandle( udg_KB3D_HA, 22, udg_KB3D_Counter, udg_KB3D_Damager )
    call SaveBoolean( udg_KB3D_HA, 23, udg_KB3D_Counter, true )
    call SaveBoolean( udg_KB3D_HA, 24, udg_KB3D_Counter, udg_KB3D_KillWhenHit )
    if (udg_KB3D_KillWhenHit) then
        set udg_KB3D_EndWhenHit = true
    endif
    call SaveBoolean( udg_KB3D_HA, 25, udg_KB3D_Counter, udg_KB3D_EndWhenHit )
    call SaveGroupHandle(udg_KB3D_HA, 27, udg_KB3D_Counter, CreateGroup() )
    call SaveReal( udg_KB3D_HA, 28, udg_KB3D_Counter, udg_KB3D_LineDamage )
    call SaveReal( udg_KB3D_HA, 29, udg_KB3D_Counter, KB3D_AlwaysPos(udg_KB3D_AoE) )
    call SaveReal( udg_KB3D_HA, 30, udg_KB3D_Counter, udg_KB3D_Arc * (3.14159/180) )
    call SaveBoolean( udg_KB3D_HA, 31, udg_KB3D_Counter, udg_KB3D_FaceAngle )
    call SaveReal( udg_KB3D_HA, 32, udg_KB3D_Counter, udg_KB3D_AoEDamage )
    call SaveBoolean( udg_KB3D_HA, 33, udg_KB3D_Counter, udg_KB3D_KillifOutSider )
    if (udg_KB3D_KillifOutSider) then
        set udg_KB3D_AllowOutSiding = true
    endif
    call SaveBoolean( udg_KB3D_HA, 34, udg_KB3D_Counter, udg_KB3D_AllowOutSiding )
    //Nulling
    set udg_KB3D_Accel = 0.00
    set udg_KB3D_AllowOutSiding = false
    set udg_KB3D_Angle = 0.00
    set udg_KB3D_AoE = 0.00
    set udg_KB3D_Arc = 0.00
    set udg_KB3D_AoEDamage = 0.00
    set udg_KB3D_AttackType = ATTACK_TYPE_NORMAL
    set udg_KB3D_DamageType = DAMAGE_TYPE_MAGIC
    set udg_KB3D_Damager = null
    set udg_KB3D_DestroyTree = false
    set udg_KB3D_DisableUnit = false
    set udg_KB3D_EndWhenHit = false
    set udg_KB3D_Fx = ""
    set udg_KB3D_Fx_Attach = ""
    set udg_KB3D_ImpactDamage = 0.00
    set udg_KB3D_KillWhenHit = false
    set udg_KB3D_FaceAngle = false
    set udg_KB3D_KillifOutSider = false
    set udg_KB3D_LineDamage = 0.00
    set udg_KB3D_LoopDamage = 0.00
    set udg_KB3D_Range = 0.00
    set udg_KB3D_Speed = 0.00
    set udg_KB3D_TargetDamage = 0.00
    set udg_KB3D_Targeted_Unit = null
    set udg_KB3D_TrailFx = ""
    set udg_KB3D_Unit = null
    set udg_KB3D_UnpathableStop = true
    set udg_KB3D_Zoffset = 0.00
    if ( udg_KB3D_Counter == 1 ) then
        call TimerStart(udg_KB3D_Timer, 0.031250000, true, function KB3D_Loop_Actions )
    endif
    set udg_KB3D_Time = Time
    return false
endfunction

//===========================================================================
function InitTrig_KB3D takes nothing returns nothing
    ////////REGISTRATION
    set udg_KB3D_Registration = CreateTrigger(  )
    call TriggerAddCondition( udg_KB3D_Registration, Condition(function KB3D_Registration) )
    set udg_KB3D_Harvester = CreateUnit(Player(15), 'hpea', 0, 0, 0)
    call ShowUnit(udg_KB3D_Harvester, false)
    call UnitAddAbility(udg_KB3D_Harvester, 'Aloc')
    set udg_KB3D_HA = InitHashtable()
    ////////Check Walkability System by PnF
    set udg_CP_Rect = Rect(0, 0, 128.00, 128.00)
    set udg_CP_Item = CreateItem('wtlg', 0, 0)
    call SetItemVisible( udg_CP_Item, false )
    ////////InitReals
    set udg_KB3D_Reals[1] = GetRectMaxX(bj_mapInitialPlayableArea)
    set udg_KB3D_Reals[2] = GetRectMinX(bj_mapInitialPlayableArea)
    set udg_KB3D_Reals[3] = GetRectMaxY(bj_mapInitialPlayableArea)
    set udg_KB3D_Reals[4] = GetRectMinY(bj_mapInitialPlayableArea)
    set udg_KB3D_Reals[5] = GetRectMaxX(GetWorldBounds())
    set udg_KB3D_Reals[6] = GetRectMinX(GetWorldBounds())
    set udg_KB3D_Reals[7] = GetRectMaxY(GetWorldBounds())
    set udg_KB3D_Reals[8] = GetRectMinY(GetWorldBounds())
endfunction

tell me where i did it wrong? :vw_death:
 
A random seed is basicly a pre-generated sequence of random numbers that the game uses in all random calculations.

When using a fixed random seed, a game designer can make sure that when doing exactly the same thing at the same time, the result will always be deterministic in every game session.

This is very useful for example in cinematics, where you don't want true randomness for artistic reasons.


Unchecking the "use fixed random seed" box will make sure that the RNG will always throw out truly random values on every game session, even if you do exactly the same.
 
Status
Not open for further replies.
Top