• 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 help needed (do something ever 2 seconds hero is in region)

Status
Not open for further replies.
Level 5
Joined
Oct 6, 2010
Messages
85
Here is a silly thing ^_^

I cant seem to get a simple trigger to work...
Here is what I want to happen:

Hero enters region -> give owner of hero 10 gold every 2 seconds that the hero is in the region .

It sounds so simple and I feel ashamed to have such problems but I'm seriously confused.
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
  • moneys
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (your region) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
        • Loop - Actions
          • Player - Add 100 to (Owner of (Picked unit)) Current gold
note that this leaks
 
Level 9
Joined
Apr 23, 2010
Messages
312
First of all, this is not the trigger section of the forum, this is for general map making questions. For trigger questions post in the triggers and scripts thread.

Second, I made a modification to millzy's trigger to remove the unit group leak.
  • moneys
  • Events
    • Time - Every 2.00 seconds of game time
  • Conditions
  • Actions
    • Set GroupVar = Pick every unit in (Units in (your region))
    • Unit Group - Pick every unit in GroupVar matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
      • Loop - Actions
        • Player - Add 10 to (Owner of (Picked unit)) Current gold
    • Unit Group - Pick every unit in GroupVar and do (Unit - Hide (Picked unit))
    • Custom script: call DestroyGroup(udg_GroupVar)
For more information about leaks, check Things That Leak.
 
^I don't get why you have used action 'Hide unit' - explain.
Also, why not cut that trigger using bj?

Edited millzy version.
  • moneys
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (your region) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
        • Loop - Actions
          • Player - Add 100 to (Owner of (Picked unit)) Current gold
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
  • moneys
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (your region) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
        • Loop - Actions
          • Player - Add 100 to (Owner of (Picked unit)) Current gold


this is alot better u dont need the hide units either

@Spinnaker, I did that because that's what it said to do in things that leak.

i read the thread u posted its just giving u an example of when u would need to pick units u dont need to hide them
 
Status
Not open for further replies.
Top