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

Custom Race Lumber Harvesting

Status
Not open for further replies.
Level 5
Joined
Aug 14, 2020
Messages
118
Hi everyone, this was supposed to be an easy thing but when I started working on triggers I found out that it's almost impossible! all I wanna do is to force workers of a certain race to only harvest from Crystals instead of trees but other races can harvest from both crystals and trees. it feels like there is no way to detect if worker is harvesting from a tree. does anyone has any idea?
 
Level 35
Joined
Feb 5, 2009
Messages
4,558
You could detect when a unit is issued an order targeting a Destructible.

If the unit is equal to the worker you want to harvest only from Crystals, then you can check if the Destructible isn't a Crystal. If it's not, you can order the unit to Stop and, depending on how detailed you want to get, you can play an Error sound byte and display a custom error message to the player.

The only real issue with this approach is that forcing a Stop command will interfere with queued orders, but outside of that this should work for you.
 
Status
Not open for further replies.
Top