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

Grow Tree Ability

Status
Not open for further replies.

ndh

ndh

Level 8
Joined
Apr 21, 2012
Messages
344
Hey there Hive,

I would like to add a building to my map named "Tree Farm", which after you build it, trees start to grow around it in an area. Problem is, i have no clue how to make this happen. So if someone could help me i would greatly appreciate it :ogre_haosis:

And don't worry about triggers, i have new gen pack so go wild :goblin_good_job:

What would really make it cool, would be the ability to place tree "crops". Kind of like having a farm place down a wheat field, but instead of wheat, it would be trees that grow over time. Anyways, if you don't feel like adding this bit, don't sweat it. Mostly just need the passive tree growth thing :ogre_haosis:
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
you dont give alot of details but here is something simple that should work for you

  • Build farm
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Footman
    • Actions
      • Unit Group - Add (Constructed structure) to farm_group
  • Tree loop
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in farm_group and do (Actions)
        • Loop - Actions
          • Set Farm_loc = (Position of (Picked unit))
          • Set Angle = (Random integer number between 1 and 360)
          • Set Distance = (Random integer number between 10 and 500)
          • Set Tree_loc = (Farm_loc offset by (Real(Distance)) towards (Real(Angle)) degrees)
          • Destructible - Create a Summer Tree Wall at Tree_loc facing (Random angle) with scale 1.00 and variation 0
 

ndh

ndh

Level 8
Joined
Apr 21, 2012
Messages
344
you dont give alot of details but here is something simple that should work for you

  • Build farm
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Footman
    • Actions
      • Unit Group - Add (Constructed structure) to farm_group
  • Tree loop
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in farm_group and do (Actions)
        • Loop - Actions
          • Set Farm_loc = (Position of (Picked unit))
          • Set Angle = (Random integer number between 1 and 360)
          • Set Distance = (Random integer number between 10 and 500)
          • Set Tree_loc = (Farm_loc offset by (Real(Distance)) towards (Real(Angle)) degrees)
          • Destructible - Create a Summer Tree Wall at Tree_loc facing (Random angle) with scale 1.00 and variation 0

Hmm, let me be a bit clearer then :ogre_haosis:

When the building finishes, trees will start to grow around the structure. But this building can only "grow" 10 trees around it, as not to cause massive tree lag later. It would be better if the trees actually looked like they were growing instead of just popping up as well. And when 1 tree is cut down, another starts to grow, but the maximum trees the building can sustain is 10.
 
Level 11
Joined
Feb 23, 2009
Messages
577
Here you go,

Trees respawn at 6:00 am every morning (not sure what kind of system you wanted for that). Also instead of creating trees over and over I simply create 10 per farm then they get revived if a farm is nearby.

Check it out and tell me what you think!

EDIT: I love building a bunch it's hilarious XD
 

Attachments

  • TreeGrowth.w3x
    20.7 KB · Views: 55
Level 11
Joined
Feb 23, 2009
Messages
577
Upgraded abil + the unit caps explained ;)

The trees still spawn real close to the buildings I can make it more if you want, made it 150. But it calculates from the center as it isn't moving a region around but just checking one point.
 

Attachments

  • TreeGrowth+UnitCaps.w3x
    21.3 KB · Views: 43
Status
Not open for further replies.
Top