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

[Trigger] Replacing haunted goldmine duplicated it...

Status
Not open for further replies.
Level 29
Joined
Mar 9, 2012
Messages
1,557
How to replace haunted goldmine via trigger at gamestart without duplicating it ? I have to do this for my Nerubians.
What currently happens is that the original goldmine becomes a normal one, and next to it appears the altered haunted goldmine i wanted to replace the default one with.

EDIT: Since it became evident to me nobody understand, the question here is:
How to replace a haunted goldmine with a custom one via trigger at gamestart ? How i need to expand upon the trigger to accomplish this ?

Relevant part of the trigger i use:

  • Blood Elves Selected
    • Ereignisse
      • Dialog - A dialog button is clicked for DialogBloodElves
    • Bedingungen
    • Aktionen
      • -------- A player clics a button, so, the player is ready, check what player clicked and set him ready --------
      • If ((Triggering player) Gleich Spieler 1 (Rot)) then do (Set ReadyPL1 = True) else do (Do nothing)
      • If ((Triggering player) Gleich Spieler 2 (Blau)) then do (Set ReadyPL2 = True) else do (Do nothing)
      • -------- Someone decides to use the Blood Elves, so the Blood Elf units are created for that player --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • (Clicked dialog button) Gleich ButtonBelf
        • 'THEN'-Aktionen
          • -------- Replaces the units normal workers with Blood Elf workers --------
          • Set TempGroup = (Units owned by (Triggering player) matching (((Matching unit) is Eine Einheit vom Typ Peon) Gleich True))
          • Einheitengruppe - Pick every unit in TempGroup and do (Einheit - Replace (Picked unit) with a Artisan using Neue Einheit: Standard - life and mana)
          • -------- Replaces the normal town-hall with Blood Elf town-hall --------
          • Set TempGroup = (Units owned by (Triggering player) matching (((Matching unit) is Eine Einheit vom Typ Rathaus) Gleich True))
          • Einheitengruppe - Pick every unit in TempGroup and do (Einheit - Replace (Picked unit) with a Arcanum Dome (Bloodelf) using Neue Einheit: Standard - life and mana)
          • -------- Check Trigger Comment --------
          • -------- 1.1 --------
          • If ((Race of (Triggering player)) Gleich Untoter) then do (Einheit - Create 2 Artisan for (Triggering player) at ((Triggering player) start location) facing Vorgabe für Gebäude-Ausrichtung degrees) else do (Do nothing)
          • -------- 1.2 --------
          • Set TempGroup = (Units owned by (Triggering player) matching ((Unit-type of (Matching unit)) Gleich Ghul))
          • Einheitengruppe - Pick every unit in TempGroup and do (Einheit - Remove (Picked unit) from the game)
          • Set TempGroup = (Units owned by (Triggering player) matching ((Unit-type of (Matching unit)) Gleich Verhexte Goldmine))
          • Einheitengruppe - Pick every unit in TempGroup and do (Einheit - Remove (Picked unit) from the game)
          • -------- 1.3 --------
          • Set AllUnits = (Units in (Playable map area))
          • Einheitengruppe - Pick every unit in AllUnits and do (Einheit - Pause ein (Picked unit))
        • 'ELSE'-Aktionen
      • -------- Someone decides to use the Nerubians, so the Nerubian units are created for that player --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • (Clicked dialog button) Gleich ButtonNerubian
        • 'THEN'-Aktionen
          • -------- Replaces the units normal workers with Nerubian workers --------
          • Set TempGroup = (Units owned by (Triggering player) matching (((Matching unit) is Eine Einheit vom Typ Peon) Gleich True))
          • Einheitengruppe - Pick every unit in TempGroup and do (Einheit - Replace (Picked unit) with a Devourer using Neue Einheit: Standard - life and mana)
          • -------- Replaces the normal town-hall with Nerubian town-hall --------
          • Set TempGroup = (Units owned by (Triggering player) matching (((Matching unit) is Eine Einheit vom Typ Rathaus) Gleich True))
          • Einheitengruppe - Pick every unit in TempGroup and do (Einheit - Replace (Picked unit) with a Necrophage (Nerubian) using Neue Einheit: Standard - life and mana)
          • -------- Check Trigger Comment --------
          • -------- 1.1 --------
          • If ((Race of (Triggering player)) Gleich Untoter) then do (Einheit - Create 2 Air Barge for (Triggering player) at ((Triggering player) start location) facing Vorgabe für Gebäude-Ausrichtung degrees) else do (Do nothing)
          • -------- 1.2 --------
          • Set TempGroup = (Units owned by (Triggering player) matching ((Unit-type of (Matching unit)) Gleich Ghul))
          • Einheitengruppe - Pick every unit in TempGroup and do (Einheit - Remove (Picked unit) from the game)
          • Set TempGroup = (Units owned by (Triggering player) matching ((Unit-type of (Matching unit)) Gleich Verhexte Goldmine))
          • Einheitengruppe - Pick every unit in TempGroup and do (Einheit - Replace (Picked unit) with a Haunted Goldmine (hopefully funtions) using Neue Einheit: Standard - life and mana)
          • -------- 1.3 --------
          • Set AllUnits = (Units in (Playable map area))
          • Einheitengruppe - Pick every unit in AllUnits and do (Einheit - Pause ein (Picked unit))
        • 'ELSE'-Aktionen
      • -------- Someone decides to use the Horde, so the Horde units are created for that player --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • (Clicked dialog button) Gleich ButtonHorde
        • 'THEN'-Aktionen
          • -------- Replaces the units normal workers with Horde workers --------
          • Set TempGroup = (Units owned by (Triggering player) matching (((Matching unit) is Eine Einheit vom Typ Peon) Gleich True))
          • Einheitengruppe - Pick every unit in TempGroup and do (Einheit - Replace (Picked unit) with a Peon (Custom) using Neue Einheit: Standard - life and mana)
          • -------- Replaces the normal town-hall with Blood Elf town-hall --------
          • Set TempGroup = (Units owned by (Triggering player) matching (((Matching unit) is Eine Einheit vom Typ Rathaus) Gleich True))
          • Einheitengruppe - Pick every unit in TempGroup and do (Einheit - Replace (Picked unit) with a Great Hall (Custom) using Neue Einheit: Standard - life and mana)
          • -------- Check Trigger Comment --------
          • -------- 1.1 --------
          • If ((Race of (Triggering player)) Gleich Untoter) then do (Einheit - Create 2 Peon (Custom) for (Triggering player) at ((Triggering player) start location) facing Vorgabe für Gebäude-Ausrichtung degrees) else do (Do nothing)
          • -------- 1.2 --------
          • Set TempGroup = (Units owned by (Triggering player) matching ((Unit-type of (Matching unit)) Gleich Ghul))
          • Einheitengruppe - Pick every unit in TempGroup and do (Einheit - Remove (Picked unit) from the game)
          • Set TempGroup = (Units owned by (Triggering player) matching ((Unit-type of (Matching unit)) Gleich Verhexte Goldmine))
          • Einheitengruppe - Pick every unit in TempGroup and do (Einheit - Remove (Picked unit) from the game)
          • -------- 1.3 --------
          • Set AllUnits = (Units in (Playable map area))
          • Einheitengruppe - Pick every unit in AllUnits and do (Einheit - Pause ein (Picked unit))
        • 'ELSE'-Aktionen
      • -------- Someone decides to use the Dwarves, so the Dwarf units are created for that player --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • (Clicked dialog button) Gleich ButtonDwarf
        • 'THEN'-Aktionen
          • -------- Replaces the units normal workers with Dwarf workers --------
          • Set TempGroup = (Units owned by (Triggering player) matching (((Matching unit) is Eine Einheit vom Typ Peon) Gleich True))
          • Einheitengruppe - Pick every unit in TempGroup and do (Einheit - Replace (Picked unit) with a Crafter using Neue Einheit: Standard - life and mana)
          • -------- Replaces the normal town-hall with Blood Elf town-hall --------
          • Set TempGroup = (Units owned by (Triggering player) matching (((Matching unit) is Eine Einheit vom Typ Rathaus) Gleich True))
          • Einheitengruppe - Pick every unit in TempGroup and do (Einheit - Replace (Picked unit) with a Great Hall (Dwarf) using Neue Einheit: Standard - life and mana)
          • -------- Check Trigger Comment --------
          • -------- 1.1 --------
          • If ((Race of (Triggering player)) Gleich Untoter) then do (Einheit - Create 2 Crafter for (Triggering player) at ((Triggering player) start location) facing Vorgabe für Gebäude-Ausrichtung degrees) else do (Do nothing)
          • -------- 1.2 --------
          • Set TempGroup = (Units owned by (Triggering player) matching ((Unit-type of (Matching unit)) Gleich Ghul))
          • Einheitengruppe - Pick every unit in TempGroup and do (Einheit - Remove (Picked unit) from the game)
          • Set TempGroup = (Units owned by (Triggering player) matching ((Unit-type of (Matching unit)) Gleich Verhexte Goldmine))
          • Einheitengruppe - Pick every unit in TempGroup and do (Einheit - Remove (Picked unit) from the game)
          • -------- 1.3 --------
          • Set AllUnits = (Units in (Playable map area))
          • Einheitengruppe - Pick every unit in AllUnits and do (Einheit - Pause ein (Picked unit))
        • 'ELSE'-Aktionen
      • -------- Run the trigger that decides to start or not the game --------
      • Auslöser - Run Start Game <gen> (checking conditions)
 
Last edited:
Level 23
Joined
Jan 1, 2009
Messages
1,610
You are doing same thing with ReplaceUnit just less.

No.
Replace first creates a new unit and then removes the old one. (this also causes the displacement when replacing buildings...)
Also it checks especially for blighted goldmines
JASS:
    // Create the replacement unit.
    if (newUnitId == 'ugol') then
        set newUnit = CreateBlightedGoldmine(GetOwningPlayer(oldUnit), GetUnitX(oldUnit), GetUnitY(oldUnit), GetUnitFacing(oldUnit))
    else
        set newUnit = CreateUnit(GetOwningPlayer(oldUnit), newUnitId, GetUnitX(oldUnit), GetUnitY(oldUnit), GetUnitFacing(oldUnit))
    endif

I don't know which part of the function causes the problem, but since you don't need 90% of it you might es well just use remove and create.
(maybe it stops before removing the oldUnit because haunted goldmines are special? idk)
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Hmm, I just wanted to trust Blizzard.

A hidden unit have pathing?Maybe some bug with buildings.
 
Status
Not open for further replies.
Top