• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Replace Gold Mine with Haunted Gold Mine.

Status
Not open for further replies.

PRO3

P

PRO3

Whenever i try to replace a gold mine with a haunted gold mine it creates a new gold mine next to it instead. Any workaround? (I need the possibility to replace the Haunted Gold Mine back to the Gold Mine afterwards)


  • Unit Group - Pick every unit in (Units owned by Player) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is A structure) Equal to True
        • Then - Actions
          • Unit Group - Pick every unit in (Units within 512.00 of (Position of (Picked unit))) and do (Actions)
            • Loop - Actions
              • If ((Unit-type of (Picked unit)) Equal to Haunted Gold Mine) then do (Unit - Replace (Picked unit) with a Gold Mine using The old unit's relative life and mana) else do (If ((Unit-type of (Picked unit)) Equal to Entangled Gold Mine) then do (Unit - Replace (Picked unit) with a Gold Mine using The old unit's relative life and mana) else do (Do nothing))
        • Else - Actions
          • Do nothing
 

Attachments

  • upload_2017-5-5_23-35-11.png
    upload_2017-5-5_23-35-11.png
    23 KB · Views: 117
  • upload_2017-5-5_23-35-33.png
    upload_2017-5-5_23-35-33.png
    23 KB · Views: 157
Last edited by a moderator:
This will help you posting triggers: How To Post Your Trigger

If you look at the JASS code behind the replace function, you can see, that it works differently, if you replace a gold mine with a haunted gold mine. It should work as intended.
In your trigger you replace a haunted gold mine with a gold mine. You can just kill the haunted gold mine (remove should work as well) and the gold mine will remain there.
 
Thanks, problem solved :)

  • Set Player = (Triggering player)
  • Unit Group - Pick every unit in (Units owned by Player) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is A town-hall-type unit) Equal to True
        • Then - Actions
          • Unit Group - Pick every unit in (Units within 1024.00 of (Position of (Picked unit))) and do (Actions)
            • Loop - Actions
              • If ((Unit-type of (Picked unit)) Equal to Haunted Gold Mine) then do (Unit - Kill (Picked unit)) else do (If ((Unit-type of (Picked unit)) Equal to Entangled Gold Mine) then do (Unit - Replace (Picked unit) with a Gold Mine using The old unit's relative life and mana) else do (Do nothing))
        • Else - Actions
          • Do nothing
Code for going back to undead:
  • Unit Group - Pick every unit in (Units owned by Player) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is A town-hall-type unit) Equal to True
        • Then - Actions
          • Unit Group - Pick every unit in (Units within 1024.00 of (Position of (Picked unit))) and do (Actions)
            • Loop - Actions
              • If ((Unit-type of (Picked unit)) Equal to Gold Mine) then do (Unit - Replace (Picked unit) with a Haunted Gold Mine using The old unit's relative life and mana) else do (Do nothing)
        • Else - Actions
          • Do nothing
Code for going back to nightelf
  • Unit Group - Pick every unit in (Units owned by Player) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is A town-hall-type unit) Equal to True
        • Then - Actions
          • Unit Group - Pick every unit in (Units within 1024.00 of (Position of (Picked unit))) and do (Actions)
            • Loop - Actions
              • If ((Unit-type of (Picked unit)) Equal to Gold Mine) then do (Unit - Replace (Picked unit) with a Entangled Gold Mine using The old unit's relative life and mana) else do (Do nothing)
        • Else - Actions
          • Do nothing
Thread can be closed.
 
Status
Not open for further replies.
Back
Top