• 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.

Differences between Set var & Handle

Status
Not open for further replies.
Level 2
Joined
Dec 25, 2013
Messages
8
Hello,
please tell me the differences :)

Ways
1. Pick destructibles on map, then set variable[?] = (Picked Destructible)
2. Pick destructibles on map, then handles (Picked Destructible)
 
In hashtable you work with columns and rows. And you can use unique Ids to specify it's position easily in a hashtable.

First you would need the Id: (you aslo can do this with units, items, triggers, timers, special effects, ...)
  • Custom script: GetHandleId (GetEnumDestructable())
Now use can use this Id as key in your hashtable. (you can say "key" is just an other word for "row" here, it's just important that it's unique)

Why to use this?

In some cases it may simplify a lot of things. With hashtables you can make things MUI, just because of each object has got his own HanldeId.

Later you can read out data out of hashtable of a specific object with 'Key Of HanldeId' without an extra index.
_____________________________

In hashtables you are able to store integers of max size 2^32. So you easily can store terrain types in a hashtable, for example.

An integer[array] has the max index of only 8191. Saving terrain types into it would be impossible.
____________________________

In general: Sometimes it may be useful to work with hashtables, just because of these unique Ids. But of course it always depends on what you wanna do with it.

If you can work with a simple integer[array] as index, then do so. Reading out of hashtable is a bit slower than just to read an index.

You can read tutorials about hashtables if you wanna learn it. Here's an example: http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/hashtables-mui-133407/
 
Level 2
Joined
Dec 25, 2013
Messages
8
Ok, thank you for the explanation :)

:fp: What I acutally meant is : The Memory will increases by 100kb while a destructible is handled so how many Memory will be increases by the Set variable function ?
My project do handles (?) sets of destructibles and units. A set maybe contains about 400 destructibles and 50 units. A stupid idea I know and that's why I ask which used the smaller Memory :>
 
Status
Not open for further replies.
Top