• 🏆 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!

Harvesting - How does Blizz do it?

Status
Not open for further replies.
Level 7
Joined
Jun 16, 2008
Messages
253
Does anyone know how Blizzard has set out the whole harvesting deal? Such as harvesting wood from trees, where they get a little lumber integer or whatever increasing with every hit.

I ask this basically because I'd like to duplicate this to a certain extent, but instead of a little resource counter going up or however it works, the trigger simply adds charges to a little lumber item that the peasant carries.

Such as, I have a fishing boat that casts a modified aerial shackles on a 'fish', I want the fishing boat to recieve one charge of fish for every second it is using the 'fishing net' on the unit, and stop recieving if it cancels the ability.
(I'm having problems figuring this little trigger out.)

Most importantly though I want to know how they do it so that my peasants can harvest Wheat destructibles, and Ore destructibles. (And I wouldn't mind knowing how harvest nearest lumber/gold works either).

Cheers.
 
Level 22
Joined
Feb 4, 2005
Messages
3,971
A peasant hits a tree once = 1 lumber, hits 10 times = 10 lumber and goes back. A tree has 100 hp I think, after hit 100 times it is gone. You can change the amount of lumber carried by editing the ability. I don't have world edit infront of me but here is how it works since I based a skill on aerial shackles:

What is the duration -hero duration -unit of your Aerial shackles? Let's assume you set 10. The duration of the shackles and the Wait in the triggers must be the same.

  • Events
  • Unit - A unit starts the effect of an ability
  • Conditions
  • Ability being Cast equal to Aerial Shackles
  • Actions
  • Trigger - Turn on CatchFish
  • Wait - Wait 10 seconds
  • Trigger - Turn Off CatchFish
You must create a 2nd trigger: e.g CatchFish that is initially off (untick initially on)

  • Events
  • Time - Every 1.00 second of game time
  • Conditions
  • Actions
  • Player - Set Current Lumber/Fish to Current LumberFish + 1 for Player X
Use arhitmetic function X + Y and replace X with the current lumber, scroll down below to find it + 1. When I get home I might do it if you still cannot find it with this info above.

If you want to harvest wheat, since you can't target them, you will have to change the model of a tree (haven't tried if it works with say a barrel) with a model of wheat from the object editor.
 
Level 7
Joined
Jun 16, 2008
Messages
253
I've got a Destructible-Wheat that can be attacked.

With lumber harvesting though, it can't just be a simple attack factor, because you can order peasants to literally attack the tree and they don't get any lumber doing it that way. I suppose they just flick on and off the lumber factor according to if the peasant is using harvest ability.

My main wonderment with the harvesting is how they kept track of what unit had what amount of lumber, but that facet has been solved in a nother thread.

What I would like to know is how to get the trigger to stop, if the ability is cancelled. So that if you have a 30 second fishing spell, you can't just stop fishing at 20 seconds, and still get the rest of your fish over the remaining 10 seconds. If my fishing boat stops at 20 seconds, I want him only to have fished 20 fish, and not to recieve any more.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
What you can do is make the ability autocast, with 1 second duration and 1 second cooldown. When it's turned on, you simply keep fishing until you toggle it off. When on, it leaves behind a buff (for 1 second, which means the buff disappears if autocast is turned off, since it only lasts 1 second), and as long as the unit has the buff, you gain your resource.
 
Level 7
Joined
Jun 16, 2008
Messages
253
Hey thanks for reply, but I solved the prob anyhows. Next map update should prove at least mildly interesting.

SOLVED.
 
Level 7
Joined
Jun 16, 2008
Messages
253
Should rephrase, I didnt get the answer to my specific question, but I don't need it any more.

The limits of my knowledge are thus: I'm guessing Blizzard uses these fabled 'structs' in regards to the unit, and harvested lumber/gold. There is no function that I personally know of that allows you to get the integer of lumber currently harvested.
My only thought is that you should make a trigger that counts the amount of times the peasant hits a tree, storing the number in a variable ('local' is better if you want this trigger for all your peasants etc...)
When the variable is equal to (waitforcondition is useful since locals can only be used within the one trigger) whatever the lumber cap is, then ACTION-

That's my input. If it's wrong, or you happen to actually know less than I do, don't bother asking me, post it on a neat little independant thread for an expert to spot. In fact, you should probably do that regardless.
 
Status
Not open for further replies.
Top