• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Complete Noob at triggering; why does this not work?

Status
Not open for further replies.
Level 1
Joined
Mar 11, 2012
Messages
1
  • Events
  • Time-Every 5.00 seconds of game time
  • Conditions
  • Actions
  • For Each (Integer A) from 1 to 12, do (Actions)
  • Loop-Actions
  • Set Temp_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Farm) and (((Owner of (Matching unit)) Equal to (Player((Integer A)))) and (((Matching unit) is alive) Equal to True)))
  • Player - Add ((Number of units in Temp_Group) x 50) to (Player((Integer A))) Current gold
  • Custom Script: call DestroyGroup( udg_Temp_Group )
That is the trigger I tried to use (sorry if I didn't format it correctly), I'm trying to get a periodic income system to work.
 
Last edited:
Level 17
Joined
Nov 13, 2006
Messages
1,814
  • Events
  • Time-Every 5.00 seconds of game time
  • Conditions
  • Actions
  • For Each (Integer A) from 1 to 12, do (Actions)
  • Loop-Actions
  • Set Temp_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Farm) and (((Owner of (Matching unit)) Equal to (Player((Integer A)))) and (((Matching unit) is alive) Equal to True)))
  • Player - Add ((Number of units in Temp_Group) x 50) to (Player((Integer A))) Current gold
  • Custom Script: call DestroyGroup( udg_Temp_Group )
That is the trigger I tried to use (sorry if I didn't format it correctly), I'm trying to get a periodic income system to work.

u destroy the group inside the pick loop? sorry coz i can get it if u use
Code:
 tagg, try use [trigger] tag.
also dont destroy the group :P
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
right click in the top of your trigger where it shows a little sheet of paper and your triggers name and hit copy as text than post it in trigger tags
 
Level 11
Joined
Nov 15, 2007
Messages
781
u destroy the group inside the pick loop? sorry coz i can get it if u use
Code:
 tagg, try use [trigger] tag.
also dont destroy the group :P[/QUOTE]

If he didn't destroy the group within the loop it would leak.

I can't see what's wrong with it personally.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
  • Income
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • For Each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set Temp_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Farm) and (((Owner of (Matching unit)) Equal to (Player((Integer A)))) and (((Matching unit) is alive) Equal to True)))
          • Player - Add ((Number of units in Temp_Group) x 50) to (Player((Integer A))) Current gold
          • Custom script: call DestroyGroup( udg_Temp_Group )
That is the trigger I tried to use (sorry if I didn't format it correctly), I'm trying to get a periodic income system to work.

Could you tell us exactly what is not working?
Because as far as I know, this should work.
Is it not adding the income?
Are you sure there are any farms inside the map? (Check the unit type of the farms inside your map)
Are you sure the farms are not owned by the neutral player?

Code:
Hint: You can copy a trigger by right clicking the name inside the trigger's functions and then click on copy as text. Which you can then paste within trigger tags.
Or you can manually use spacebars in order to put them on the correct place. 3 spacebars inbetween. So: name = 0 spacebars Events = 3 spacebars actual events within Events = 6 spacebars etc...
Just make sure that the names are exactly the same as in the trigger editor so that they won't all show up as question marks.

If it doesn't add income then that means that 0x50 = 0 so there is something wrong with the enumeration of the group.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
If he didn't destroy the group within the loop it would leak.

I can't see what's wrong with it personally.

its sure if it is leak what u dont use anymore a group and u store another group to variable?

since i know this aint leak because point is lost when u use group enum again (UG - unit group)
JASS:
        call GroupEnumUnitsInRange(udg_UG, nx, ny, 250, null)
        loop
            set pu = FirstOfGroup(udg_UG)
            exitwhen (pu==null)
             //do action
            call GroupRemoveUnit(udg_UG, pu)
        endloop
 
Level 11
Joined
Nov 15, 2007
Messages
781
Sorry, I misread. I meant inside of the "From 1 to 12" loop.

If the group is being destroyed inside of the unit group loop then yeah that would break the trigger completely, it would only be able to add 1 instance of income per player.
 
Status
Not open for further replies.
Top