• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Hash table problems

Status
Not open for further replies.
How does the hash table saving work?
I noticed when i tried using it that you wouldn't want to save two handles to the same integer value.

Here's the code i was doing:

JASS:
function ChargeMove takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit u = LoadUnitHandle(hasht, 0, GetHandleId(t))
    local location l3 
    local location l2 = LoadLocationHandle(hasht, 0, GetHandleId(t))
    local location l1 = GetUnitLoc(u)
    local unit temp
    local group g = CreateGroup()
    call QueueUnitAnimation(u, "stand ready")
    if DistanceBetweenPoints(l1, l2)<32. then
    set l3 = PolarProjectionBJ(l1, 32., AngleBetweenPoints(l1, l2))
    if IsTerrainPathable(GetLocationX(l3), GetLocationY(l3), PATHING_TYPE_WALKABILITY) then
    call SetUnitPositionLoc(u, l3) 
    else 
    call PauseTimer(t)
    call ReleaseTimer(t)
endif 
else
call SetUnitPositionLoc(u, l2)
call PauseTimer(t)
call ReleaseTimer(t)
call SetUnitAnimation(u, "stand")
call RemoveSavedHandle(hasht, 0, GetHandleId(t))
endif
//Bash

loop
    exitwhen FirstOfGroup(g) == null
call GroupEnumUnitsInRangeOfLoc(g, l1, 60., null)
set temp = FirstOfGroup(g)
if IsUnitEnemy(temp, GetOwningPlayer(u)) then
call CreateUnitAtLoc(GetOwningPlayer(u), 'h000', l1, 0.)
call UnitAddAbility(GetLastCreatedUnit(), 'a001')
call IssueTargetOrder( GetLastCreatedUnit(), "thunderbolt", temp)
call UnitApplyTimedLife( GetLastCreatedUnit(), 'BTLF', 2.00 )
call GroupRemoveUnit(g, temp)
endif
endloop
//Clean
call RemoveLocation(l1)
call RemoveLocation(l3)
call DestroyGroup(g)
set g = null
set l1 = null
set l2 = null
set l3 = null
set t = null
set u = null
set temp = null
endfunction


function Charge takes unit u, location target returns nothing
local timer t
set t = NewTimer()
call SaveLocationHandle(hasht, 0, GetHandleId(t), target)
call SaveUnitHandle(hasht, 0, GetHandleId(t), u)
call TimerStart(t, 0.033, true, function ChargeMove)

    //return
endfunction

This uses timerUtils, and isn't really complete yet i suppose. However, even though i changed the common.j and blizzard.j in the newgen folder, jasshelper says there's no such thing as a hash table (neither any of it's components).

First of all: What do i need to fix in this script?

And second: Is it possible to do this:
JASS:
call SaveLocationHandle(hasht, 0, GetHandleId(t), target)
call SaveUnitHandle(hasht, 0, GetHandleId(t), u)
Or will i overwrite the first handle?
 
Level 12
Joined
Jul 27, 2008
Messages
1,181
General use:
JASS:
call Save???Handle(udg_table, GetHandleId(GetTriggerUnit()), X, ?)
udg_table -> replace with your hashtable.
GetTriggerUnit() -> replace with your unit.
??? -> type of what you wanna save.
? -> the object you wanna save.
 
Status
Not open for further replies.
Top