Resource generating building

Level 12
Jun 1, 2010
In my type of map, peasants should not gather lumber or gold, but instead, resources generate from a building, the Lumber Mill and Gold Mine. How can I make Lumber Mill and Gold mine generate resources without peasant harvesting. To do that, I need a trigger. It is like, I need it like this (EVENT-every 20 seconds, CONDITION-if Lumber Mill exists and is owned by Player 3, ACTION- Add property, add 100 lumber to Player 3).

How do I make the condition?
Level 8
Jan 8, 2010
  • Events
    • Time - Every 20.00 seconds of game time
  • Conditions
  • Actions
    • For each (Integer A) from 1 to 12, do (Actions)
      • Loop - Actions
        • Custom script: set bj_wantDestroyGroup=true
        • Unit Group - Pick every unit in (Units owned by (Player((Integer A))) of type Lumbermill) and do (Actions)
          • Loop - Actions
            • Player - Add 100 to (Player((Integer A))) Current lumber
you don't really need a condition. you just have to pick how many Lumbermills the player has. if he has at least one, the trigger will add 100 lumber with every Lumbermill. if the player has none, then nothing will be added.
Level 20
Jul 14, 2011
Pick Every units of Type leaks. It's not solved with "set bj_wantDestroyGroup = true". I think you need to use "call DestroyGroup(sourceGroup)" or something like that.

"Get Units of Type" is
function GetUnitsOfTypeIdAll takes integer unitid returns group
    local group   result = CreateGroup()
    local group   g      = CreateGroup()
    local integer index

    set index = 0
        set bj_groupEnumTypeId = unitid
        call GroupClear(g)
        call GroupEnumUnitsOfPlayer(g, Player(index), filterGetUnitsOfTypeIdAll)
        call GroupAddGroup(g, result)

        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    call DestroyGroup(g)

    return result

And "GroupAddGroup" is

function GroupAddGroup takes group sourceGroup, group destGroup returns nothing
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    set bj_groupAddGroupDest = destGroup
    call ForGroup(sourceGroup, function GroupAddGroupEnum)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(sourceGroup)

I'm not sure how to use/make it though.