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

Action Problem

Status
Not open for further replies.
Level 13
Joined
Jun 10, 2007
Messages
780
I made an ability but I'm a little stuck. I need to create a dummy at each unit in the Unit_Group_Slam[1] group. However, this isn't working.

Trigger
  • Unit Group - Pick every unit in Unit_Group_Slam[1] and do (Unit - Create 1 Slam Dummy [Caster] for (Owner of (Triggering unit)) at (Position of (Picked unit)) facing Default building facing (270.0) degrees)
Any suggestions to find an appropriate action?
 
Level 13
Joined
Jun 10, 2007
Messages
780
  • Slam Code
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Slam
    • Actions
      • -------- --Setting Variables And Creating Dummies Here-- --------
      • Set Unit_Group_Slam[1] = (Units within 500.00 of (Position of (Triggering unit)) matching (((Triggering unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))
      • Set Unit_Group_Integer = (Number of units in Unit_Group_Slam[1])
      • Unit Group - Pick every unit in Unit_Group_Slam[1] and do (Unit - Create 1 Slam Dummy [Caster] for (Owner of (Triggering unit)) at (Position of (Picked unit)) facing Default building facing (270.0) degrees)
      • For each (Integer A) from 1 to 500, do (Unit - Create 1 Slam Dummy [Caster] for (Owner of (Triggering unit)) at (Position of (Random unit from Unit_Group_Slam[(Integer A)])) facing Default building facing (270.0) degrees)
      • Set Unit_Group_Dummies = (Last created unit group)
      • -------- ---------------------------------------------- --------
      • -------- --The Triggers Main Functions Here-- --------
      • Unit Group - Pick every unit in Unit_Group_Dummies and do (If ((Level of Slam for (Picked unit)) Equal to 1) then do (Unit - Add Slam Dummy [Level 1] to (Picked unit)) else do (Do nothing))
      • Unit Group - Pick every unit in Unit_Group_Dummies and do (If ((Level of Slam for (Picked unit)) Equal to 2) then do (Unit - Add Slam Dummy [Level 2] to (Picked unit)) else do (Do nothing))
      • Unit Group - Pick every unit in Unit_Group_Dummies and do (If ((Level of Slam for (Picked unit)) Equal to 3) then do (Unit - Add Slam Dummy [Level 3] to (Picked unit)) else do (Do nothing))
      • Unit Group - Pick every unit in Unit_Group_Dummies and do (Unit - Order (Picked unit) to Night Elf Warden - Fan Of Knives)
      • -------- ---------------------------------------------- --------
      • -------- --Destroying Variables For Leaks Here-- --------
      • Custom script: call DestroyGroup (udg_Unit_Group_Slam[1])
      • Custom script: call DestroyGroup (udg_Unit_Group_Dummies)
      • -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------
The base ability is Fan of Knives.
 
Level 7
Joined
Jul 20, 2008
Messages
377
  • Set Unit_Group_Slam[1] = (Units within 500.00 of (Position of (Triggering unit)) matching (((Triggering unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))
Check this carefully. lol. Silly little mistake there.

However, the rest of your trigger isn't really going to work anyway. For one, You are creating dummy casters not once, but TWICE per target unit. In fact, you don't need Unit_Group_Integer at all. Furthermore, at the beginning of the trigger, CLEAR the dummies group. Get rid of the "For Each Integer A..." action, and instead of this line:

  • Unit Group - Pick every unit in Unit_Group_Slam[1] and do (Unit - Create 1 Slam Dummy [Caster] for (Owner of (Triggering unit)) at (Position of (Picked unit)) facing Default building facing (270.0) degrees)
Make it a multiple actions one and instead of:

  • Set Unit_Group_Dummies = (Last created unit group)
Put INSIDE that unit group loop I just mentioned above the action for creating these dummy units and then "add last created unit to Unit_Group_Dummies."

Finally, in the main actions of your trigger, shouldn't the first "Picked unit" (the one where you are checking the level of Slam) be Triggering Unit?

And these are leaks:

  • Set Unit_Group_Slam[1] = (Units within 500.00 of (Position of (Triggering unit)) matching (((Triggering unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))
  • Unit Group - Pick every unit in Unit_Group_Slam[1] and do (Unit - Create 1 Slam Dummy [Caster] for (Owner of (Triggering unit)) at (Position of (Picked unit)) facing Default building facing (270.0) degrees)
Because you are creating a point (Position of (blah blah)). Assign that to a variable and then remove the point.
 
Level 13
Joined
Jun 10, 2007
Messages
780
Alright, I redid the trigger. Looks fine? (It's working by the way)

  • Slam Code
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Slam
    • Actions
      • Set Unit_Group_Slam[1] = (Units within 500.00 of (Position of (Triggering unit)) matching (((Triggering unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))
      • -------- --Setting Variables And Creating Dummies Here-- --------
      • Unit Group - Pick every unit in (Units within 500.00 of (Position of (Triggering unit)) matching (((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
        • Loop - Actions
          • Set Position[1] = (Position of (Picked unit))
          • Unit - Create 1 Slam Dummy [Caster] for (Owner of (Triggering unit)) at Position[1] facing Default building facing (270.0) degrees
          • Set Unit_Group_Dummies = (Last created unit group)
          • Unit Group - Add (Last created unit) to Unit_Group_Dummies
      • -------- ---------------------------------------------- --------
      • -------- --The Triggers Main Functions Here-- --------
      • Unit Group - Pick every unit in Unit_Group_Dummies and do (If ((Level of Slam for (Triggering unit)) Equal to 1) then do (Unit - Add Slam Dummy [Level 1] to (Picked unit)) else do (Do nothing))
      • Unit Group - Pick every unit in Unit_Group_Dummies and do (If ((Level of Slam for (Triggering unit)) Equal to 2) then do (Unit - Add Slam Dummy [Level 2] to (Picked unit)) else do (Do nothing))
      • Unit Group - Pick every unit in Unit_Group_Dummies and do (If ((Level of Slam for (Triggering unit)) Equal to 3) then do (Unit - Add Slam Dummy [Level 3] to (Picked unit)) else do (Do nothing))
      • Unit Group - Pick every unit in Unit_Group_Dummies and do (Unit - Order (Picked unit) to Night Elf Warden - Fan Of Knives)
      • -------- ---------------------------------------------- --------
      • -------- --Destroying Variables For Leaks Here-- --------
      • Custom script: call DestroyGroup (udg_Unit_Group_Slam[1])
      • Custom script: call DestroyGroup (udg_Unit_Group_Dummies)
      • -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------
 
Level 7
Joined
Jul 20, 2008
Messages
377
Unit Group - Pick every unit in (Units within 500.00 of (Position of (Triggering unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)

This too.
 
Last edited:
Level 2
Joined
Jun 11, 2008
Messages
20
Since I dont know what this trigger is for I'm assuming your having dummies cast an ability on unit.

If so, I did a similar trigger to this a while back, but my approach was very simple, basically add every unit that you would want to be under the effects of this slam into a unit group[Effect_Units].
Then have a periodic that is creating dummy every second as long as there is 1 or more units in that unit group[Effect_Units] and that there is no more dummies than units in the unit group (that can be done by adding the dummies to a unitgroup[Dummy_Units].)
Then pick every dummy in the group and order them to cast the effect on a random unit from the [Effect_Units]. Make a second trigger that when a unit finishes a spell, that being the effect of the dummies, their removed from the game/group.

Hope this helps
 
Status
Not open for further replies.
Top