• 🏆 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!

[Solved] Hashtable value not loading

Status
Not open for further replies.
Level 7
Joined
Nov 15, 2009
Messages
225
Hey,
I'm working on a little bit different jump spell (trying not to save locations and stuff, just for testing).
And I used to work with custom values, but I want to break my habit..

So I tried working with Hashtables (yes first time :/ )

So my problem is:
JASS:
call BJDebugMsg(R2S(GetHandleId(u)))
Gives me always the same number
JASS:
call BJDebugMsg(R2S(LoadReal(udg_JumpHash, GetHandleId(u), 0)))
Is always 0...

If I test it ingame, the unit is just going up and down.
If I comment the hashtable lines and uncomment the UnitData lines it works perfectly.

JASS:
function UnitJump takes nothing returns nothing
        set x = GetLocationX(p) + LoadReal(udg_JumpHash, GetHandleId(u), 0) * Cos(face * bj_DEGTORAD)
        set y = GetLocationY(p) + LoadReal(udg_JumpHash, GetHandleId(u), 0) * Sin(face * bj_DEGTORAD)
endfunction

function Trig_Spell_Jump_Actions takes nothing returns nothing
    call SaveReal(udg_JumpHash, GetHandleId(u), R2I(r1 * 0.075), 0)
    call BJDebugMsg(R2S(GetHandleId(u)))
    call BJDebugMsg(R2S(LoadReal(udg_JumpHash, GetHandleId(u), 0)))
endfunction

function InitTrig_Spell_Jump takes nothing returns nothing
    set udg_JumpHash = InitHashtable()
endfunction
Edit: Removed most parts of the trigger.
When it's finished I will upload this spell into an unprotected map anyway.


Thank you for your time, help is appreciated!
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • call SaveReal(udg_JumpHash, GetHandleId(u), R2I(r1 * 0.075), 0)
  • call BJDebugMsg(R2S(GetHandleId(u)))
  • call BJDebugMsg(R2S(LoadReal(udg_JumpHash, GetHandleId(u), 0)))
R2I(r1 * 0.075), this could be 37 for example, if distance (r1) is around 500.
GetHandleId returns an integer, you should use I2S.
With the last debug message, you load from (id,0), but you stored stuff into (id,37)
 
Status
Not open for further replies.
Top