"Harvesting" a unit like a Tree

Nogusta

New Member
Reaction score
1
Hi guys, I was wondering, is there a way to make a unit harvestable like a tree? When I mean harvestable, I mean that a worker unit has to be able to take time to "chop" the tree and get lumber from it. This "chopping" will reduce the life of the unit slowly until it dies. I was wondering if there was an ability like "gold mine ability" for trees or some non laggy way to implement it with triggers.
 

Meowier

New Member
Reaction score
6
There's a number of ways you can do it. You can simply create a unit, give it a passive ability based off... so, Evasion. But give no evasion %. Do a trigger like...

Code:
Event - A unit is attacked
Condition - Attacking unit has ability "MineEnemies" [b]and[/b] Attacked unit is equal to MinableUnit
Action - Unit - Set custom value of attacking unit to (custom value of attacking unit) + (1)

And when the unit goes back to the place to give the 'resources' back. This could do it.

Code:
Event - A unit enters a region
Condition - Region equal to MineDropOff
Action - Player - Give gold equal to custom value of triggering unit
Action - Unit - Set custom value of triggering unit to 0

However, if the mine drop off is buildable, you will need to do the drop off some other way. If you want the unit to show how much resources it has, add this to the action on the first trigger.

Action - Unit - Set level of MineEnemies to custom value of unit


And just give the MineEnemies ability lots of levels, and in the tooltip change the number each time.
 

chovynz

We are all noobs! in different states of Noobism!
Reaction score
130
Or just change the model file of a tree to something else.
 

FroznYoghurt

New Member
Reaction score
37
you might also wanna add the "carrying lumber" animation tag to the unit when it harvests

You could use a dummy channel ability for the drop of
Code:
E - unit starts the effect of an ability
C - ability being cast equal to drop off and unit type of target unit of ability being cast equal to "Lumber Mill" (or whatever)
A - 
 Give lumber equal to level of "mineenemies" for triggering unit
 set level of "mineenemies" for triggering unit to 1
 remove "lumber" (or what the name of the tag is, ive forgot) from triggering
 
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