• 🏆 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-effects isn't working in my spellpack

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,555
I only really looked at Savage Blow but this is what I found.

1) Nowhere in the Savage Blow triggers does it attempt to use any of your Knockback systems (why do you have multiple systems anyway?). Instead, it knocks back the units manually.

2) You're missing a reference to your ability a few times in the Savage Blow Knockback trigger:
  • SavageBlowCounter[SavageBlowLoop] Greater than or equal to (0.75 + (0.20 x (Real((Level of Unknown (A0DM) for SavageBlowCaster[SavageBlowLoop])))))
3) Some variables look to have broken and lost their type. In particular, SavageBlowLoop was broken and needed to be set to an Integer again.

4) It looks like you're attempting to use Dynamic Indexing but failing to "de-index" a unit that has finished moving. If done properly you can easily remove the Unit from the For Loop.

5) There's a bunch of weird stuff like SavageBlowStop that as far as I can tell isn't necessary.

6) SavageBlowCooldownGroup doesn't appear to do anything.

Also, some of your triggers try to call the Jass IsTerrainWalkable() function but you've never initialized this so it won't work. The fix is simple:
  • Initialize IsTerrainWalkable
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Custom script: call TerrainWalk()
TerrainWalk() is a function that needs to run before IsTerrainWalkable() will work.

I also renamed the variable called Boolean to IsTerrainWalkable since that old name was very generic. I use this in the Savage Blow Knockback trigger to make sure that the units don't get pushed over unwalkable terrain.

Here's a "working" version of Savage Blow with a bunch of optimizations and the removal of what appeared to be unnecessary stuff:
  • Savage Blow Trigger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Savage Blow
    • Actions
      • Set VariableSet TempUnit1 = (Triggering unit)
      • Set VariableSet TempPlayer1 = (Owner of TempUnit1)
      • Set VariableSet TempPoint1 = (Position of TempUnit1)
      • Set VariableSet TempReal1 = (Facing of TempUnit1)
      • Set VariableSet TempInt1 = (Level of (Ability being cast) for TempUnit1)
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 200.00 of TempPoint1.) and do (Actions)
        • Loop - Actions
          • Set VariableSet TempUnit2 = (Picked unit)
          • Set VariableSet TempPoint2 = (Position of TempUnit2)
          • Set VariableSet TempReal2 = (Angle from TempPoint1 to TempPoint2)
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempUnit2 belongs to an enemy of TempPlayer1.) Equal to True
              • (TempUnit2 is alive) Equal to True
              • (TempUnit2 is A structure) Equal to False
              • (TempUnit2 is Mechanical) Equal to False
              • (Unit-type of TempUnit2) Not equal to Tentacle
              • (Cos((TempReal1 - TempReal2))) Greater than or equal to (Cos(90.00))
            • Then - Actions
              • Set VariableSet SavageBlowIndex = (SavageBlowIndex + 1)
              • Set VariableSet SavageBlowTarget[SavageBlowIndex] = TempUnit2
              • Set VariableSet SavageBlowAngle[SavageBlowIndex] = TempReal2
              • Set VariableSet SavageBlowCounter[SavageBlowIndex] = 0.00
              • Set VariableSet SavageBlowDuration[SavageBlowIndex] = (0.75 + (0.20 x (Real(TempInt1))))
              • -------- --------
              • Unit - Cause TempUnit1 to damage TempUnit2, dealing 150.00 damage of attack type Normal and damage type Normal
              • Unit - Create 1 Dummy for TempPlayer1 at TempPoint2 facing 270.00 degrees
              • Set VariableSet SavageBlowDummy = (Last created unit)
              • Unit - Add Savage Blow Stun to SavageBlowDummy
              • Unit - Add a 0.25 second Generic expiration timer to SavageBlowDummy
              • Unit - Order SavageBlowDummy to Neutral - Hurl Boulder TempUnit2
              • -------- --------
              • Trigger - Turn on Savage Blow Knockback <gen>
            • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint2)
      • Custom script: call RemoveLocation(udg_TempPoint1)
  • Savage Blow Knockback
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer SavageBlowLoop) from 1 to SavageBlowIndex, do (Actions)
        • Loop - Actions
          • Set VariableSet SavageBlowCounter[SavageBlowLoop] = (SavageBlowCounter[SavageBlowLoop] + 0.03)
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SavageBlowCounter[SavageBlowLoop] Less than SavageBlowDuration[SavageBlowLoop]
            • Then - Actions
              • Set VariableSet TempPoint1 = (Position of SavageBlowTarget[SavageBlowLoop])
              • Set VariableSet TempPoint2 = (TempPoint1 offset by (15.30 - (SavageBlowCounter[SavageBlowLoop] x 10.00)) towards SavageBlowAngle[SavageBlowLoop] degrees.)
              • -------- --------
              • Custom script: set udg_IsTerrainWalkable = IsTerrainWalkable(udg_TempPoint2)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IsTerrainWalkable Equal to True
                • Then - Actions
                  • Custom script: call SetUnitX(udg_SavageBlowTarget[udg_SavageBlowLoop] , GetLocationX(udg_TempPoint2) )
                  • Custom script: call SetUnitY(udg_SavageBlowTarget[udg_SavageBlowLoop] , GetLocationY(udg_TempPoint2) )
                • Else - Actions
              • -------- --------
              • Special Effect - Create a special effect attached to the chest of SavageBlowTarget[SavageBlowLoop] using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
              • Special Effect - Destroy (Last created special effect)
              • -------- --------
              • Custom script: call RemoveLocation(udg_TempPoint1)
              • Custom script: call RemoveLocation(udg_TempPoint2)
            • Else - Actions
              • -------- De-index --------
              • Set VariableSet SavageBlowTarget[SavageBlowLoop] = SavageBlowTarget[SavageBlowIndex]
              • Set VariableSet SavageBlowAngle[SavageBlowLoop] = SavageBlowAngle[SavageBlowIndex]
              • Set VariableSet SavageBlowCounter[SavageBlowLoop] = SavageBlowCounter[SavageBlowIndex]
              • Set VariableSet SavageBlowDuration[SavageBlowLoop] = SavageBlowDuration[SavageBlowIndex]
              • -------- --------
              • Set VariableSet SavageBlowLoop = (SavageBlowLoop - 1)
              • Set VariableSet SavageBlowIndex = (SavageBlowIndex - 1)
              • -------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SavageBlowIndex Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
The major issue with MY version of Savage Blow is that it will have weird results if a unit gets hit by the spell again while already being knocked back. So keep in mind my solution isn't perfect. Ideally, you'd pick a single Knockback system to use, and then simply run that in the Savage Blow Trigger inside of it's Pick Every Unit action. The Savage Blow Knockback trigger wouldn't even be necessary.
 

Attachments

  • Knockback spells 2.w3m
    44.1 KB · Views: 5
Last edited:
Level 14
Joined
Jul 19, 2007
Messages
772
I only really looked at Savage Blow but this is what I found.

1) Nowhere in the Savage Blow triggers does it attempt to use any of your Knockback systems (why do you have multiple systems anyway?). Instead, it knocks back the units manually.

2) You're missing a reference to your ability a few times in the Savage Blow Knockback trigger:
  • SavageBlowCounter[SavageBlowLoop] Greater than or equal to (0.75 + (0.20 x (Real((Level of Unknown (A0DM) for SavageBlowCaster[SavageBlowLoop])))))
3) Some variables look to have broken and lost their type. In particular, SavageBlowLoop was broken and needed to be set to an Integer again.

4) It looks like you're attempting to use Dynamic Indexing but failing to "de-index" a unit that has finished moving. If done properly you can easily remove the Unit from the For Loop.

5) There's a bunch of weird stuff like SavageBlowStop that as far as I can tell isn't necessary.

6) SavageBlowCooldownGroup doesn't appear to do anything.

Also, some of your triggers try to call the Jass IsTerrainWalkable() function but you've never initialized this so it won't work. The fix is simple:
  • Initialize IsTerrainWalkable
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Custom script: call TerrainWalk()
TerrainWalk() is a function that needs to run before IsTerrainWalkable() will work.

I also renamed the variable called Boolean to IsTerrainWalkable since that old name was very generic. I use this in the Savage Blow Knockback trigger to make sure that the units don't get pushed over unwalkable terrain.

Here's a "working" version of Savage Blow with a bunch of optimizations and the removal of what appeared to be unnecessary stuff:
  • Savage Blow Trigger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Savage Blow
    • Actions
      • Set VariableSet TempUnit1 = (Triggering unit)
      • Set VariableSet TempPlayer1 = (Owner of TempUnit1)
      • Set VariableSet TempPoint1 = (Position of TempUnit1)
      • Set VariableSet TempReal1 = (Facing of TempUnit1)
      • Set VariableSet TempInt1 = (Level of (Ability being cast) for TempUnit1)
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 200.00 of TempPoint1.) and do (Actions)
        • Loop - Actions
          • Set VariableSet TempUnit2 = (Picked unit)
          • Set VariableSet TempPoint2 = (Position of TempUnit2)
          • Set VariableSet TempReal2 = (Angle from TempPoint1 to TempPoint2)
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempUnit2 belongs to an enemy of TempPlayer1.) Equal to True
              • (TempUnit2 is alive) Equal to True
              • (TempUnit2 is A structure) Equal to False
              • (TempUnit2 is Mechanical) Equal to False
              • (Unit-type of TempUnit2) Not equal to Tentacle
              • (Cos((TempReal1 - TempReal2))) Greater than or equal to (Cos(90.00))
            • Then - Actions
              • Set VariableSet SavageBlowIndex = (SavageBlowIndex + 1)
              • Set VariableSet SavageBlowTarget[SavageBlowIndex] = TempUnit2
              • Set VariableSet SavageBlowAngle[SavageBlowIndex] = TempReal2
              • Set VariableSet SavageBlowCounter[SavageBlowIndex] = 0.00
              • Set VariableSet SavageBlowDuration[SavageBlowIndex] = (0.75 + (0.20 x (Real(TempInt1))))
              • -------- --------
              • Unit - Cause TempUnit1 to damage TempUnit2, dealing 150.00 damage of attack type Normal and damage type Normal
              • Unit - Create 1 Dummy for TempPlayer1 at TempPoint1 facing 270.00 degrees
              • Set VariableSet SavageBlowDummy = (Last created unit)
              • Unit - Add Savage Blow Stun to SavageBlowDummy
              • Unit - Add a 0.25 second Generic expiration timer to SavageBlowDummy
              • Unit - Order SavageBlowDummy to Neutral - Hurl Boulder TempUnit2
              • -------- --------
              • Trigger - Turn on Savage Blow Knockback <gen>
            • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint2)
      • Custom script: call RemoveLocation(udg_TempPoint1)
  • Savage Blow Knockback
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer SavageBlowLoop) from 1 to SavageBlowIndex, do (Actions)
        • Loop - Actions
          • Set VariableSet SavageBlowCounter[SavageBlowLoop] = (SavageBlowCounter[SavageBlowLoop] + 0.03)
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SavageBlowCounter[SavageBlowLoop] Less than SavageBlowDuration[SavageBlowLoop]
            • Then - Actions
              • Set VariableSet TempPoint1 = (Position of SavageBlowTarget[SavageBlowLoop])
              • Set VariableSet TempPoint2 = (TempPoint1 offset by (15.30 - (SavageBlowCounter[SavageBlowLoop] x 10.00)) towards SavageBlowAngle[SavageBlowLoop] degrees.)
              • -------- --------
              • Custom script: set udg_IsTerrainWalkable = IsTerrainWalkable(udg_TempPoint2)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IsTerrainWalkable Equal to True
                • Then - Actions
                  • Custom script: call SetUnitX(udg_SavageBlowTarget[udg_SavageBlowLoop] , GetLocationX(udg_TempPoint2) )
                  • Custom script: call SetUnitY(udg_SavageBlowTarget[udg_SavageBlowLoop] , GetLocationY(udg_TempPoint2) )
                • Else - Actions
              • -------- --------
              • Special Effect - Create a special effect attached to the chest of SavageBlowTarget[SavageBlowLoop] using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
              • Special Effect - Destroy (Last created special effect)
              • -------- --------
              • Custom script: call RemoveLocation(udg_TempPoint1)
              • Custom script: call RemoveLocation(udg_TempPoint2)
            • Else - Actions
              • -------- De-index --------
              • Set VariableSet SavageBlowTarget[SavageBlowLoop] = SavageBlowTarget[SavageBlowIndex]
              • Set VariableSet SavageBlowAngle[SavageBlowLoop] = SavageBlowAngle[SavageBlowIndex]
              • Set VariableSet SavageBlowCounter[SavageBlowLoop] = SavageBlowCounter[SavageBlowIndex]
              • Set VariableSet SavageBlowDuration[SavageBlowLoop] = SavageBlowDuration[SavageBlowIndex]
              • -------- --------
              • Set VariableSet SavageBlowLoop = (SavageBlowLoop - 1)
              • Set VariableSet SavageBlowIndex = (SavageBlowIndex - 1)
              • -------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SavageBlowIndex Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
The major issue with MY version of Savage Blow is that it will have weird results if a unit gets hit by the spell again while already being knocked back. So keep in mind my solution isn't perfect. Ideally, you'd pick a single Knockback system to use, and then simply run that in the Savage Blow Trigger inside of it's Pick Every Unit action. The Savage Blow Knockback trigger wouldn't even be necessary.
Oh thank you so much for helping me out!
 
Status
Not open for further replies.
Top