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

Few things confusing me.

Status
Not open for further replies.
Level 8
Joined
Dec 9, 2009
Messages
397
1. Does the point leak in this Trigger?
  • Set TempGroup = (Units within 200.00 of (Position of (Triggering unit)))

2. Which are the parent / child keys for a hashtable
  • Hashtable - Save 5.00 as 1 of 2 in (Last created hashtable)
is 1 child, 2 parent?


3. I have a unit group that will be used again and again, does this (referring to leaks):
  • Unit Group - Remove all units from TempGroup
do the same as:
  • Custom script: call DestroyGroup(udg_TempGroup)
4. Depending on the answer of 3, How would I do the custom script for destroying a unit group UnitGroupArray[(Custom Value of Unit(TempUnit))]
Because I can do the trigger with that but don't know about the custom script.
 
1) Yes, it does.
2) Parent hashtable is the value "2", the key. Child is the "1" value, the label it is saved. So, flushing a whole hashtable will flush all of the values currently stored. It is advised to clear child hashtable. The tooltip in the editor is not really accurate, because it says "clear parent hashtable" and the action flushes the whole hashtable (as you can see in the description, it flushes both parent and child hashtables), when it should be flushing the keys, just like the Jass: "call RemoveSavedReal()/RemoveSavedInteger()/RemoveSavedHandle", etc.
3) You don't need to destroy it, it won't be useable again, unless you declare it.
4)
  • Custom script: call DestroyGroup (udg_Group[GetUnitUserData (udg_TempUnit)])
 
To clarify 2nd statement:
JASS:
// native Save Integer used in jass scripts
native  SaveInteger takes hashtable table, integer parentKey, integer childKey, integer value returns nothing

// on the other hand, GUI uses:
function SaveIntegerBJ takes integer value, integer key, integer missionKey, hashtable table returns nothing

// which truely looks like:
function SaveIntegerBJ takes integer value, integer key, integer missionKey, hashtable table returns nothing
    call SaveInteger(table, missionKey, key, value)
endfunction

As you can see, GUI function switches actual child and parent key.
So for: Hashtable - Save 5.00 as 1 of 2 in (Last created hashtable) the '1' is the child key and the '2' is the parent key.

EDIT: Sorry Pharaoh_, I saw just one sentence for 2nd point when I pressed 'Add Replay'.

@Ultimatony, Additionaly:
If you have some probles with finding how function looks like in jass you can either use JassCraft or an additional variables to make your life easier:

  • Set i = (Custom Value of Unit(TempUnit))
  • Set UnitGroupArray[i] = // group
  • Custom script: call DestroyGroup(udg_UnitGroupArray[udg_i])
 
Level 8
Joined
Dec 9, 2009
Messages
397
Thanks, but the hashtable is still a bit confusing,

EXAMPLE: 3 units, A, B, and C
-Unit A hits Unit B, damage amount is saved under Parent B, child A
-Unit B hits Unit C, damage saved under Parent C child B

When any of the units die, I want the damage done, and taken numbers to be cleared.

So, If I clear all Parent of B, all damage amount he took will be gone?

If I clear all Child of B, all damage amount he dealt will be gone?


Will it work like that?
 
You should thing about a hashtable as somewhat 3D array or table.

There are generaly three posibilities in war3.
- t - standard variable
- t - 1D array variable
- t[A] - 2D array variable
Example for 3rd statement: t[1][X] ->> it means that under, let's call it 'parent [1]' there may be ton of other arrays. So basicaly, the [1] hold whole group of other indexes, while in 't[1][3]' case, the '[3]' stores just one value (let's say the second one is child key).

Now, you can flush hashtable in three ways:
JASS:
// don't take 'Parent' here as parent key; this flushes WHOLE hashtable
native  FlushParentHashtable takes hashtable table returns nothing

// flushing single PARENT key (don't look on missleading 'Child' here)
native  FlushChildHashtable takes hashtable table, integer parentKey returns nothing

// flushing just child key is featured by multiple functions depending on situation:
native  RemoveSavedBoolean takes hashtable table, integer parentKey, integer childKey returns nothing
native  RemoveSavedHandle  takes hashtable table, integer parentKey, integer childKey returns nothing
native  RemoveSavedInteger takes hashtable table, integer parentKey, integer childKey returns nothing
native  RemoveSavedReal    takes hashtable table, integer parentKey, integer childKey returns nothing
native  RemoveSavedString  takes hashtable table, integer parentKey, integer childKey returns nothing
Now think about that as:
First clears everything, nothing more to explain.

Second one: go back to 't[1][X]' example; the parent here is '[1]' so flushing the parent in this case clears whole group of values that could be stored with help of that parent key (as said already, the parent somewhat holds whole group of data instead of single value).

The third: this time go back to 't[1][3]' example. flushing child ('[3]' here) removes just single value stored in hashtable.
 
Last edited:
Level 8
Joined
Dec 9, 2009
Messages
397
Well I don't know jass, so the commands you gave don't help.

How do I go about clearing all data that has the same child?
 
Status
Not open for further replies.
Top