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

How to create a custom, automated gold mine?

Level 2
Joined
Oct 29, 2011
Messages
13
So, essentially I want to use this model by Ker to create an ability similar to Haunting/Entangling a gold mine, and the result would be a gold mine that creates gold by itself. I've been trying to figure it out myself for a while now, but I just can't seem to make it work.

Any help wpuld be appreciated.
 
Level 2
Joined
Oct 29, 2011
Messages
13
Cast ability -> Destroy target gold mine -> Create new custom unit at it's position -> Use Unit Indexing / Hashtable to periodically add Gold to the owner.

Thanks for the help. The mining unit has a birth animation, that builds the machine around the gold mine, so would this still work in that context?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,542
Thanks for the help. The mining unit has a birth animation, that builds the machine around the gold mine, so would this still work in that context?
Actually, on second thought, it makes more sense to use the Entangle Gold Mine ability. Here's an example map with it working using a Unit Indexer.

1) My map requires the latest patch to open.
2) When importing to your map, copy over the Object Editor data first, then the Trigger folders (in any order).
3) You should only ever have ONE unit indexer in your map at a time.
4) Do NOT change any variable names.
5) Make sure the Unit-Types / Ability-Types match in the triggers:
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Automated Gold Mine (Gold Mine)
When you port triggers into a different map, the id's (rawcodes) can change and you'll be left wondering why the triggers don't work anymore.
 

Attachments

  • Automatic Gold Mine.w3m
    50.8 KB · Views: 3
Last edited:
Level 11
Joined
May 29, 2008
Messages
132
I often solve this problem by creating a static group for the active mines. When a unit finishes upgrading into the mine, I add it to that group. When it dies, I remove it from that group. Then I have something that 'every 1 second' goes through each active mine in the group and provides the owning player with gold and displays a little gold bounty text tag over the mine. Seems to work pretty well.

The really lazy way would be to do a 'every 1 second, pick all units of type Auto gold mine' and do the above, but this will be less efficient performance wise.
 
Top