• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Income System

Status
Not open for further replies.
Yea already done that.. but the actions... I don't know what should i do next..

I've made some basic income trigger for you. These work for all 12 players (I don't know how much players your map has) and increases their income every 2 minutes, with income being given out every 30 seconds. If you want to make a specific event for the increase of income just change the event of the more income trigger to E.G. 'Unit Dies' and checking if the unit is the 'income unit', than increasing the income. Anyway, here are the triggers:
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Set Income[(Integer A)] = 100)
  • Income
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Player - Add Income[(Integer A)] to (Player((Integer A))) Current gold
          • Game - Display to (Player group((Player((Integer A))))) the text: (Your income is + (String(Income[(Integer A)])))
  • More Income
    • Events
      • Time - Every 120.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Set Income[(Integer A)] = (Income[(Integer A)] + 100))
Hope it helped!
 
@Baskey
Do not use integer A / B
They are slower and less efficient than using a Temp Integer.

Take a look at my tutorial things a GUIer should know.

Also you are leaking player groups.

Figured. I really need to stop making triggers before the evening, I always forget simple stuff like that.
@OP You can indeed use a Temp Integer or Integer A/B, I just feel like Integer A is easier to understand for new people and the only difference is efficiency and speed, but that will 90% of the time be of no issue whatsoever.

For the leak, change the income trigger to:
  • Income
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set TempPlayerGroup = (Player group((Player((Integer A)))))
          • Game - Display to TempPlayerGroup the text: (Your income is + (String(Income[(Integer A)])))
          • Player - Add Income[(Integer A)] to (Player((Integer A))) Current gold
          • Custom script: call DestroyForce(udg_TempPlayerGroup)
Sorry for giving you a leaking trigger (dafuq, brain D:)
 
Figured. I really need to stop making triggers before the evening, I always forget simple stuff like that.
@OP You can indeed use a Temp Integer or Integer A/B, I just feel like Integer A is easier to understand for new people and the only difference is efficiency and speed, but that will 90% of the time be of no issue whatsoever.

For the leak, change the income trigger to:
  • Income
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set TempPlayerGroup = (Player group((Player((Integer A)))))
          • Game - Display to TempPlayerGroup the text: (Your income is + (String(Income[(Integer A)])))
          • Player - Add Income[(Integer A)] to (Player((Integer A))) Current gold
          • Custom script: call DestroyForce(udg_TempPlayerGroup)
Sorry for giving you a leaking trigger (dafuq, brain D:)

Ok.. But I'm currently making a map, and I want a Farm generates 1 gold per 10 seconds. Can you help me?
 
this is a really quick job but will work
  • Untitled Trigger 002
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Custom Script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Farm)) and do (Actions)
        • Loop - Actions
          • Player - Add 1 to (Owner of (Picked unit)) Current gold
 
this is a really quick job but will work
  • Untitled Trigger 002
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Custom Script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Farm)) and do (Actions)
        • Loop - Actions
          • Player - Add 1 to (Owner of (Picked unit)) Current gold

That's what I'm looking for, thanks a lot. I will put you in my credits and +rep for those who helped me.. =)
 
Status
Not open for further replies.
Back
Top