Hashtable with Unit Group?

Status
Not open for further replies.
Level 9
Joined
Sep 28, 2004
Messages
365
Can anyone point me out a good example of using unit group in hashtable?

I am trying to make a spell where the archer shoots 3 arrows at a point 1 after another. I move the arrow with triggers. And units in range of the arrow will get damage. But i only want them to get damage once since the move trigger is every 0.03seconds.

So i created a damagedGroup. Units in this group won't be damage anymore for that particular arrow.

Example:
If unit A stands in line. Caster shoots arrow, unit A will get hit 3 times because of the 3 arrows. Not more than that.

But i have problem using unit group in hashtable. I can't destroy it, if not my group will be empty. If i don't it will leak. ._. Anyone can shed some light?

Thanks in advance!
 
Can anyone point me out a good example of using unit group in hashtable?

I am trying to make a spell where the archer shoots 3 arrows at a point 1 after another. I move the arrow with triggers. And units in range of the arrow will get damage. But i only want them to get damage once since the move trigger is every 0.03seconds.

So i created a damagedGroup. Units in this group won't be damage anymore for that particular arrow.

Example:
If unit A stands in line. Caster shoots arrow, unit A will get hit 3 times because of the 3 arrows. Not more than that.

But i have problem using unit group in hashtable. I can't destroy it, if not my group will be empty. If i don't it will leak. ._. Anyone can shed some light?

Thanks in advance!

You can just destroy it before the arrow dies... I used it when my system was still using hashtables and no one pointed out that it leaks. And anyway the group will just stay there until you destroy it, saving it in a hashtable would just enable you to reference it again and again without causing errors in the spell being MUI, it wont create a new one so as long as you use the group its not a leak but be sure to destroy it when its not needed anymore.
 
Level 9
Joined
Sep 28, 2004
Messages
365
i still can't get my group save in hashtable to work properly. What am i doing wrong?

I am trying to make a pierce arrow. So when unit is in range on the arrow, they will get damage once by adding them to the damagedGroup after being damage.

But the problem is when i spam the skill, for example i shoots 5 arrows within 3 seconds to a far away point. Units that are in the line will only get damaged once by the 1st arrow. And the other arrow won't do damage. Because they are still in the damagedGroup for some reason.

Heres my example code:

Last Created unit is the Arrow. I create it when i run the trigger.
  • Hashtable - Save Handle OfArrow_DamagedGroup as (Key dmggroup) of (Key (Last created unit)) in myArrowTable
Every 0.03 seconds, i pick every unit in the ArrowGroup and load the damagedGroup
  • Set Arrow_DamagedGroup = (Load (Key dmggroup) of (Key (Picked unit)) in myArrowTable)
I set a unitGroup to get units around the arrow and do damage and pick every unit to do damage, after damage, i add them to Arrow_DamagedGroup
  • Unit Group - Add (Picked unit) to Arrow_DamagedGroup
Finally i update my group Hashtable.
  • Hashtable - Save Handle OfArrow_DamagedGroup as (Key dmggroup) of (Key (Picked unit)) in myArrowTable
But somehow all the above don't work. I know it has something to do with the damagedGroup. How do i make it MUI for each Arrow? I saved it in hash but it didn't work like other handles (Real, Unit, String, Integer)

Note: i didn't destroy the group in any part of the trigger.
 
Level 9
Joined
Sep 28, 2004
Messages
365
What is the difference between doing:
  • Set Arrow_DamagedGroup = (Load (Key dmggroup) of (Key (Picked unit)) in myArrowTable)
  • Unit Group - Add (Picked unit) to Arrow_DamagedGroup
and

  • Unit Group - Add (Picked unit) to (Load (Key dmggroup) of (Key (Picked unit)) in myArrowTable)
? Just want to know. Because if its the same, it didn't work.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
What is the difference between doing:
  • Set Arrow_DamagedGroup = (Load (Key dmggroup) of (Key (Picked unit)) in myArrowTable)
  • Unit Group - Add (Picked unit) to Arrow_DamagedGroup
  • Unit Group - Add (Picked unit) to (Load (Key dmggroup) of (Key (Picked unit)) in myArrowTable)
? Just want to know. Because if its the same, it didn't work.

The trigger I posted is erroneus, since those picked units are referencing to the same unit, they should not.

Could you post the whole triggers, it's easier to see what's going on in there.
 
Status
Not open for further replies.
Top