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

Income by buildings

Status
Not open for further replies.
Level 4
Joined
Nov 17, 2007
Messages
57
hello :) ive searched the forums for about 40 min and i havent found anything that answers my question, so ill ask now:

im making this map where you can make a gold mine, and upgrade to either an upgrade of the original gold mine, or one that produces gold faster but less, or one that produces more, but more slowly like this:

starting gold mine: 10 gold/10 sec

fast:7 gold/5 sec normal:15 gold/10 sec slow:25 gold/15 sec
fast:9 gold/5 sec normal:20 gold/10 sec slow:35 gold/15 sec
fast:11 gold/5 sec normal:25 gold/10 sec slow:42 gold/15 sec



so thats the table of my gold mines, and the trigger ive used (i just use the starting gold mine as example)

Events
Unit - A unit Finishes construction
Conditions
(Unit-type of (Constructed structure)) Equal to Minor Ore Farm
Actions
Trigger - Turn on minor gold income <gen>
Set GoldBuilding = (Constructed structure)


and the second trigger (which is turned on by the first one) is like this:

Events
Time - Every 10.00 seconds of game time
Actions
Player - Add 10 to (Owner of GoldBuilding) Current gold


but when i enter the map and make the first gold building, it seems like i get gold as if i had all the gold mines... is it because im using the same variable? im really bad at variables, so please fix this for me :)
 
Level 4
Joined
Jan 25, 2009
Messages
117
I think u need second triggers for each goldmine. Set a maximum of goldmines. And use a variable to check how many goldmines there are.
 
Level 4
Joined
Nov 17, 2007
Messages
57
there are 2 triggers for each gold mine, and everyone can only have 1 gold mine (it costs 1 food, and everyone only have 1 food)
 
Level 11
Joined
Feb 16, 2009
Messages
760
Use a array for diffrent variables. Do it like:

Trigger 1
Events
Unit - A unit Finishes construction
Conditions
(Unit-type of (Constructed structure)) Equal to Minor Ore Farm
Actions
Set GoldIncome[Player number of (Owner of (triggering unit))] to GoldIncome[Player number of (Owner of (triggering unit))] + {your value per ore farm build}


Event
Every 10 seconds

Conditions

Actions
Add GoldIncome[1] gold to Player 1's gold
Add GoldIncome[2] gold to Player 2's gold
Add GoldIncome[3] gold to Player 3's gold
Add GoldIncome[4] gold to Player 4's gold
And so on for every player

GoldIncome is a Integer array with a extra size for every player.
 
Level 4
Joined
Nov 17, 2007
Messages
57
this worked fine, but when i upgraded it to Gold Mine (the average speed of 10 sec) then it still gave the gold the Minor Gold Mine gives... so im afraid if i make triggers for all the other gold mines theyll all give gold again (i made them inactive for this try..)

my gold mines are like, first you make the average one, then you can upgrade it to either fast, normal or slow, and then you can yet again upgrade it to 1 of those, and then you can do it again... so theres 10 gold mines in total.. (like you can go Minor - Fast - Slow - medium) etc
 
Level 10
Joined
Sep 6, 2008
Messages
423
This might be crude and ineffective but it should work.
  • Give Gold
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set GoldMines = (Units in (Playable map area))
      • Unit Group - Pick every unit in GoldMines and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Mine1
            • Then - Actions
              • Player - Add 10 to (Owner of (Picked unit)) Current gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to Mine2
                • Then - Actions
                  • Player - Add 20 to (Owner of (Picked unit)) Current gold
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Picked unit)) Equal to Mine3
                    • Then - Actions
                      • Player - Add 30 to (Owner of (Picked unit)) Current gold
                    • Else - Actions
      • Custom script: call DestroyGroup (udg_GoldMines)
 
Status
Not open for further replies.
Top