• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Harvest gold (is it possible?)

Status
Not open for further replies.
Level 4
Joined
Oct 11, 2008
Messages
90
I have a peasant that can harvest both gold and lumber. The problem is that when he harvests gold, he enters the gold mine, waits 1 second, then he comes out and returns to town hall. I want him to harvest gold like he does with lumber (playing the attack animation, waiting a second, then returning to town hall to empty his bag).
Is it possible such a thing?
Remember that the peasant must harvest both gold and lumber, so i can't change a tree to a gold mine model and switch the gold and lumber resources (a very ingenious idea that i found in another topic here on the hive).
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
One a bit complicated way came into my mind:

Create an ability based on Channel. Give it some follow through time (around 5-10 seconds). Keep "visible" unchecked so it does not show in the ability panel. Make it unit ability. Set the animation to stand work gold. Give the ability to peasant.

When a peasant is issued an order targeting a gold mine (catch it with a trigger), add it to a unit group. When any unit in that group comes within some range of the gold mine (or enters a region) issue an order that triggers the ability you gave him. Then create a trigger that detects when a peasant finishes the effect of an ability (ability equals the mining ability), remove it from the unit group and order it to right click nearest town hall. Then detect when it gets near a town hall and give the player gold. You may need to create a dummy unit that enters the gold mine to reduce the amount of gold in the mine if there's no trigger to edit gold in a gold mine. Also you may need to create the needed floating texts.

Add/remove units from unit groups when needed. The unit groups can be used to check whether the unit should start harvesting gold, so that peasants that just randomly get near a gold mine don't start to harvest it.
 
Level 4
Joined
Oct 11, 2008
Messages
90
That's a good way to make it but it is a bit complicated. I thought there may be a trick to doing this. If there isn't then ill just leave it the way it is.
 
Status
Not open for further replies.
Top