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

Keeping track of orders

Status
Not open for further replies.
Hello everyone,
I'm making a map when units (peasants) and buildings are replaced when changing era. By doing so, units lost tracks of the previous orders. The most annoying problem is the lost of the order of tree chopping. Is there a way to save the order of an unit before being replaced ? Or a way to give order to unit to go chop the closest wood ?
 
This could work with some adjustments:

  • Order Harvest
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Destructible-type of (Target destructible of issued order)) Equal to Ashenvale Tree Wall
          • (Destructible-type of (Target destructible of issued order)) Equal to Barrens Tree Wall
          • (Destructible-type of (Target destructible of issued order)) Equal to Summer Tree Wall
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in HarvestGroup) Equal to False
        • Then - Actions
          • Unit Group - Add (Triggering unit) to HarvestGroup
        • Else - Actions

  • Cancel Harvest
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Destructible-type of (Target destructible of issued order)) Not equal to Ashenvale Tree Wall
          • (Destructible-type of (Target destructible of issued order)) Not equal to Barrens Tree Wall
          • (Destructible-type of (Target destructible of issued order)) Not equal to Summer Tree Wall
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in HarvestGroup) Equal to True
        • Then - Actions
          • Unit Group - Remove (Triggering unit) from HarvestGroup
        • Else - Actions

  • Replace Unit
    • Events
      • Player - Player 1 (Red) types a chat message containing replace as An exact match
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HarvestGroup and do (Actions)
        • Loop - Actions
          • Unit - Replace (Picked unit) with a Peasant using The old unit's relative life and mana
          • Unit - Order (Last replaced unit) to Harvest (Random destructible in (Region centered at (Position of (Last replaced unit)) with size (1000.00, 1000.00)) matching (((Destructible-type of (Matching destructible)) Equal to Summer Tree Wall) or ((Destructible-type of (Matching destructible)) Equal to Ashenv)

Just remember to check for the right tree types etc..

I didn't bother to make any of this leakless just due to readability.


The issued order isn't really that efficient as the peasant can pick any random tree within 1000 range after being replaced. Lower the size of the region for better results, or find a better and more accurate way to issue the order.
 

Attachments

  • Harvest.w3x
    18.3 KB · Views: 78
Status
Not open for further replies.
Top