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

Houses Generating Income

Status
Not open for further replies.
Level 2
Joined
Dec 7, 2010
Messages
14
Hello all- I just joined this forum and I love the images and such that it has in it, but I simply do not understand the coding in the map maker. Can anyone tell me how to set it so that certain buildings slowly generate income a-la Tree Tag or Pimp my Murloc.

I am building a Melee map that has twice as many unit options and new abilities for each race, but I really want to make it so that the human houses, orc burrows, etc can produce additional resources.

Also, does anyone know how to set it so that buildings have gold that can be mined from them?
:goblin_yeah:
 
For the first thing, you have to trigger all.. create a variable (integer type) and store the income points to it. You can use an periodic trigger to check how many buildings the players own and set the variable to the value you want (like he owns 5 houses, that gave 2 income each, so the trigger will store 10 into the variable). After that give the value within the variable to the specific player. If a building gets destroyed the trigger will notice it, too.

Trigger coul look like this:
Code:
Event: Each x seconds of Game time (each time, when you want to give the income)
condition:
action: Loop with Integer A (looping this to have one trigger for each player)
- Select each units owned by Player A of type XYZ (your buildings)
- Variable[A] = amount of picked units of type X * 2 income
- Variable[A] = Variable[A] + amount of picked units of type y * 5 income
- etc.
Give Player[A] "Variable[A]" amount of gold to it's existing gold

there should be similar triggers and actions, dunno the exact ones, gl!


For the other thing, you just need to base your building on the normal mine (i believe there's also some ability or something like that to use it, but it's easier to copy the mine). Just copy it and change the options to your needs, like model, amount of gold that can be mined, etc.
 
Like this?
  • Automatic Gold
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • -------- Picks every entangled gold mine --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units of type Entangled Gold Mine) and do (Actions)
        • Loop - Actions
          • -------- Adds gold to the owning player --------
          • Player - Add 50 to (Owner of (Picked unit)) Current gold
          • -------- Removes gold capacity in the gold mine --------
          • Neutral Building - Set (Picked unit) to ((Resource quantity contained in (Picked unit)) - 50) gold
          • -------- Some 'fake' floating text to simulate the gathering of gold --------
          • Floating Text - Create floating text that reads |c00FFD900+50 above (Picked unit) with Z offset 100.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 60.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 1.70 seconds
 
Status
Not open for further replies.
Top