Snippet Building generate gold

asipo

New Member
Reaction score
15
In this Snippet i will show you how to make the building generate a gold or lumber.
This snippet is simple and done using GUI.

The simplest building income trigger will be :
Trigger:
  • Generate Gold
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set GoldMineIncome = (Units of type Gold Mine)
      • Unit Group - Pick every unit in GoldMineIncome and do (Actions)
        • Loop - Actions
          • Player - Add 500 to (Owner of (Picked unit)) Current gold
      • Unit Group - Remove all units from GoldMineIncome


However, that's not all since we can have many income condition.
Thus, this thread consist of many snippet regarding income condition.

Most of the condition is supported in my map example and download it here.
View attachment BuildingIncome v1.w3x

Simplest and typical type income
Periodic income based on the building itself
Building "Gold mine" and "Gold Pot" from my demo map

Gold Mine
GoldMine.jpg

Every 20 seconds the owner of gold mine will receive 500 gold for each gold mine the player have. Using unit group.

Gold Pot
GoldPot.jpg

Count the total Gold Pot the player have (Using integer). And then evey 2 seconds it give the income.
For each Gold Pot its provide 1 gold every 2 seconds
Thus, Income = Total Gold Pot x 1
The income is summed up and then floating text display at the center of the current camera

_________________________________________________

A bit complex type of income
Periodic income based on ability level
Building "Farm" and "LumberMill" from my demo map

Farm
Farm.jpg

Just like the Gold mine, but this time the abilit level determine the income rate
Each ability level increment the income by 100
Income = Total Farm x (Ability Level x 100)
This ability level can me increase by upgrading the building (farm)

Lumber Mill
LumbeMill.jpg

Just like the Farm but this time the ability level is determine by research.
You can incarese the level at the "Upgrade Center" building

_________________________________________________

Harvest type income
Building periodically generate an item so it can be sell
Building "Grain Farm" from my demo map

Grain Farm
GrainFarm.jpg

Every 10 seconds, the grain farm will create an item nearby it
This item can be use by the player to sell it
But i this example, my item is a bundle of lumber that instantly give the player 10 lumber when the item is acquired

_________________________________________________

Animal farm type income
Train a unit and when the unit is kill it will give income
Building "Pig Farm" from my demo map

Pig Farm
PigFarm.jpg

The idea is when the player kill the Pig, they will get a gold.
Thus just make a Building that can train the Pig.
However, I made the gold get is depend on the current amount of the pig when it is killed and the Pig production is infinite












Key word :
building generate gold, building generate income, periodic income, building income
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Nice :D Haven't dl'd the map, but ...

1 thing though... Might wanna add a condition like Number of units in GoldMineIncome Equal to 0 then Skip remaining actions ;)
So that it won't display +0 :D
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
That leaks and can easily be found with the search button in WEHZ
 

UndeadDragon

Super Moderator
Reaction score
448
Replace:

Trigger:
  • Unit Group - Remove all units from GoldMineIncome


With:

Trigger:
  • Custom Script - call DestroyGroup( udg_GoldMineIncome )
 
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