How to make Acolytes automatically mine?

Status
Not open for further replies.
Level 7
Joined
Jul 1, 2008
Messages
1,023
Hi I need to know how to do quite a complicated trigger. Basically whenever a Haunted gold mine finishes construction I need it to auto spawn Acolytes and then these acolytes to automatically start mining at the haunted mine that was just created.

Step 1} When a Haunted gold mine finishes construction 5 Acolytes are spawned.

Step 2} These Acolytes automatically begin mining at constructed mine.

This is what I have so far but I am having trouble working out how to order all these acolytes to start mining.

  • AutoMine Undead
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (==) Haunted Gold Mine
    • Actions
      • Set MineLocation = (Position of (Constructed structure))
      • Unit - Create 6 Acolyte (Copy) for (Owner of (Triggering unit)) at MineLocation facing Default building facing (270.0) degrees
      • Custom script: call RemoveLocation(udg_MineLocation)
 
Are you sure that Triggering unit refers to the mine and not to the builder?

  • Unit - Order (Last created unit) to Right-Click (Triggering unit)
For this you need to have a loop creating the Acolytes with this action just below the create action, instead of just saying create 6 Acolytes.
 
  • Trigger
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Haunted Gold Mine
    • Actions
      • Set tempLoc = (Position of (Triggering unit))
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Acolyte for (Triggering player) at tempLoc facing 270.00 degrees
          • Unit - Order (Last created unit) to Right-Click (Triggering unit)
      • Custom script: call RemoveLocation(udg_tempLoc)
For maximum efficiency, you should also store the triggering player and triggering unit in variables to prevent them from being called each time the loop iterates.
 
o0 seems to work great ingame! Here's my trigger, added variables like you suggested, does it look ok to you? No leaks?

  • AutoMine Undead
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (==) Haunted Gold Mine (copy)
    • Actions
      • Set GoldMine = (Triggering unit)
      • Set MineLoc = (Position of (Constructed structure))
      • Set TrigPlayer = (Owner of GoldMine)
        • Do Multiple ActionsFor each (Integer A) from 1 to 5, do (Actions)
          • Loop - Actions
            • Unit - Create 1 Acolyte (Copy) for TrigPlayer at MineLoc facing Default building facing (270.0) degrees
            • Unit - Order (Last created unit) to Right-Click GoldMine
      • Custom script: call RemoveLocation(udg_CompactCryptTarget)
 
Status
Not open for further replies.
Back
Top