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

[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.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
I think that they are not constructed, so you are trying to add units to non existing group

Iceman's solution is good, but its not really good idea to do "Init 8000", cause if you do that few times, your map will not be initialized properly
 
Status
Not open for further replies.
Top