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

Unit Group Not Resolving

Status
Not open for further replies.
Level 4
Joined
Aug 5, 2007
Messages
49
Made an ability for an AOE sleep, for some reason it only works on 1 nearby target. If I put the message call for "pick" before the If / then / else in the Pick Every Unit, it returns "pick" for every unit, when I put it in the If /then /else it will only return once.

Code:
MassSleep
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Sleeping Powder 
    Actions
        Set UnitGroupsForTrigs[5] = (Units within 800.00 of (Position of (Casting unit)))
        Unit Group - Pick every unit in UnitGroupsForTrigs[5] and do (Actions)
            Loop - Actions
                Set TempPoin = (Position of (Picked unit))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Owner of (Picked unit)) is an enemy of (Owner of (Casting unit))) Equal to True
                        ((Picked unit) is A structure) Not equal to True
                    Then - Actions
                        Game - Display to (All players) the text: pick
                        Unit - Create 1 Dummy for (Owner of (Casting unit)) at TempPoin facing Default building facing degrees
                        Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
                        Unit - Add DummySleep  to (Last created unit)
                        Unit - Order (Last created unit) to Undead Dreadlord - Sleep (Picked unit)
                    Else - Actions
                Custom script:   call RemoveLocation (udg_TempPoin)
        Custom script:   call DestroyGroup (udg_UnitGroupsForTrigs[5])
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
To be honest I can't see anything wrong with this. Just some tiny details which should not affect anything...
  • MassSleep
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sleeping Powder
    • Actions
      • Set UnitGroupsForTrigs[5] = (Units within 800.00 of (Position of (Casting unit))) ////This is a point leak. If this spell works as a "Roar" do (Triggering Unit) instead. If this is a point target this hould be "Target point of ability being cast"
      • Game - Display to (All players) the text: Convert to String(Number of units in UnitGroupsForTrigs[5]) ////Try this.
      • Unit Group - Pick every unit in UnitGroupsForTrigs[5] and do (Actions)
        • Loop - Actions
          • Set TempPoin = (Position of (Picked unit)) ////You can save (Picked unit in a variable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of (Picked unit)) is an enemy of (Owner of (Casting unit))) Equal to True //// Triggering unit again. Also, this is Triggering player. You are using it later again, so variable again.
              • ((Picked unit) is A structure) Not equal to True
            • Then - Actions
              • Game - Display to (All players) the text: pick
              • Unit - Create 1 Dummy for (Owner of (Casting unit)) at TempPoin facing Default building facing degrees //// Triggering unit
              • Unit - Add a 1.50 second Generic expiration timer to (Last created unit) ////You could save (Lest Created Unit) in a variable
              • Unit - Add DummySleep to (Last created unit)
              • Unit - Order (Last created unit) to Undead Dreadlord - Sleep (Picked unit)
            • Else - Actions
          • Custom script: call RemoveLocation (udg_TempPoin)
      • Custom script: call DestroyGroup (udg_UnitGroupsForTrigs[5])

Could you possibly try with the dummy unit having the ability by default, without adding it?
What is the range on the Sleep spell ?
 
Last edited:
Status
Not open for further replies.
Top