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

Knockback not working

Status
Not open for further replies.
Level 6
Joined
Apr 5, 2013
Messages
154
Trying to do a passive that has a chance of knocking an enemy unit back, but the unit that is to be knocked back always goes to the same direction, and that's to the west, never to the facing of the attacking unit. it worked just fine before i tinkered around with adding the damage to it.
  • Storm Strike Learn
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to StormStrike
    • Actions
      • Set StormStrikeCaster = (Triggering unit)
  • [/hidden]
[trigger=The Attacking Script]Storm Strike
Events
Unit - A unit Is attacked
Conditions
((Attacking unit) has buff Storm Strike ) Equal to True
Actions
Set StormStrikeChance = (Random integer number between 1 and 100)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
StormStrikeChance Greater than or equal to 1
Then - Actions
Trigger - Turn off (This trigger)
Set StormStrikeCasterPoint = (Position of StormStrikeCaster)
Set StormStrikeTarget = (Attacked unit)
Unit - Create 1 Storm Strike Stunner for Neutral Passive at StormStrikeCasterPoint facing Default building facing degrees
Set StormStrikeStunner = (Last created unit)
Unit - Add a 1.00 second Generic expiration timer to StormStrikeStunner
Wait 0.10 seconds
Unit - Cause StormStrikeCaster to damage StormStrikeTarget, dealing ((Real((Strength of StormStrikeCaster (Include bonuses)))) x ((Real((Level of StormStrike for StormStrikeCaster))) + (0.50 x (Real((Level of StormStrike for StormStrikeCaster)))))) damage of attack type Normal and damage type Lightning
Special Effect - Create a special effect attached to the origin of StormStrikeTarget using Abilities\Weapons\Bolt\BoltImpact.mdl
Special Effect - Destroy (Last created special effect)
Unit - Order StormStrikeStunner to Neutral - Firebolt StormStrikeTarget
Trigger - Turn on Storm Strike Knockback <gen>
Wait 1.00 seconds
Trigger - Turn on (This trigger)
Custom script: call RemoveLocation(udg_StormStrikeCasterPoint)
Trigger - Turn off Storm Strike Knockback <gen>
Else - Actions
[/trigger]


[trigger=Knockback]Storm Strike Knockback
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
Unit - Move StormStrikeTarget instantly to ((Position of StormStrikeTarget) offset by 5.00 towards (Angle from StormStrikeCasterPoint to (Position of StormStrikeTarget)) degrees)
Special Effect - Create a special effect attached to the origin of StormStrikeTarget using Abilities\Weapons\BallistaMissile\BallistaImpact.mdl
Special Effect - Destroy (Last created special effect)
[/trigger]
 
Level 11
Joined
Jan 23, 2015
Messages
788
Make it like this:

  • Actions:
    • Set StormStrikeTempPoint = (StormStrikeCasterPoint offset by (Distance between StormStrikeTargetPoint and StormStrikeCasterPoint) towards (Angle from StormStrikeCasterPoint to StormStrikeTargetPoint) degrees)
    • Custom script: call SetUnitX((udg_StormStrikeTarget),GetLocationX(udg_StormStrikeTempPoint))
    • Custom script: call SetUnitY((udg_StormStrikeTarget),GetLocationY(udg_StormStrikeTempPoint))
    • Custom script: call RemoveLocation(udg_StormStrikeTempPoint)
 
Status
Not open for further replies.
Top