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,462
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.

      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