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.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top