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

Upgrading Haunted Gold Mines

Status
Not open for further replies.
Level 3
Joined
Dec 19, 2014
Messages
34
Quick question: I want to use a Berserker upgrade type to change a haunted gold mine into different version of a haunted gold mine. When I research the upgrade,everything works fine, except that the resulting haunted mine has lost all of its gold (it's not at 0, the gold field just isn't there at all). I suspect this is because haunted gold mines take on a gold amount equal to the mine they were built on, and the new mine technically wasn't built on anything. Any way around this?

Also, I should note, new haunted gold mines I build do not have this problem, only the ones that replaced existing haunted gold mines.

EDIT: oh, and one more thing. Swapping the haunted gold mines through the upgrade has the perk of not interrupting the acolyte gold gathering. Ideally, the solution would allow me to keep that feature (maybe by adding the gold back to the new mine).
 
Last edited:
Level 3
Joined
Dec 19, 2014
Messages
34
Well adding gold isn't the issue. The problem is making sure that the gold stays the same. So if I triggered it to add gold, I would first need some way of tracking how much gold was in the old mine being replaced.

Also, so far I've also tried the "replace unit" action and I've tried giving the goldmine a morph spell that's triggered by the upgrade. No luck. The replace unit kept the gold but created the haunted mine in a different spot, and the morph put the haunted goldmine kept it in the same spot but lost the gold.

If someone knows how to increase haunted gold mine gather rates without using a new unit, that would also solve my problem. (And adding spell levels doesn't work, I already tried.)
 
Level 11
Joined
Jun 2, 2013
Messages
613
Try playing with Player - Enable/Disable Ability.

Instead of using spell levels you can create multiple gather abilities (with different gather amounts) and give your worker all of those abilities. At the beginning of the map disable all but the first ability for the player. When you finish researching your upgrade disable the initial ability and enable the second, granting you higher capacity. Since you will only have one gather enabled at a time, it should default to that particular gather's capacity.
 
Level 3
Joined
Dec 19, 2014
Messages
34
Try playing with Player - Enable/Disable Ability.

Instead of using spell levels you can create multiple gather abilities (with different gather amounts) and give your worker all of those abilities. At the beginning of the map disable all but the first ability for the player. When you finish researching your upgrade disable the initial ability and enable the second, granting you higher capacity. Since you will only have one gather enabled at a time, it should default to that particular gather's capacity.

That seemed like the perfect solution but, alas, it didn't work. For some reason the Blighted Gold Mine Gather ability ignores the availability assignments I give it whether through triggers or through the Ability Properties windows.

I also tried using a trigger to remove the ability while leaving the upgraded version, but that removes all of the mine's gold for some reason.

I did discover, however, that, if I give the haunted gold mine two different gather abilities, it will automatically use whichever I list first in its "Abilities - Normal" field in the object editor. So perhaps a solution would be just to set a trigger to alter the order of that field? Is that even possible?

EDIT: I also tried making the ability dependent on an upgrade. No dice, it ignores tech tree dependencies too.
 
Level 3
Joined
Dec 19, 2014
Messages
34
OK, so here's what I think I need to do?

When a particular upgrade is finished, I need all of the owning player's haunted gold mines to be removed. Then, I need a dummy unit to construct the new upgraded haunted goldmines to replace the ones just lost; these new mines need to be summoned instantly. When they are complete, the acolytes would, ideally, be reassigned to the new hauntedgold mine so that the transition happens seemlessly. Is this possible to trigger?

Things I've learned about Haunted Gold Mines through this ordeal:
1. If the Blighted Gold Mine ability is removed from Haunted Gold mines (and it has no replacement ability based on BGM), the game will immediately crash whenever a unit begins summoning the Haunted Gold mine.
2. Haunted Gold Mines are hard-coded to drop gold mines on death. So replacing a Haunted Gold Mine with a gold mine via trigger results in two gold mines.
3. There are only two ways to get the amount of gold to transfer from gold mine to haunted goldmine and vise versa. (a.) A unit summons the Haunted Gold Mine or the Haunted Gold Mine is destroyed (b.) You replace a gold mine with a Haunted Gold Mine via trigger and use "relative stats."
4. Using a morph ability to turn a gold mine into a Haunted Gold Mine will work, but the resulting Haunted Gold Mine will have no gold.
5. Levels have no effect on the Blighted Gold Mine ability.
6. Blighted Gold Mine ability ignores techtree dependency and cannot be disabled by trigger.
7. Blighted Gold Mine ability can be removed altogether by trigger, but that will remove all of its gold as well.
 
Level 11
Joined
Jun 2, 2013
Messages
613
I have a few ideas, but first I want to ask, what exactly are you trying to accomplish? What is the need for replacing the Haunted Gold mine in the first place? Why are you wanting to use berserker upgrade to change to it? Just trying to figure out the best approach for the ideas I have.
 
Level 11
Joined
Jun 2, 2013
Messages
613
Well adding gold isn't the issue. The problem is making sure that the gold stays the same. So if I triggered it to add gold, I would first need some way of tracking how much gold was in the old mine being replaced.

Also, so far I've also tried the "replace unit" action and I've tried giving the goldmine a morph spell that's triggered by the upgrade. No luck. The replace unit kept the gold but created the haunted mine in a different spot, and the morph put the haunted goldmine kept it in the same spot but lost the gold.

I do know of a way to get the current gold of a specific unit, if it will help.

You can set (integer) variable, to Neutral Building - Gold Remaining.
Then you can add the gold back via action Neutral - Add Gold/Set Gold = your temporary integer variable.

ex.
  • Set IntegerVariable = (Resource quantity contained in YourUnit)
 
Level 3
Joined
Dec 19, 2014
Messages
34
I do know of a way to get the current gold of a specific unit, if it will help.

You can set (integer) variable, to Neutral Building - Gold Remaining.
Then you can add the gold back via action Neutral - Add Gold/Set Gold = your temporary integer variable.

ex.
  • Set IntegerVariable = (Resource quantity contained in YourUnit)

Ah, that is helpful. I'm not sure what the next step would be though. I could trigger it so that if any unit uses the Gold Mine Upgrade Ability (based on Berserker Upgrade) then the game stores its amount of Gold, but I don't know how I how to add back that gold to the specific Haunted Mine that would replace each gold mine. I would need a way of syncing the stored gold quantity from each gold mine with only the Haunted Gold Mine it morphed into. Is there someway to reference "morphed unit" in the triggers?
 
Level 3
Joined
Dec 19, 2014
Messages
34
Figured it out! I gave the gold mines a dummy ability and had them use it whenever the researched was acquired by the player. The following trigger activates the Increased Gold Rate, keeps the original amount of gold in the mine, and keeps the acolytes gathering.

Thanks PublishedShadow for the tips! +rep

  • Gold Mine Upgrade
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Ability being cast) Equal to Gold Mine Swap ) and ((Unit-type of (Triggering unit)) Equal to Haunted Gold Mine)
    • Actions
      • Set IntegerVariable = (Resource quantity contained in (Triggering unit))
      • Unit - Remove Blighted Gold Mine Ability from (Triggering unit)
      • Unit - Add Increased Haunted Gold Mine to (Triggering unit)
      • Unit - Remove Gold Mine Swap from (Triggering unit)
      • Unit - Order (Triggering unit) to Stop
      • Set TempPoint = (Position of (Triggering unit))
      • Unit Group - Pick every unit in (Units within 400.00 of TempPoint matching ((Unit-type of (Matching unit)) Equal to Acolyte)) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Stop
          • Unit - Order (Picked unit) to Right-Click (Triggering unit)
          • Custom script: call RemoveLocation (udg_TempPoint)
      • Neutral Building - Add IntegerVariable gold to (Triggering unit)
 
Status
Not open for further replies.
Top