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

[Solved] How to make separated unit group on hashtable picked unit?

Level 8
Joined
Jul 22, 2015
Messages
123
I intended to create dummy and merge it to unit group, yet still didn't want recognize the unit group i create using this hashtable... please help!!

  • GrandChariot
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Grand Chariot (Ryza 3)
    • Actions
      • Set HeroAbilityLevel = (Level of (Ability being cast) for (Triggering unit))
      • Set HeroAttribute = (Intelligence of (Triggering unit) (Include bonuses))
      • Set HeroLevel = (Hero level of (Triggering unit))
      • Set HeroBaseDamage = (Base Damage of (Triggering unit) for weapon index 1)
      • Set HeroTrait = Magical[PM_Loop]
      • Set HeroAllinOne = (((HeroBaseDamage + HeroAttribute) + HeroLevel) + HeroTrait)
      • Set GrandCH[0] = (GrandCH[0] + 1)
      • Set GrandCHDamage[GrandCH[0]] = (RyzaGCB[HeroAbilityLevel] + ((Real(HeroAllinOne)) x RyzaGCM[HeroAbilityLevel]))
      • Set GrandCHCaster[GrandCH[0]] = (Triggering unit)
      • Set Point[0] = (Position of GrandCHCaster[GrandCH[0]])
      • Set Point[1] = (Target point of ability being cast)
      • Set GrandCHDistance[GrandCH[0]] = (Distance between Point[0] and Point[1])
      • Set GrandCHAngle[GrandCH[0]] = (Angle from Point[0] to Point[1])
      • Set GrandCHDuration[GrandCH[0]] = 0.00
      • Set GrandCHDurationLoop[GrandCH[0]] = 0.00
      • Custom script: set udg_GrandCHGroup[udg_GrandCH[0]] = CreateGroup()
      • Custom script: set udg_GrandCHGroupTarget[udg_GrandCH[0]] = CreateGroup()
      • Set Point[2] = (Point[0] offset by GrandCHSpeed towards (GrandCHAngle[GrandCH[0]] - 15.00) degrees)
      • Set GrandCHPosition[GrandCH[0]] = True
      • Unit - Create 1 Grand Chariot for (Owner of GrandCHCaster[GrandCH[0]]) at Point[2] facing GrandCHAngle[GrandCH[0]] degrees
      • Unit Group - Add (Last created unit) to GrandCHGroup[GrandCH[0]]
      • Hashtable - Save GrandCHDistance[GrandCH[0]] as 1 of (Key (Last created unit)) in ExampleHashtable
      • Hashtable - Save Handle OfGrandCHGroupTarget[GrandCH[0]] as 2 of (Key (Last created unit)) in ExampleHashtable
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GrandCH[0] Equal to 1
        • Then - Actions
          • Trigger - Turn on GCH <gen>
        • Else - Actions
      • Custom script: call RemoveLocation(udg_Point[0])
      • Custom script: call RemoveLocation(udg_Point[1])
      • Custom script: call RemoveLocation(udg_Point[2])
  • GCH
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer GrandCH[1]) from 1 to GrandCH[0], do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in GrandCHGroup[GrandCH[1]] and do (Actions)
            • Loop - Actions
              • Set GrandCHDummy = (Picked unit)
              • Set GrandCHHandle = (Picked unit)
              • Set GrandCHDummyDistance = (Load 1 of (Key GrandCHHandle) from ExampleHashtable)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GrandCHDummyDistance Less than or equal to 0.00
                • Then - Actions
                  • Unit - Kill GrandCHDummy
                  • Unit Group - Remove GrandCHDummy from GrandCHGroup[GrandCH[1]]
                • Else - Actions
                  • Set Point[3] = (Position of GrandCHDummy)
                  • Set Point[4] = (Point[3] offset by GrandCHSpeed towards (Facing of GrandCHDummy) degrees)
                  • Unit - Move GrandCHDummy instantly to Point[4], facing (Facing of GrandCHDummy) degrees
                  • Hashtable - Save (GrandCHDummyDistance - GrandCHSpeed) as 1 of (Key GrandCHHandle) in ExampleHashtable
                  • Set GenericGroup = (Units within 250.00 of Point[4] matching ((((Matching unit) belongs to an enemy of (Owner of GrandCHCaster[GrandCH[1]])) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is in (Load 2 of (Key GrandCHHandle) in ExampleHasht
                  • Unit Group - Pick every unit in GenericGroup and do (Actions)
                    • Loop - Actions
                      • Unit - Cause GrandCHCaster[GrandCH[1]] to damage (Picked unit), dealing GrandCHDamage[GrandCH[1]] damage of attack type Spells and damage type Magic
                      • Unit Group - Add (Picked unit) to (Load 2 of (Key GrandCHHandle) in ExampleHashtable)
                      • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                      • Special Effect - Destroy (Last created special effect)
                  • Custom script: call DestroyGroup(udg_GenericGroup)
                  • Custom script: call RemoveLocation(udg_Point[3])
                  • Custom script: call RemoveLocation(udg_Point[4])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current order of GrandCHCaster[GrandCH[1]]) Equal to (Order(carrionswarm))
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GrandCHDuration[GrandCH[1]] Greater than or equal to 2.00
                • Then - Actions
                • Else - Actions
                  • Set GrandCHDuration[GrandCH[1]] = (GrandCHDuration[GrandCH[1]] + 0.03)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • GrandCHDurationLoop[GrandCH[1]] Greater than or equal to 0.50
                    • Then - Actions
                      • Set Point[5] = (Position of GrandCHCaster[GrandCH[1]])
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • GrandCHPosition[GrandCH[1]] Equal to True
                        • Then - Actions
                          • Set Point[6] = (Point[5] offset by GrandCHSpeed towards (GrandCHAngle[GrandCH[1]] + 15.00) degrees)
                          • Set GrandCHPosition[GrandCH[1]] = False
                        • Else - Actions
                          • Set Point[6] = (Point[5] offset by GrandCHSpeed towards (GrandCHAngle[GrandCH[1]] - 15.00) degrees)
                          • Set GrandCHPosition[GrandCH[1]] = True
                      • Unit - Create 1 Grand Chariot for (Owner of GrandCHCaster[GrandCH[1]]) at Point[6] facing GrandCHAngle[GrandCH[1]] degrees
                      • Unit Group - Add (Last created unit) to GrandCHGroup[GrandCH[1]]
                      • Hashtable - Save GrandCHDistance[GrandCH[1]] as 1 of (Key (Last created unit)) in ExampleHashtable
                      • Hashtable - Save Handle OfGrandCHGroupTarget[GrandCH[1]] as 2 of (Key (Last created unit)) in ExampleHashtable
                      • Set GrandCHDurationLoop[GrandCH[1]] = 0.00
                      • Special Effect - Create a special effect at Point[5] using war3mapImported\WindWeak2.mdx
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_Point[5])
                      • Custom script: call RemoveLocation(udg_Point[6])
                    • Else - Actions
                      • Set GrandCHDurationLoop[GrandCH[1]] = (GrandCHDurationLoop[GrandCH[1]] + 0.03)
            • Else - Actions
 
I'd recommend first checking that you're initializing the hashtable somewhere (preferably on map initialization). It is easy to forget.
  • Set Up Variables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set VariableSet ExampleHashtable = (Last created hashtable)
Without that, nothing will get saved/loaded properly.

Next, I noticed you initialize GrandCHGroupTarget, but there aren't any units added to it yet. In the periodic loop, you have this line to set up "GenericGroup" which tries to pick units that happen to be in that group:
  • Set GenericGroup = (Units within 250.00 of Point[4] matching ((((Matching unit) belongs to an enemy of (Owner of GrandCHCaster[GrandCH[1]])) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is in (Load 2 of (Key GrandCHHandle) in ExampleHashtable)))
But I don't think the condition "Matching unit is in <GrandCHGroupTarget>" will ever pass because you only add units to GrandCHGroupTarget in the "Pick every unit in GenericGroup..." block. Therefore GenericGroup will always be empty, and that might explain the issues you're having.
 
Level 8
Joined
Jul 22, 2015
Messages
123
I'd recommend first checking that you're initializing the hashtable somewhere (preferably on map initialization). It is easy to forget.
  • Set Up Variables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set VariableSet ExampleHashtable = (Last created hashtable)
Without that, nothing will get saved/loaded properly.
Actually already do it hahahha of course i never forget that
Next, I noticed you initialize GrandCHGroupTarget, but there aren't any units added to it yet. In the periodic loop, you have this line to set up "GenericGroup" which tries to pick units that happen to be in that group:
  • set.gif
    Set GenericGroup = (Units within 250.00 of Point[4] matching ((((Matching unit) belongs to an enemy of (Owner of GrandCHCaster[GrandCH[1]])) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is in (Load 2 of (Key GrandCHHandle) in ExampleHashtable)))
But I don't think the condition "Matching unit is in <GrandCHGroupTarget>" will ever pass because you only add units to GrandCHGroupTarget in the "Pick every unit in GenericGroup..." block. Therefore GenericGroup will always be empty, and that might explain the issues you're having.
For GrancCHGroup it for enemy that was picked on Generic Group since it store from taking further damage,.. i just realize i must create atleast 4 unit group for do that with some integer count.. and yeah it is solved now thanks for clearing!
 
Top