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

[General] Generating lumber for every farm you build.

Status
Not open for further replies.
Level 2
Joined
Oct 25, 2018
Messages
6
I am looking for a way to generate lumber periodically for every [custombuilding] a player builds.

There's 4 players

So if one player builds 3 farms they will get 3 lumber every second, and another player builds only 2 then 2 lumber a second. I'm trying to learn the trigger system, but it's all so confusing and I'm sure there are veterans who know how to set this up or can point me in the right way to make this trigger.

Thanks for anybody who helps me with this issue.
 
Level 30
Joined
Aug 29, 2012
Messages
1,383
Here's one way to do it (my editor's in French but you should get the idea)

  • Temp
    • Evénements
      • Temps - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Boucle - Actions
          • Set TempVariable = (Number of units in (Units owned by (Player((Integer A))) of type Ferme))
          • Joueur - Add TempVariable to (Player((Integer A))) Bois actuel
Basically, I use a loop from 1 to 4 (as you want players 1 to 4 to have the income).
Then I store the number of farms they own into my TempVariable, an integer variable. Every second, the game checks how many farms each player owns.
Lastly, I add wood based on the number saved in my variable, tadah!

Edit: I would store the variable into separate triggers (for instance, checking when a farm is build/destroyed and increment or decrement the variable in consequence) instead of erasing the value every second, but that's just for the example.
 
Status
Not open for further replies.
Top