• 🏆 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 spell problem - It only works once.

Status
Not open for further replies.
Level 2
Joined
Oct 29, 2013
Messages
6
Hello. I'm working on a map project and I want one of the heroes to have a knockback spell, and it works fine once but after the first use it doesn't work properly, because the target isn't knocked back at all. I'm using Bribe's GUI friendly damage detection system. Thank you in advance for any help. :)

Here are the triggers:
  • Powershot
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (DamageEventTarget has buff Dummy with no visuals (Elihana)) Equal to True
      • (Level of Powershot for DamageEventSource) Greater than or equal to 1
    • Actions
      • -------- Set values for knockback trigger --------
      • Set powerShotDistance = (300.00 x 0.04)
      • Set powershotCastLoc = (Position of DamageEventSource)
      • Set powershotLoc = (Position of DamageEventTarget)
      • Set powershotAngle = (Angle from powershotCastLoc to powershotLoc)
      • Set powershotTime = 1.00
      • Custom script: set udg_hashKey = GetHandleId(udg_DamageEventTarget)
      • Hashtable - Save powerShotDistance as (Key distance) of hashKey in powershotTable
      • Hashtable - Save powershotAngle as (Key angle) of hashKey in powershotTable
      • Hashtable - Save powershotTime as (Key time) of hashKey in powershotTable
      • Unit Group - Add DamageEventTarget to powershotGroup
      • -------- Damage --------
      • Set tempReal = (Real((Agility of rangerGeneral (Include bonuses))))
      • Floating Text - Create floating text that reads (String((Integer(tempReal)))) at powershotLoc with Z offset 0.00, using font size 8.00, color (100.00%, 1.00%, 1.00%), and 0.00% transparency
      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Trigger - Turn off (This trigger)
      • Unit - Cause DamageEventSource to damage DamageEventTarget, dealing tempReal damage of attack type Hero and damage type Normal
      • Trigger - Turn on (This trigger)
      • Custom script: call RemoveLocation( udg_powershotLoc )
      • Custom script: call RemoveLocation( udg_powershotCastLoc )
  • Powershot Loop
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in powershotGroup and do (Actions)
        • Loop - Actions
          • Set powerShotDistance = (Load (Key distance) of (Key (Picked unit)) from powershotTable)
          • Set powershotAngle = (Load (Key angle) of (Key (Picked unit)) from powershotTable)
          • Set powershotTime = (Load (Key time) of (Key (Picked unit)) from powershotTable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • powershotTime Greater than 0.00
            • Then - Actions
              • Set tempLoc = (Position of (Picked unit))
              • Set powerShotLoc = (tempLoc offset by powerShotDistance towards powershotAngle degrees)
              • Unit - Move (Picked unit) instantly to powershotLoc
              • Special Effect - Create a special effect attached to the origin of (Picked unit) using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
              • Special Effect - Destroy (Last created special effect)
              • Hashtable - Save (powershotTime - 0.04) as (Key time) of (Key (Picked unit)) in powershotTable
              • Custom script: call RemoveLocation( udg_tempLoc )
              • Custom script: call RemoveLocation( udg_powershotLoc )
            • Else - Actions
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in powershotTable
              • Unit Group - Remove (Picked unit) from powershotGroup
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in powershotGroup) Equal to 0
                • Then - Actions
                  • Custom script: call DestroyGroup( udg_powershotGroup )
                • Else - Actions
 
Last edited:
Level 8
Joined
Jan 28, 2016
Messages
486
For the Cast trigger, add an If-Then-Else statement after adding the unit to the group which checks if there is only one unit in the group. If so, turn on the Loop trigger.

For the Loop trigger, instead of destroying the group when it's empty, turn off the trigger. In this case, you don't need to destroy the group because it will be constantly used. You would need to have the checkbox "Initially On" unchecked for this trigger as well.

  • Powershot
    • Events
    • Conditions
    • Actions
      • -------- For the Cast trigger, add the If-Then-Else after adding the unit to the group --------
      • Unit Group - Add DamageEventTarget to powershotGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in powershotGroup) Equal to 1
        • Then - Actions
          • Trigger - Turn on Powershot Loop <gen>
        • Else - Actions
      • -------- --- --------
      • -------- --- --------
      • -------- For the Loop trigger, instead of destroying the group just turn off the trigger if the group is empty --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in powershotGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Status
Not open for further replies.
Top