• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

How to make certain trees give more wood per tick

Status
Not open for further replies.
Level 3
Joined
May 27, 2023
Messages
18
i know how to make them have more wood overall, but I want where instead of +5 a certain rare tree can give +15, making them faster to harvest. Got any ideas on how to achieve this?
 

Uncle

Warcraft Moderator
Level 74
Joined
Aug 10, 2018
Messages
7,951
i know how to make them have more wood overall, but I want where instead of +5 a certain rare tree can give +15, making them faster to harvest. Got any ideas on how to achieve this?
It's not going to be easy and probably not possible without some bugs/annoying issues.

But there's plenty of custom resource systems on Hive to check out, maybe one already does what you need:

The breakdown:

Limitations:
1) You cannot detect when a unit adds Lumber to their "Lumber Harvest" ability.
2) You cannot detect when a tree is damaged, at least using standard Events.
3) Wisps may require special care since they harvest Lumber differently than the other 3 races.

Possible solutions:
1) You should be able to figure out when a unit starts harvesting using Orders. I imagine the above linked system uses this method. From there you may be able to detect when a Tree that is being harvested loses life since this occurs when a Peasants/Peon/Ghoul attacks the tree (harvests from it). You'll need to account for Siege units that can damage and destroy trees.
2) Maybe use Timers in combination with #1 to determine how long a Unit has been harvesting.

I would use a Unit Indexer or Hashtable to link the worker to the tree it's harvesting.
  • Set Variable CV = (Custom value of your worker)
  • Set Variable Worker_Tree[CV] = (The tree it has begun harvesting)
  • If the tree is a special rare tree then Set Variable Worker_Extra_Lumber[CV] = 5
  • Else
  • Set Variable Worker_Extra_Lumber[CV] = 0
 

Remixer

Map Reviewer
Level 33
Joined
Feb 19, 2011
Messages
2,119
You can detect when a unit is issued an order targetting an object, and then check that object's type - let's say Tree A and Tree B. If the target is Tree Type A, then Add a more efficient harvesting ability to the unit and remove the old one. If it's Type B do that but in reverse. Seems to work.

The only issue I can see is when a unit changes the type of tree mid-harvest. In that scenario they lose the lumber they have already harvested from the type of tree previously harvested - but I think you could check when a tree dies and order the unit to either return the resources or to look for the nearest tree of the same type.

Edit: I also tried SetUnitAbilityIntegerField and those natives but they seemed to have no effect on the Lumber Harvesting.
 

Attachments

  • LumberHarvestTest.w3m
    18.5 KB · Views: 4
Status
Not open for further replies.
Top