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

A Question Involving Hashes

Status
Not open for further replies.
Level 5
Joined
Sep 1, 2010
Messages
168
You save a real value () in a hashtable, using the key of a unit as 2nd value and a nubmer you like (e.g. 0 = unit, 2=real, 35 = location.... I'll use 0 as example).
You add your unit/destructible/whatever to a group.
Now, check with a periodic event every unit/whatever in the unit group. (like every 0.1 seconds)

hashtable -save real: arithmitic(load 0 of key(picked xyz) of examplehash -(whatever you want to decrease, in my example 0.1) in 0 of key (picked xyz) in examplehash).

if (0 of key (picked xyz) in examplehash is equal or less then 0)
then do - actions
remove xyz from group
clear all childs of key (xyz) in examplehash
whatever you want to happen as the actual actions


You can access all amount of data via the hashtable (units, regions, flying height, integer, .... you get it ;) ), at the same time you get to check every affected unit via periodic event pick units in unit group
both are 'linked' together by the key of a unit you've used to save stuff in ^^

Is that a bit clearer or shall I rephrase it?
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
Actually http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/hashtables-mui-133407/ already explained it all...


As you can see the example spell HealOverTime is like this...

Save the value first then add to a group the one who is holding the ID or key coz it will be picked latter during the loop to extract the data that he carry...
  • Hashtable - Save 10.00 as 0 of (Key (Target unit of ability being cast)) in hashTable
As I mentioned above, the holder will be picked by the method below then extract the data he carried...
  • Unit Group - Pick every unit in HealOverTimeUnits and do (Actions)
The data he carried is a real so load it...
  • Set RemainingTime = (Load 0 of (Key (Picked unit)) from hashTable)
If the data is greater than 0 then save it again, deduct by 1
  • Hashtable - Save (RemainingTime - 1.00) as 0 of (Key (Picked unit)) in hashTable is the
When it reaches 0 then the ELSE part will fire...

I hope this clears up a bit, btw it's better to store the ID/key into an integer like this...

set ID = GetHandleId(GetSpellTargetUnit())

and load it again like this...

set ID = GetHandleId(GetEnumUnit())
 
Status
Not open for further replies.
Top