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

Order workers to begin harvesting gold at map init?

Status
Not open for further replies.
Level 6
Joined
Oct 25, 2010
Messages
203
Is it possible to have newly created starting units begin harvesting gold automatically at the beginning of a game?
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
That should do the trick. Fortunately there exists this useful order under "unit - issue order with no target"
  • Harvest
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) is A peon-type unit) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Harvest Nearby Gold
Peon-type is used, so it only affects units classified as workers.
 
Level 6
Joined
Oct 25, 2010
Messages
203
mine says "Unit Group - Pick every unit in (Units in (Playable map area) matching (((Unit-type of (Matching unit)) is A peon-type unit) Equal to True)) and do (Actions)"

Is that right?
 
Last edited:

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
My solution checks, if the exact unit has the classification, whereas yours checks, if the unit type pf the unit has the classification. For example of all of your peasants always have the classification "worker", that makes no difference, but if you change classifications of specific units (remove worker classifications of a certain pesant) this will make a difference. I doubt you would do anything like that, so it does not matter. Especially since it's at map initialization, so I am pretty sure you won't change classifications of single units before that.
 
Status
Not open for further replies.
Top