• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Trigger] Arrays and Unit Groups

Status
Not open for further replies.
Level 7
Joined
Jul 9, 2012
Messages
159
Arrays and Unit Groups - SOLVED!

SOLVED!


Hey!
I am trying to make a spell where the caster sends out 30 carrions swarms over 10 seconds. The damage is trigger based, so I had to make a Carrion Swarm unit which moves in a loop.
Everything in the spell works great but the damage - It's supposed to only damage the units 1 time.

This is the loop trigger where the swarm units are dealing damage to the enemy units:
  • Unit Group - Pick every unit in (Units within 125.00 of PoDUnitMovePoint[PoDIndex] matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of PoDCaster)) Equal to True))) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is in PoDUG[PoDIndex]) Not equal to True
        • Then - Actions
          • Unit Group - Add (Picked unit) to PoDUG[PoDIndex]
          • Game - Display to (All players) the text: (String((Number of units in PoDUG[PoDIndex])))
          • Unit - Cause PoDCaster to damage (Picked unit), dealing PoDReal damage of attack type Spells and damage type Normal
          • Floating Text - Create floating text that reads (String((Integer(PoDReal)))) above (Picked unit) with Z offset 100.00, using font size 8.00, color (100.00%, 25.00%, 25.00%), and 0.00% transparency
          • Set TempFloatingText = (Last created floating text)
          • Trigger - Run General Floating Text <gen> (checking conditions)
        • Else - Actions

The problem is that the units won't be added to the arrayed unit group and will therefore take damage multiple times. :)
Thanks!
 
Last edited:
It's because unit group array does not automatically create 8192 unit groups.

Go in variable editor --> your unit group array --> increase size from 1 to < amount of unit groups you need>

If you never do something like "Set UnitGroup[2] = blablah" .. it never exists.

Or you can create a unit group vis custom script: set UnitGroup[13] = CreateGroup() --> The UnitGroup[13] exists now.
 
Status
Not open for further replies.
Back
Top