• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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,243
  • 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