Hashtable help

LightChaosma

New Member
Reaction score
60
ok, befor i start, this is the FIRST time i am using hashtables, and the first time im working with knockback.

scenario:
i have a tower that has a normal attack that has knowckback. the knockback is working like a charm.
i'm using a hashtable for this knockback.
the problem:
once the knockbak is done, the targeted unit, has lost his order, how do i save the order of that unit into a hashtable.

maybe this makes it easier:
the order of the targeted unit is always right click a point, so move to a point.
 

jackall

You can change this now in User CP.
Reaction score
37
you can use the Hashtable - Store String function to store the current order of your towers' target and then, after the kbk is done order that unit to ... do what it was ordered to before, also, you can store the point in the hashtable
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
sorry i cant tell you how to make it via hash tables cause i dont know either but maybe i can tell you an other way to do it.

i guess you are using 'unit - move unit (instantly)' to knock the unit back. however you can use 'custom script: call SetUnitX/Y' to move the unit to another position without losing its order. this way you wouldnt need to save it somewhere.
if you dislike the fact the unit would still move towards its position while being knockbacked you might as well change its movement speed for the duration of the knockback to 1.00 or even 0.00.
i dont know whether it would be worth doing it this way because, as i said before, i dont know hashtables myself.
 

LightChaosma

New Member
Reaction score
60
@Jackal
that didnt work..
i now have a trigger 3, that stores the targeted point of the unit in a hashtable each time it gets an order (and is not being pushed back), and this works fine :D

@accname
that sounds nice, if i can get that to work it would make things less complicated...
but how would i send the unit towards its current position +20, ofset by an anlge with that. would this work?

(freehand)
Code:
set tempint[1] = X of point temppoint[1]
set tempint[2] = Y of point temppoint[2]
custom script: call SetUnit (tempint[1]/tempint[2])

(i dont know jass)
 

jackall

You can change this now in User CP.
Reaction score
37
GetEnumUnit() refers to picked unit
GetFilterUnit() refers to mathing unit(i think)
notice the change i made to the above post... i dont have we atm and i forgot all variables you have to give SetUnitX/Y
 

LightChaosma

New Member
Reaction score
60
i have this now, and i cant even test it due to errors...

trust me, there is a picked unit, no need for you guys to see the rest :) it wont help you at all ;)

Trigger:
  • Then - Actions
    • Set tempint[1] = 20
    • Set temppoint[1] = (Position of (Picked unit))
    • Set temppoint[2] = (temppoint[1] offset by (Real(tempint[1])) towards (Load 2 of (Key (Picked unit)) from PushTable) degrees)
    • Set tempreal[1] = (X of temppoint[2])
    • Set tempreal[2] = (Y of temppoint[2])
    • Custom script: call SetUnitX (GetEnumUnit(),tempreal[1])
    • Custom script: call SetUnitY(GetenumUnit(),tempreal[2])
    • Hashtable - Save ((Load 1 of (Key (Picked unit)) from PushTable) - tempint[1]) as 1 of (Key (Picked unit)) in PushTable
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Picked unit) is A ground unit) Equal to True
      • Then - Actions
        • Special Effect - Create a special effect at temppoint[1] using Abilities\Weapons\GreenDragonMissile\GreenDragonMissile.mdl
      • Else - Actions
        • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\GreenDragonMissile\GreenDragonMissile.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation (udg_temppoint[1])
    • Custom script: call RemoveLocation (udg_temppoint[2])
 

jackall

You can change this now in User CP.
Reaction score
37
Trigger:
  • Custom script: call SetUnitY(GetenumUnit(),tempreal[2])

shouldn't it be GetEnumUnit()?
 

LightChaosma

New Member
Reaction score
60
it keeps on giving the same error....
i made my own piece of jass, and it still doesnt work... (my very first piece of jass)

in my map heade i made this:
JASS:
function MoveUnit takes location l, unit u returns nothing
    local real x=GetLocationX(l)
    local real y=GetLocationX(l)
    call SetUnitX(u,x)
    call SetUnitY(u,y)
endfunction


and in my trigger this command:
Trigger:
  • Custom script: call MoveUnit(GetEnumUnit(), temppoint[2])


it keeps expecting a name...
 

LightChaosma

New Member
Reaction score
60
still doesnt work...
i expect you to want the whole trigger now, so here it is :)

Trigger:
  • Push Tower 2
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
      • (Number of units in PushGroup) Greater than 0
    • Actions
      • Unit Group - Pick every unit in PushGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 1 of (Key (Picked unit)) from PushTable) Greater than 0
            • Then - Actions
              • Set tempint[1] = 20
              • Set temppoint[1] = (Position of (Picked unit))
              • Set temppoint[2] = (temppoint[1] offset by (Real(tempint[1])) towards (Load 2 of (Key (Picked unit)) from PushTable) degrees)
              • Custom script: call MoveUnit(GetEnumUnit(), udg_ temppoint[2])
              • Hashtable - Save ((Load 1 of (Key (Picked unit)) from PushTable) - tempint[1]) as 1 of (Key (Picked unit)) in PushTable
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A ground unit) Equal to True
                • Then - Actions
                  • Special Effect - Create a special effect at temppoint[1] using Abilities\Weapons\GreenDragonMissile\GreenDragonMissile.mdl
                • Else - Actions
                  • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\GreenDragonMissile\GreenDragonMissile.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation (udg_temppoint[1])
              • Custom script: call RemoveLocation (udg_temppoint[2])
            • Else - Actions
              • -------- number 3 is set in the trigger Push Tower 3 --------
              • Unit Group - Remove (Picked unit) from PushGroup
              • Unit - Order (Picked unit) to Right-Click (Load 3 of (Key (Picked unit)) in PushTable)
              • -------- the child hashtables are destroyed elewhere --------
              • -------- in the tigger remove corpse --------
 

saw792

Is known to say things. That is all.
Reaction score
280
The error is on the line above, it's udg_temppoint[2] not udg_ temppoint[2].
 

LightChaosma

New Member
Reaction score
60
didnt even see that space there... but still doesnt work...

in the compiler it says the error is in the hashtable line afterwards... that the location is wrong, but when i disable the custom script, it all works...

JASS:
Custom script:   call MoveUnit(GetEnumUnit(), udg_temppoint[2])
 

saw792

Is known to say things. That is all.
Reaction score
280
Your function takes location, then unit. You input unit, then location.
 

LightChaosma

New Member
Reaction score
60
thx, that did it

but now the second part... does JASS implement X and Y diffrently than the GUI?

when the trigger is fired, thus a unit needs to be knockbacked, the unit first is transported to a location about 45 degrees underneath the center(see drawing), and then it is knocbacked properly...

Code:
     O          
               
               
   X
O is the center, X is where the unit shows up

when i use move unit(instantly) facing point in the GUI, it doesnt do that
 
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

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top