How do I make farms that give gold every 5 or so seconds?

TooSlowFcker

New Member
Reaction score
10
I want a farm that gives the owner of that unit, 1 gold per 5 seconds, but im not sure how to do it
I tried this trigger but it doesn't work
Code:
Untitled Trigger 018
    Events
        Time - Every 5.00 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Triggering unit)) Equal to Farm)) and do (Actions)
            Loop - Actions
                Player - Add 1 to (Owner of (Picked unit)) Current gold
 

I_RULE_YOU

New Member
Reaction score
34
This could be wrong, but I think it's not working because it says

Code:
(Unit-type of (Triggering unit)) Equal to Farm)

Doesnt that mean a unit would have to be classified as a farm, the way a Tauren Totem is classified as a structure? Or am I totally wrong.
 

MurderMode

Giving new meaning to co-op... slowly
Reaction score
154
Code:
Gold Farm
    Events
        Time - Every 5.00 seconds of game time
    Conditions
    Actions
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                Player - Add (1 x (Number of units in (Units owned by (Picked player) of type Farm))) to (Picked player) Current gold

Notice I did the add gold value as an arithmetic function... if it's a 1x multiplier you can just add the unit count on it's own without the multiplier, but I just put it in this example so if you want the farms to be worth more then 1 gold each you know how to do it.

Actions used in the trigger are -
Player Group - Pick every player
Player - add property

Functions used for the property value -
arithmetic
units- count units in unit group

ALSO, notice where you put 'triggering unit equal to farm' in your trigger.... that will do nothing. To use triggering unit the event has to be an event triggered by a unit, where as yours is a time event (not unit triggered). If you are doing a unit group action with matching conditions like that in the future, instead of making it triggering unit you have to make it 'matching unit' to work.
 

TooSlowFcker

New Member
Reaction score
10
yeah, but when the farm died, I kept receiving gold
here's my trigger
Code:
Untitled Trigger 018
    Events
        Time - Every 10.00 seconds of game time
    Conditions
    Actions
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                Player - Add (1 x (Number of units in (Units owned by (Picked player) of type Farm))) to (Picked player) Current gold
did i do something wrong
 

MurderMode

Giving new meaning to co-op... slowly
Reaction score
154
hmmmm, that's strange. It looks right...

All that trigger does is add 1 gold for every farm a player has every 10 seconds... if the player has 5 farms when the periodic timer hits 10 seconds then he's going to get 5 gold. If one dies and he has 4 left, he'll get 4 gold on the 10 sec mark. So if he has zero farms he should be getting 1 x 0 = 0 gold every 10 seconds.

There must be another trigger giving you gold?

I'll test it out, maybe they are still counted in death
 

TooSlowFcker

New Member
Reaction score
10
thanks, I'm a bit confused myself, i was positive your trigger made sense, but appearantly there's something we're missing
well i do have another trigger that gives gold, but it's not connected in anyway to your trigger, so it must be something else
 

MurderMode

Giving new meaning to co-op... slowly
Reaction score
154
It seems to be that they still count after death lol. Gheyness... anyways I made a diff version of your original trigger, I tested it to so this will work for you -

Code:
Gold Farm
    Events
        Time - Every 5.00 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                Unit Group - Pick every unit in (Units owned by (Player((Integer A))) matching ((Unit-type of (Matching unit)) Equal to Farm)) and do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Picked unit) is alive) Equal to True
                            Then - Actions
                                Player - Add 1 to (Player((Integer A))) Current gold
                            Else - Actions
 

lmichael89

New Member
Reaction score
3
There are multiple ways, but heres an easy way, Make a Farm and give it a unit that it can create[Dummy unit(gold) with 1-2hp with -1hp regen]. Then make a trigger to to select all farms in playable map area and order to train the unit every 5 or so seconds. Make a trigger to add 1-5 gold for owner of unit being created [Gold].
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top