• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

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

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
^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