Can't add units to unit group

carbonduck

New Member
Reaction score
4
I am modifying a spell from one of the spellpacks (Simple Spell Pack) called Ion Canon. Originally, the spell would deal variable damage since each dummy unit in the beam can inflict aoe damage but I am just modifying it so that the beam only hits each unit once.

I'm doing this by tracking every unit that was hit by the beam and putting them in a unit group so that they won't be picked for the next dummy unit to damage. This works fine and dandy whenever the spell is cast the first time, but afterwards, units don't get added to the damage-tracking group. Here's a snippet...

Trigger:
  • Ion Canon Spell
    • Variables and stuff are set up here... blah blah...
    • -------- ------------------------------------------------------------------------------------------------- --------
    • -------- Create dummy blast --------
    • -------- ------------------------------------------------------------------------------------------------- --------
    • Unit - Create 1 Dummy: Ion Beam Start for (Owner of Ion_Canon_Caster) at Ion_Canon_Location facing (Facing of Ion_Canon_Caster) degrees
    • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
    • For each (Integer A) from 1 to Ion_Canon_Loop_Number, do (Actions)
      • Loop - Actions
        • -------- ------------------------------------------------------------------------------------------------- --------
        • -------- Setting a location --------
        • -------- ------------------------------------------------------------------------------------------------- --------
        • Set Ion_Canon_Loop_Location = (Ion_Canon_Location offset by (Ion_Canon_Distance x (Real((Integer A)))) towards (Facing of Ion_Canon_Caster) degrees)
        • -------- ------------------------------------------------------------------------------------------------- --------
        • -------- Creating and setting the dummy --------
        • -------- ------------------------------------------------------------------------------------------------- --------
        • Unit - Create 1 Dummy: Ion Beam for (Owner of Ion_Canon_Caster) at Ion_Canon_Loop_Location facing (Facing of Ion_Canon_Caster) degrees
        • Unit - Add Crow Form to (Last created unit)
        • Unit - Remove Crow Form from (Last created unit)
        • Animation - Change (Last created unit) flying height to 80.00 at 0.00
        • Unit - Turn collision for (Last created unit) Off
        • Unit - Add a (0.85 - (0.01 x (Real((Integer A))))) second Generic expiration timer to (Last created unit)
        • -------- ------------------------------------------------------------------------------------------------- --------
        • -------- Setting the unit group --------
        • -------- ------------------------------------------------------------------------------------------------- --------
        • Set Ion_Canon_Damage_Group = (Units within Ion_Canon_AoE of Ion_Canon_Loop_Location matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Owner of (Matching unit)) is an enemy of (Owner of Ion_Canon_Caster)) Equal to True) and (((Matching unit) is in Ion_Canon_Damaged_Already) Equal to False)
        • Unit Group - Pick every unit in Ion_Canon_Damage_Group and do (Actions)
          • Loop - Actions
            • -------- ------------------------------------------------------------------------------------------------- --------
            • -------- Damaging the Area, burning mana and creating special effects --------
            • -------- ------------------------------------------------------------------------------------------------- --------
            • Unit Group - Add (Picked unit) to Ion_Canon_Damaged_Already
            • Unit - Cause Ion_Canon_Caster to damage (Picked unit), dealing Ion_Canon_Total_Damage damage of attack type Spells and damage type Universal
            • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - Ion_Canon_Total_Mana_Burn)
            • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\DragonHawkMissile\DragonHawkMissile.mdl
            • Special Effect - Destroy (Last created special effect)
            • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Human\Feedback\ArcaneTowerAttack.mdl
            • Special Effect - Destroy (Last created special effect)
        • -------- ------------------------------------------------------------------------------------------------- --------
        • -------- Clearing leaks --------
        • -------- ------------------------------------------------------------------------------------------------- --------
        • Custom script: call DestroyGroup(udg_Ion_Canon_Damage_Group)
        • Custom script: call RemoveLocation(udg_Ion_Canon_Loop_Location)
    • Custom script: call DestroyGroup(udg_Ion_Canon_Damaged_Already)
    • Custom script: call RemoveLocation(udg_Ion_Canon_Location)


+rep for anyone who can help!
 

hgkjfhfdsj

Active Member
Reaction score
55
Trigger:
  • Custom script: call DestroyGroup(udg_Ion_Canon_Damaged_Already)

not necessary to destroy this global group, try clearing group instead. read this
 

carbonduck

New Member
Reaction score
4
Trigger:
  • Custom script: call DestroyGroup(udg_Ion_Canon_Damaged_Already)

not necessary to destroy this global group, try clearing group instead. read this

The GroupClear() function worked beautifully; I never knew that existed. Thanks a lot! :) Rep-plussed.
 

hgkjfhfdsj

Active Member
Reaction score
55
Trigger:
  • Unit Group - Remove all units from (udg_Ion_Canon_Damaged_Already)

also exists in gui :D
 

Laiev

Hey Listen!!
Reaction score
188
just to remember a thing...

the recycle way is used to recycle the group and use in others things... if you don't will use it anymore, destroy it :thup:
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top