• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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 20
Joined
Aug 29, 2012
Messages
844
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