Knockback system trouble

Curo

Why am I still playing this game...?
Reaction score
109
Been a while since I've asked for help here. Basically, I have a periodic forced movement/knockback system that utilizes hashtables to track individual units. Pretty simple, but I made it from scratch (almost), so it doesn't work.

I'd also appreciate any tips at making it more efficient.

I've added in debug display text lines to find when it stops working. It stops at the following line in the second trigger:
Trigger:
  • Set TempRl[1] = (0.04 x ((Load (Key distance) of (Key (Picked unit)) from movement_table) / (Load (Key speed) of (Key (Picked unit)) from movement_table)))


None of the actions afterward are performed. TempRl is a real variable array (size 10). Here are both relevant triggers. The first one works fine. The second one stops 4 action lines in, as noted above:

Trigger:
  • Knockback Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Knockback
    • Actions
      • Set TempPoint[1] = (Position of (Triggering unit))
      • Set TempPoint[2] = (Position of (Target unit of ability being cast))
      • Hashtable - Save (Angle from TempPoint[1] to TempPoint[2]) as (Key angle) of (Key (Target unit of ability being cast)) in movement_table
      • Custom script: call RemoveLocation (udg_TempPoint[1])
      • Custom script: call RemoveLocation (udg_TempPoint[2])
      • Hashtable - Save 400.00 as (Key distance) of (Key (Target unit of ability being cast)) in movement_table
      • Hashtable - Save 400.00 as (Key distance remaining) of (Key (Target unit of ability being cast)) in movement_table
      • Hashtable - Save 1.00 as (Key speed) of (Key (Target unit of ability being cast)) in movement_table
      • Hashtable - Save True as (Key destroys trees) of (Key (Target unit of ability being cast)) in movement_table
      • Hashtable - Save Abilities\Spells\Human\FlakCannons\FlakTarget.mdl as (Key effect) of (Key (Target unit of ability being cast)) in movement_table
      • Unit Group - Add (Target unit of ability being cast) to knockback_group


Trigger:
  • Movement
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in knockback_group and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • Set TempRl[1] = (0.04 x ((Load (Key distance) of (Key (Picked unit)) from movement_table) / (Load (Key speed) of (Key (Picked unit)) from movement_table)))
          • Set TempPoint[1] = (Position of TempUnit)
          • Set TempPoint[2] = (TempPoint[1] offset by TempRl[1] towards (Load (Key angle) of (Key (Picked unit)) from movement_table) degrees)
          • Custom script: call RemoveLocation (udg_TempPoint[1])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempUnit is Snared) Equal to False
              • TempUnit Not equal to boss[11]
              • TempUnit Not equal to boss[13]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load (Key destroys trees) of (Key (Picked unit)) from movement_table) Equal to True
                • Then - Actions
                  • Destructible - Pick every destructible within 100.00 of TempPoint[2] and do (If ((((Destructible-type of (Picked destructible)) Equal to Winter Tree Wall) or ((Destructible-type of (Picked destructible)) Equal to Ashenvale Tree Wall)) or ((Destructible-type of (Picked destructible)) Equal to Ashenvale Canopy Tree)) then do (Destructi
                • Else - Actions
              • Unit - Move TempUnit instantly to TempPoint[2]
            • Else - Actions
          • Set TempRl[2] = ((Load (Key distance remaining) of (Key (Picked unit)) from movement_table) - TempRl[1])
          • Set TempString = (Load (Key effect) of (Key (Picked unit)) from movement_table)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempString Not equal to <Empty String>
            • Then - Actions
              • Special Effect - Create a special effect at TempPoint[2] using TempString
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
          • Custom script: call RemoveLocation (udg_TempPoint[2])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempRl[2] Greater than 0.00
            • Then - Actions
              • Hashtable - Save TempRl[2] as (Key distance remaining) of (Key (Picked unit)) in movement_table
            • Else - Actions
              • Unit Group - Remove TempUnit from knockback_group
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
I've made a unit moving system(beta version) that supports knockback. Tell me everything about it, and I post you map with the knockback you want
 

Curo

Why am I still playing this game...?
Reaction score
109
I've made a unit moving system(beta version) that supports knockback. Tell me everything about it, and I post you map with the knockback you want

Thanks for the offer. I may consider it if I can't debug my coding. No jass though please, as it takes me forever to read through it.

I'm also trying to incorporate this as a universal movement system. There are other parts that use "set X/Y" movement, but the knockback part is what I'm dealing with at the moment. I hope to eventually use it for dummy projectiles and other forced movement, rotation, charging/dashing, etc.

I've seen other systems, and aside from the fact that most are jass and too complicated for me to decipher, I prefer to do my own coding.

But as far as the code I've presented you with goes: can you see any bugs that would cause it to stop running at the point I mentioned in the original post?
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
I don't use hashtables, as they are complicated to me, and I will give you vJass code. I will explain you everything. My system can do almost anything. Now I am working on homing movement.
 

Curo

Why am I still playing this game...?
Reaction score
109
I don't use hashtables, as they are complicated to me, and I will give you vJass code. I will explain you everything. My system can do almost anything. Now I am working on homing movement.

Don't worry about it then dude. I don't use vjass. There are already lots of systems out there, so I can just pick one up if I need it. Thanks though.
 

Curo

Why am I still playing this game...?
Reaction score
109
Ok, so I did some more testing and found that the problem is in the first trigger. NONE of my hashtable values are being saved.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Is the hashtable created in the first place? I had this kind of error once, until I realised I didn't have a Hashtable - Create Hashtable action.
 

HydraRancher

Truth begins in lies
Reaction score
197
Ok, so I did some more testing and found that the problem is in the first trigger. NONE of my hashtable values are being saved.

Rofl. You didn't create the hashtable. Initially I was going to suggest this but I decided not.
 

Curo

Why am I still playing this game...?
Reaction score
109
Yeah, major facepalm right there. Nobody is ever going to take me seriously again, lol...

Thanks guys, I love you! Hydra, I got rep coming at you when I can.

So, I have another part that uses set X/Y movement, rather than set position movement. I use:
Trigger:
  • Custom script: call SetUnitX (udg_TempUnit, GetLocationX(udg_TempPoint[2]) )

However, I'd like to replace the TempUnit variable with (Picked Unit). I'm not sure how to refer to this in JASS though. It's not GetPickedUnit(), and I can't find it on any tutorials here.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top