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

Give Items to all Heroes

Status
Not open for further replies.
Level 2
Joined
Aug 12, 2007
Messages
13
Hi Guys.
I am working on a map with a friend and i now want to something like dota, if a tower gets destroyed (Unit Dies, Condition its the tower..) that every Hero from the fraction who killed the tower gets 250 gold. So i want to give every hero the item which gives gold (like dota, for the animation and stuff).

i triggered the following:
  • TowerKill Ally
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Guard Tower
    • Actions
      • Player Group - Pick every player in g1 and do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Equal to True)) and do (Actions)
            • Loop - Actions
              • Hero - Create towergold and give it to (Matching unit)
However, that is not working. It only doesnt work cuz of the Condition in the Unit Grp thing (Units owned by Picked player matching Picked unit is a Hero equal to true). If i just use picked hero, every unit will get this item (so summoned units and building, since they are all in force a (g1).)

Can you help me please? Thanks in adv!
 
Level 5
Joined
Apr 16, 2005
Messages
153
For unit groups, i dont do the (Pick every unit and do (condition)) Instead i use the If (condition) then actions (multiple functions) and include my action in that example:

  • Melee Initialization
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is A structure) Equal to True
            • Then - Actions
              • Unit - Kill (Picked unit)
            • Else - Actions
 
Level 2
Joined
Aug 12, 2007
Messages
13
Thanks for the fast answer! Tried it with if and its working great.. dunno why my first trigger didnt work... whatever, here is the working one now:

  • test
    • Events
      • Player - Player 1 (Red) types a chat message containing test as An exact match
    • Conditions
    • Actions
      • Player Group - Pick every player in g1 and do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A Hero) Equal to True
                • Then - Actions
                  • Hero - Create towergold and give it to (Picked unit)
                • Else - Actions
                  • Do nothing
 
Level 5
Joined
Apr 16, 2005
Messages
153
anytime, o and also, im not sure why the Unit Group condition wont work. Just always have used the If cond, then action.
 
Status
Not open for further replies.
Top