HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Detecting Gold/Lumber Deposit

10-05-2009, 04:43 PM#1
Spellbound
Hi. Is there a way to
1) detect when a worker drops off gold/lumber at a town hall and
2) when a wisp latches itself to a tree to begin harvesting lumber?

For 2), I want to change the Wisp's lumber harvest anim to work anim. Changing the basic animations in the spell itself doesn't work, so I'm guessing triggers would.
10-05-2009, 04:53 PM#2
Alevice
probably by orderids. there was a handy debug script someone here posted that displayed the relevant debug orders.I may post a simpler (or not) script for it.
10-06-2009, 08:16 AM#3
Spellbound
Well there's no order id to deposit gold or latching to a tree :(
Unless I'm doing it wrong that is:
Collapse JASS:
call BJDebugMsg("OrderId is: "+I2S(GetIssuedOrderId()))
10-06-2009, 11:00 AM#4
fX_
workers are issued harvest orders whenever they drop their resources.
they are also issued orders to return their resources when they reach their carrying capacities as they harvest.
10-06-2009, 03:48 PM#5
Troll-Brain
Quote:
Originally Posted by fX_
workers are issued harvest orders whenever they drop their resources.
they are also issued orders to return their resources when they reach their carrying capacities as they harvest.
But you forget orders given with the shift key.
In fact unless you trigger all the thing you can't know when an unit drop a resource.
10-07-2009, 03:57 AM#6
fX_
i did forget about queuing.
10-07-2009, 05:57 AM#7
Spellbound
Well currently I am using the harvest order to kill specific workers whenever they deposite gold, but the problem is, what happens when the gold mine is destroyed when it gets depleted? There will be no harvest orders for the last workers that are spawned then.
10-07-2009, 10:12 AM#8
Tot
Quote:
Originally Posted by Spellbound
Well currently I am using the harvest order to kill specific workers whenever they deposite gold, but the problem is, what happens when the gold mine is destroyed when it gets depleted? There will be no harvest orders for the last workers that are spawned then.

check if they enter a specific area around the drop point and kill them when they enter
(needs own harvest trigger to work properly)
10-07-2009, 10:29 AM#9
Spellbound
I cant exactly use regions... unless you're suggesting a 'pick every unit in range' type of trigger that executes every X seconds???
10-07-2009, 10:40 AM#10
Tot
Quote:
Originally Posted by Spellbound
I cant exactly use regions... unless you're suggesting a 'pick every unit in range' type of trigger that executes every X seconds???
yep, a
Quote:
'pick every unit in range' type of trigger that executes every X seconds
thingy; works without noticeable performacedrop (in all my maps)
10-07-2009, 01:48 PM#11
Spellbound
Interesting...

Well, I guess that's what I'll go for then.
10-07-2009, 02:04 PM#12
Anachron
Pick every unit isn't a well idea, however, I suggest creating a trigger, add the Event: A unit comes into range of UNIT for all your halls, and then check whether unit has resources or not.
10-07-2009, 04:53 PM#13
Spellbound
You can detect if a unit has resources?
10-07-2009, 04:53 PM#14
Troll-Brain
Quote:
and then check whether unit has resources or not
and how you can know that ?
Again if you don't trigger all the thing you can't really know if an unit has some resources and how much.
10-07-2009, 05:15 PM#15
Tot
make your own harvest trigger, storing the amount of ressources in the unit's userdata (gold and lumber, like RGB/(HTML color) values)