• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Replace Gold Mine with Haunted Gold Mine.

Status
Not open for further replies.
Level 2
Joined
Aug 10, 2010
Messages
6
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: 70
  • upload_2017-5-5_23-35-33.png
    upload_2017-5-5_23-35-33.png
    23 KB · Views: 108
Last edited:
Level 16
Joined
Mar 25, 2016
Messages
1,327
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.
 
Level 2
Joined
Aug 10, 2010
Messages
6
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.
Top