- Joined
- Sep 18, 2018
- Messages
- 1
I recently started playing around in the wc3 editor again, and I'm clearly missing something about how hashtables work in wc3:
When this is run in game the first text displayed is "Hero Spawn! hero:somename" while the second is "Hero Spawn! hero:". Why does the second DisplayText not display the same thing as the first? It seems like hero2 doesn't even point to a unit, and certainly not the one that hero points to, but I don't see how that's possible. hero and hero2 are both local unit variables.
Perhaps a clearer question would be: What do the SaveUnitHandle and LoadUnitHandle functions even do, exactly?
JASS:
call DisplayTextToForce( GetPlayersAll(), "Hero Spawn! hero:"+GetUnitName(hero))
call SaveUnitHandle( udg_heroTable, GetHandleId(switch), 0, hero)
set hero2 = LoadUnitHandle(udg_heroTable, GetHandleId(switch), 0)
call DisplayTextToForce( GetPlayersAll(), "Hero Spawn! hero:"+GetUnitName(hero2) )
Perhaps a clearer question would be: What do the SaveUnitHandle and LoadUnitHandle functions even do, exactly?