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

[Trigger] Help With KnockBack

Status
Not open for further replies.
Level 4
Joined
Feb 17, 2007
Messages
121
The knockBack System from paladon works but then im looking for a passive knockback. any one want to help? Any one want to help make it passive?
Regular triggers from paladon but edited but didnt seem to work for passive.

  • Cast A Knockback
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (KBA_TargetUnit is in KB_KnockbackedUnits) Equal to True
        • Then - Actions
          • Unit Group - Remove KBA_TargetUnit from KB_KnockbackedUnits
          • Set KB_CountBuffs = (KB_CountBuffs - 1)
          • For each (Integer KB_GeneralIntegers[2]) from 1 to KB_TotalKnockUnits, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • KB_Units[KB_GeneralIntegers[1]] Equal to KBA_TargetUnit
                • Then - Actions
                  • Set KB_GeneralIntegers[1] = KB_GeneralIntegers[2]
                  • Set KB_GeneralIntegers[2] = KB_TotalKnockUnits
                • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • KB_TotalKnockUnits Greater than KB_GeneralIntegers[1]
            • Then - Actions
              • Set KB_Levels[KB_GeneralIntegers[1]] = KB_Levels[KB_TotalKnockUnits]
              • Set KB_Units[KB_GeneralIntegers[1]] = KB_Units[KB_TotalKnockUnits]
              • Set KB_Angle[KB_GeneralIntegers[1]] = KB_Angle[KB_TotalKnockUnits]
              • Set KB_MaxDistance[KB_GeneralIntegers[1]] = KB_MaxDistance[KB_TotalKnockUnits]
              • Set KB_ReachedDistance[KB_GeneralIntegers[1]] = KB_ReachedDistance[KB_TotalKnockUnits]
              • Set KB_ReduceSpeedReal[KB_GeneralIntegers[1]] = KB_ReduceSpeedReal[KB_TotalKnockUnits]
              • Set KB_SpecificSpeed[KB_GeneralIntegers[1]] = KB_SpecificSpeed[KB_TotalKnockUnits]
              • Set KB_Effects_1[KB_GeneralIntegers[1]] = KB_Effects_1[KB_TotalKnockUnits]
              • Set KB_Effects_2[KB_GeneralIntegers[1]] = KB_Effects_2[KB_TotalKnockUnits]
              • Set KB_DestroyTrees[KB_GeneralIntegers[1]] = KB_DestroyTrees[KB_TotalKnockUnits]
              • Set KB_EffectCounter[KB_GeneralIntegers[1]] = KB_EffectCounter[KB_TotalKnockUnits]
              • Set KB_EffectCounter2[KB_GeneralIntegers[1]] = KB_EffectCounter2[KB_TotalKnockUnits]
              • Set KB_GeneralIntegers[1] = (KB_GeneralIntegers[1] - 1)
            • Else - Actions
          • Set KB_Units[KB_TotalKnockUnits] = No unit
          • Set KB_TotalKnockUnits = (KB_TotalKnockUnits - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • KB_CountBuffs Equal to 0
            • Then - Actions
              • Set KB_TotalKnockUnits = 0
              • Trigger - Turn off Get Knockback <gen>
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • KB_CountBuffs Equal to 0
        • Then - Actions
          • Trigger - Turn on Get Knockback <gen>
        • Else - Actions
      • Set KB_CountBuffs = (KB_CountBuffs + 1)
      • Set KB_TotalKnockUnits = (KB_TotalKnockUnits + 1)
      • Set KB_Casters[KB_TotalKnockUnits] = KBA_Caster
      • Set KB_Levels[KB_TotalKnockUnits] = KBA_Level
      • Set KB_Units[KB_TotalKnockUnits] = KBA_TargetUnit
      • Set KB_StartPositions[KB_TotalKnockUnits] = KBA_StartingPosition
      • Set KB_TempPoint[KB_TotalKnockUnits] = (Position of KBA_TargetUnit)
      • Set KB_Angle[KB_TotalKnockUnits] = (Angle from KB_StartPositions[KB_TotalKnockUnits] to KB_TempPoint[KB_TotalKnockUnits])
      • Set KB_MaxDistance[KB_TotalKnockUnits] = (KBA_DistancePerLevel x (Real(KBA_Level)))
      • Set KB_ReachedDistance[KB_TotalKnockUnits] = 0.00
      • Set KB_ReduceSpeedReal[KB_GeneralIntegers[1]] = 0.00
      • Set KB_SpecificSpeed[KB_TotalKnockUnits] = KBA_Speed
      • Set KB_Effects_1[KB_TotalKnockUnits] = KBA_SpecialEffects[1]
      • Set KB_Effects_2[KB_TotalKnockUnits] = KBA_SpecialEffects[2]
      • Set KB_DestroyTrees[KB_TotalKnockUnits] = KBA_DestroyTrees
      • Set KB_EffectCounter[KB_GeneralIntegers[1]] = 0
      • Set KB_EffectCounter2[KB_GeneralIntegers[1]] = 0
      • Unit Group - Add KBA_TargetUnit to KB_KnockbackedUnits
      • Custom script: call RemoveLocation (udg_KBA_StartingPosition)
      • Custom script: call RemoveLocation (udg_KB_TempPoint [udg_KB_TotalKnockUnits] )
      • Custom script: call RemoveLocation (udg_KB_StartPositions [udg_KB_TotalKnockUnits] )
  • Get Knockback
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer KB_GeneralIntegers[1]) from 1 to KB_TotalKnockUnits, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (KB_Units[KB_GeneralIntegers[1]] is in KB_KnockbackedUnits) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • KB_ReachedDistance[KB_GeneralIntegers[1]] Greater than or equal to KB_MaxDistance[KB_GeneralIntegers[1]]
                • Then - Actions
                  • Unit Group - Remove KB_Units[KB_GeneralIntegers[1]] from KB_KnockbackedUnits
                  • Set KB_CountBuffs = (KB_CountBuffs - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • KB_TotalKnockUnits Greater than KB_GeneralIntegers[1]
                    • Then - Actions
                      • Set KB_Levels[KB_GeneralIntegers[1]] = KB_Levels[KB_TotalKnockUnits]
                      • Set KB_Units[KB_GeneralIntegers[1]] = KB_Units[KB_TotalKnockUnits]
                      • Set KB_Angle[KB_GeneralIntegers[1]] = KB_Angle[KB_TotalKnockUnits]
                      • Set KB_MaxDistance[KB_GeneralIntegers[1]] = KB_MaxDistance[KB_TotalKnockUnits]
                      • Set KB_ReachedDistance[KB_GeneralIntegers[1]] = KB_ReachedDistance[KB_TotalKnockUnits]
                      • Set KB_ReduceSpeedReal[KB_GeneralIntegers[1]] = KB_ReduceSpeedReal[KB_TotalKnockUnits]
                      • Set KB_SpecificSpeed[KB_GeneralIntegers[1]] = KB_SpecificSpeed[KB_TotalKnockUnits]
                      • Set KB_Effects_1[KB_GeneralIntegers[1]] = KB_Effects_1[KB_TotalKnockUnits]
                      • Set KB_Effects_2[KB_GeneralIntegers[1]] = KB_Effects_2[KB_TotalKnockUnits]
                      • Set KB_DestroyTrees[KB_GeneralIntegers[1]] = KB_DestroyTrees[KB_TotalKnockUnits]
                      • Set KB_EffectCounter[KB_GeneralIntegers[1]] = KB_EffectCounter[KB_TotalKnockUnits]
                      • Set KB_EffectCounter2[KB_GeneralIntegers[1]] = KB_EffectCounter2[KB_TotalKnockUnits]
                      • Set KB_GeneralIntegers[1] = (KB_GeneralIntegers[1] - 1)
                    • Else - Actions
                  • Set KB_Units[KB_TotalKnockUnits] = No unit
                  • Set KB_TotalKnockUnits = (KB_TotalKnockUnits - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • KB_CountBuffs Equal to 0
                    • Then - Actions
                      • Set KB_TotalKnockUnits = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
                  • Set KB_ReducedReal = ((KB_SpecificSpeed[KB_GeneralIntegers[1]] / KB_MaxDistance[KB_GeneralIntegers[1]]) x KB_ReachedDistance[KB_GeneralIntegers[1]])
                  • Set KB_ReduceSpeedReal[KB_GeneralIntegers[1]] = (KB_ReducedReal - (KB_ReduceSpeedReal[KB_GeneralIntegers[1]] x 0.10))
                  • Set KB_TempReal = ((KB_SpecificSpeed[KB_GeneralIntegers[1]] - KB_ReduceSpeedReal[KB_GeneralIntegers[1]]) x 2.00)
                  • Set KB_TempPoint[1] = (Position of KB_Units[KB_GeneralIntegers[1]])
                  • Set KB_TempPoint[2] = (KB_TempPoint[1] offset by KB_TempReal towards KB_Angle[KB_GeneralIntegers[1]] degrees)
                  • Set KB_EffectCounter[KB_GeneralIntegers[1]] = (KB_EffectCounter[KB_GeneralIntegers[1]] + 1)
                  • Set KB_EffectCounter2[KB_GeneralIntegers[1]] = (KB_EffectCounter2[KB_GeneralIntegers[1]] + 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • KB_DestroyTrees[KB_GeneralIntegers[1]] Equal to True
                    • Then - Actions
                      • Destructible - Pick every destructible within 200.00 of KB_TempPoint[2] and do (Actions)
                        • Loop - Actions
                          • Destructible - Kill (Picked destructible)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • KB_EffectCounter[KB_GeneralIntegers[1]] Equal to 6
                    • Then - Actions
                      • Set KB_EffectCounter[KB_GeneralIntegers[1]] = 0
                      • Special Effect - Create a special effect at KB_TempPoint[1] using KB_Effects_1[KB_GeneralIntegers[1]]
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • KB_EffectCounter2[KB_GeneralIntegers[1]] Equal to 8
                    • Then - Actions
                      • Set KB_EffectCounter2[KB_GeneralIntegers[1]] = 0
                      • Special Effect - Create a special effect at KB_TempPoint[1] using KB_Effects_2[KB_GeneralIntegers[1]]
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                  • Unit - Move KB_Units[KB_GeneralIntegers[1]] instantly to KB_TempPoint[2]
                  • Custom script: call RemoveLocation (udg_KB_TempPoint[1])
                  • Custom script: call RemoveLocation (udg_KB_TempPoint[2])
                  • Set KB_ReachedDistance[KB_GeneralIntegers[1]] = (KB_ReachedDistance[KB_GeneralIntegers[1]] + KB_TempReal)
            • Else - Actions



THE TRIGGER USING.


  • KnockBack
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Immobile Punch
    • Actions
      • -------- This are the applied actions of the 'Actions to apply' trigger. --------
      • Set KBA_Caster = (Triggering unit)
      • Set KBA_TargetUnit = (Target unit of ability being cast)
      • Set KBA_StartingPosition = (Position of (Triggering unit))
      • Set KBA_Level = (Level of (Ability being cast) for (Triggering unit))
      • Set KBA_Speed = 7.00
      • Set KBA_DistancePerLevel = 100.00
      • Set KBA_SpecialEffects[1] = Abilities\Spells\Undead\OrbOfDeath\OrbOfDeathMissile.mdl
      • Set KBA_SpecialEffects[2] = Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
      • Set KBA_DestroyTrees = True
      • Trigger - Run Cast A Knockback <gen> (checking conditions)
      • -------- --------
 
Level 12
Joined
Aug 22, 2008
Messages
911
Don't use "unit is attacked", you need a damage detection system for the passive knockback.
Or on the other hand you might create a dummy at the position of the attacking unit that has cast backswing that is equal to the unit's animation backswing, and order it to cast a spell on the attacked unit. Then you could detect when the dummy would be casting the spell but that would be much more complicated because you'd need to include stuns in the middle and stuff.
 
Level 4
Joined
Feb 17, 2007
Messages
121
Here's a passive knockback system. With some modifications, I think it is what you're looking for. Currently it isn't bound to any skill, but that is easy to accomplish.

yes like that but how can i add or fixx and make it bound with a ability..
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Create an ability, copy-and-paste Critical Strike for example. Remove all damage modifiers and other thingies from it, so it does nothing.

Give your unit the ability in object manager.

Then there's the trigger that picks up every unit in the map and gives them the knockback. Change the trigger so that it picks all units of type <unit type that can have the ability> that have the ability level higher than 0.

  • Set Temp_Group_1 = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Footman) and ((Level of Acid Bomb for (Matching unit)) Greater than 0)))
Change the unit type and the ability.


Then create another trigger with the event <Units learns a skill>

  • Untitled Trigger 001
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Human Archmage - Blizzard
      • (Level of Blizzard for (Triggering unit)) Equal to 1
    • Actions
      • Trigger - Add to Knockback <gen> the event (Unit - (Triggering unit) Takes damage)
Again, change the skill to the passive ability you created.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Notice that the trigger does not factor in the level of the ability. Currently there's 25 % chance for the attacking unit to get knocked back.

Change that one line to this:

  • Temp_Integer_1 Less than or equal to (10 + (10 x (Level of Acid Bomb for (Triggering unit))))
This gives the attacked unit 20/30/40 chance to knock back attacking units. Find values that please you.

Also, the trigger knocks back all units that damage the unit. You may want to do unit type check or something to prevent ranged unit from being knocked back.
 
Status
Not open for further replies.
Top