Hashtable Help

Discussion in 'World Editor Help' started by REOspeedwagon, Jan 9, 2017.

  1. REOspeedwagon

    REOspeedwagon New Member

    Ratings:
    +0 / 0 / -0
    Hey guys, I was wondering if anyone could correct what i'm trying to do here. So the idea is when the Unit hits the same unit for 5 times in a row, it will do extra damage and heal him. However when I test it, it simply won't bring the hit counter over.

    [Trigger]
    Code:
    Sword of Thirst
        Events
            Game - GDD_Event becomes Equal to 0.00
        Conditions
            (Unit-type of GDD_DamageSource) Equal to |cff7777aaDemonic Imp|r Baser
            ((Triggering unit) has buff DamageDetection ) Equal to True
        Actions
            Set Unit = (Units in (Playable map area) matching ((Matching unit) Equal to GDD_DamageSource))
            Set SwordofThirst = (Load (Key Unit) of 0 from ofThirsthashtable)
            Set SwordofThirstTarget = (Triggering unit)
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    (Load (Key Unit) of 1 in ofThirsthashtable) Equal to (Triggering unit)
                    ((Triggering unit) has buff Sword of Thirst ) Equal to True
                Then - Actions
                    Set tempPoint = (Position of GDD_DamageSource)
                    Unit - Create 1 Dummy Invis for (Owner of GDD_DamageSource) at tempPoint facing Default building facing degrees
                    Unit - Add Sword of Thirst Dummy  to (Last created unit)
                    Unit - Order (Last created unit) to Undead Banshee - Curse (Triggering unit)
                    Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                    Custom script:   call RemoveLocation( udg_tempPoint )
                    Set SwordofThirst = (SwordofThirst + 1)
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            SwordofThirst Greater than or equal to 5
                        Then - Actions
                            Set tempPoint = (Position of (Triggering unit))
                            Special Effect - Create a special effect at tempPoint using Abilities\Spells\Other\Doom\DoomDeath.mdl
                            Special Effect - Destroy (Last created special effect)
                            Custom script:   call RemoveLocation( udg_tempPoint )
                            Unit - Set life of GDD_DamageSource to ((Life of GDD_DamageSource) + (8.00 x (Real((Strength of GDD_DamageSource (Include bonuses))))))
                            Set tempPoint = (Position of GDD_DamageSource)
                            Special Effect - Create a special effect at tempPoint using Abilities\Spells\Other\Doom\DoomDeath.mdl
                            Special Effect - Destroy (Last created special effect)
                            Custom script:   call RemoveLocation( udg_tempPoint )
                            Unit - Cause GDD_DamageSource to damage (Triggering unit), dealing (0.08 x (Max life of (Triggering unit))) damage of attack type Chaos and damage type Universal
                            Set SwordofThirst = 0
                        Else - Actions
                    Hashtable - Save Handle OfSwordofThirstTarget as (Key Unit) of 1 in ofThirsthashtable
                    Hashtable - Save SwordofThirst as (Key Unit) of 0 in ofThirsthashtable
                    Floating Text - Create floating text that reads (String(SwordofThirst)) above (Triggering unit) with Z offset 0.00, using font size 25.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
                    Floating Text - Change (Last created floating text): Disable permanence
                    Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
                    Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
                Else - Actions
                    Set tempPoint = (Position of GDD_DamageSource)
                    Unit - Create 1 Dummy Invis for (Owner of GDD_DamageSource) at tempPoint facing Default building facing degrees
                    Unit - Add Sword of Thirst Dummy  to (Last created unit)
                    Unit - Order (Last created unit) to Undead Banshee - Curse (Triggering unit)
                    Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                    Custom script:   call RemoveLocation( udg_tempPoint )
                    Set SwordofThirst = 1
                    Hashtable - Save Handle OfSwordofThirstTarget as (Key Unit) of 1 in ofThirsthashtable
                    Hashtable - Save SwordofThirst as (Key Unit) of 0 in ofThirsthashtable
                    Floating Text - Create floating text that reads (String(SwordofThirst)) above (Triggering unit) with Z offset 0.00, using font size 25.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
                    Floating Text - Change (Last created floating text): Disable permanence
                    Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
                    Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
     
  2. jonas

    jonas Member

    Ratings:
    +41 / 4 / -0
    Groups are not sets. Groups have an object ID, and that ID is different every time you get a new group. Thus, you are using a different key each time the trigger fires. Why don't you just use GDD_DamageSource as a key?
     
  3. KaerfNomekop

    KaerfNomekop Swim, fishies. Swim through the veil of steel.

    Ratings:
    +607 / 0 / -0
    This. I would add the following 2 actions to your GDD trigger:
    Trigger:
    • Set DDSSourceKey = (Key (Damage source))
      • Set DDSTargetKey = (Key (Triggering unit))

    Both DDSSourceKey and DDSTargetKey are integer variables.
     

Share This Page