HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

On Haunting/Entangling Gold Mines

06-10-2010, 05:08 PM#1
Xindaris
Okay, so I have a set of triggers in a map I'm making that either recreate or add to the gold of a set of mines--it has separate boolean variables to "check" whether a given gold mine is alive or not, and a trigger that switches them whenever a gold mine dies.

What I want to know is, if I set each mine I'm dealing with as a variable (e.g., "Mine1", "Mine2", etc.), and the player haunts or entangles them, does it "become" a different unit or are there glitches that tend to result from that?

I've noticed that occasionally the gold mines will be in noticeably different places when being re-created, even though the trigger is set to place them in the center of fairly small regions. Are the regions moving or is the trigger getting messed up, or is this a matter of this 'leaking' I've heard of? (Though I've only ever heard of that causing lags and server splits...)
06-24-2010, 10:40 AM#2
TheKid
When a Gold Mine is entangled (Night Elf) or haunted (Undead) it does not make a new unit, instead it transforms the existing one; think of it as an upgrade. I have never noticed a Gold Mine being in a noticeably different place than it was before it was entangled/haunted.
06-24-2010, 10:17 PM#3
Xindaris
I didn't mean the mines "jump" when being haunted/entangled, I meant when the mine has been destroyed, and a trigger later recreates it.
06-25-2010, 12:55 AM#4
Bribe
That's due to the displacement factor in the game's engine. If there is something blocking the path, it cannot be there. Pick all destructables/units/items in the area first, clear them out of the way of the mine, then re-generate the mine.
06-25-2010, 04:26 PM#5
Xindaris
I should probably put up the triggers that handle this stuff, to avoid confusion (hidden to not page-stretch):
Piece of initialization which handles gold mines:
Hidden information:
Trigger:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Race of Player 1 (Red)) Equal to Human
Collapse Then - Actions
Unit - Create 1 Town Hall for Player 1 (Red) at (Center of (Region centered at (Player 1 (Red) start location) with size (1.00, 1.00))) facing Default building facing degrees
Unit - Create 5 Peasant for Player 1 (Red) at (Random point in (Region centered at (Position of (Last created unit)) with size (10.00, 10.00))) facing Pi degrees
Set UnitsMade = 5
Set Mine1 = Gold Mine 0006 <gen>
Set Mine2 = Gold Mine 0007 <gen>
Set Mine3 = Gold Mine 0008 <gen>
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Race of Player 1 (Red)) Equal to Orc
Collapse Then - Actions
Unit - Create 1 Great Hall for Player 1 (Red) at (Center of (Region centered at (Player 1 (Red) start location) with size (1.00, 1.00))) facing Default building facing degrees
Unit - Create 5 Peon for Player 1 (Red) at (Random point in (Region centered at (Position of (Last created unit)) with size (10.00, 10.00))) facing Pi degrees
Set UnitsMade = 5
Set Mine1 = Gold Mine 0006 <gen>
Set Mine2 = Gold Mine 0007 <gen>
Set Mine3 = Gold Mine 0008 <gen>
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Race of Player 1 (Red)) Equal to Undead
Collapse Then - Actions
Unit - Create 1 Necropolis for Player 1 (Red) at (Center of (Region centered at (Player 1 (Red) start location) with size (1.00, 1.00))) facing Default building facing degrees
Unit - Create 5 Acolyte for Player 1 (Red) at (Random point in (Region centered at (Position of (Last created unit)) with size (10.00, 10.00))) facing Pi degrees
Unit - Create 2 Ghoul for Player 1 (Red) at (Random point in (Region centered at (Position of (Last created unit)) with size (10.00, 10.00))) facing Pi degrees
Set UnitsMade = 7
Neutral Building - Haunt Gold Mine 0006 <gen> for Player 1 (Red)
Set Mine1 = (Last Haunted Gold Mine)
Neutral Building - Haunt Gold Mine 0007 <gen> for Player 1 (Red)
Set Mine2 = (Last Haunted Gold Mine)
Neutral Building - Haunt Gold Mine 0008 <gen> for Player 1 (Red)
Set Mine3 = (Last Haunted Gold Mine)
Environment - Create Blight for Player 1 (Red) across (Playable map area)
Environment - Remove Blight for Player 1 (Red) across Items <gen>
Environment - Remove Blight for Player 1 (Red) across Camps <gen>
Environment - Remove Blight for Player 1 (Red) across Heroes <gen>
Environment - Remove Blight for Player 1 (Red) across Spawn Point <gen>
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Race of Player 1 (Red)) Equal to Night Elf
Collapse Then - Actions
Unit - Create 1 Tree of Life for Player 1 (Red) at (Center of (Region centered at (Player 1 (Red) start location) with size (1.00, 1.00))) facing Default building facing degrees
Set Mine2 = Gold Mine 0007 <gen>
Unit - Order (Last created unit) to Night Elf Tree Of Life - Entangle (Instant) Mine2
Unit - Replace Gold Mine 0006 <gen> with a Entangled Gold Mine using The new unit's max life and mana
Unit - Change ownership of (Last replaced unit) to Player 1 (Red) and Change color
Set Mine1 = (Last replaced unit)
Unit - Replace Gold Mine 0008 <gen> with a Entangled Gold Mine using The new unit's max life and mana
Unit - Change ownership of (Last replaced unit) to Player 1 (Red) and Change color
Set Mine3 = (Last replaced unit)
Unit - Create 7 Wisp for Player 1 (Red) at (Random point in (Region centered at (Position of (Last created unit)) with size (10.00, 10.00))) facing Pi degrees
Set UnitsMade = 7
Else - Actions

Gold mine death trigger:
Hidden information:
Trigger:
Gold Death
Collapse Events
Unit - A unit Dies
Collapse Conditions
((Unit-type of (Dying unit)) Equal to Gold Mine) or (((Unit-type of (Dying unit)) Equal to Haunted Gold Mine) or ((Unit-type of (Dying unit)) Equal to Entangled Gold Mine))
Collapse Actions
If ((Dying unit) Equal to Mine1) then do (Set Mine1Alive = False) else do (Do nothing)
If ((Dying unit) Equal to Mine2) then do (Set Mine2Alive = False) else do (Do nothing)
If ((Dying unit) Equal to Mine3) then do (Set Mine3Alive = False) else do (Do nothing)
If ((Dying unit) Equal to OutMine1) then do (Set OutMine1Alive = False) else do (Do nothing)
If ((Dying unit) Equal to OutMine2) then do (Set OutMine2Alive = False) else do (Do nothing)
If ((Dying unit) Equal to OutMine3) then do (Set OutMine3Alive = False) else do (Do nothing)
If ((Dying unit) Equal to OutMine4) then do (Set OutMine4Alive = False) else do (Do nothing)

Gold mine recreating/gold-adding trigger:
Hidden information:
Trigger:
Gold Replenisher
Events
Collapse Conditions
ReplenishGold Equal to True
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Resource quantity contained in Mine1) Equal to 0
Collapse Then - Actions
Unit - Kill Mine1
Set Mine1Alive = False
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Resource quantity contained in Mine2) Equal to 0
Collapse Then - Actions
Unit - Kill Mine2
Set Mine2Alive = False
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Resource quantity contained in Mine3) Equal to 0
Collapse Then - Actions
Unit - Kill Mine3
Set Mine3Alive = False
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Mine1Alive Equal to False
Collapse Then - Actions
Unit Group - Pick every unit in (Units in Mine 1 <gen> owned by Player 1 (Red)) and do (If (((Picked unit) is A structure) Equal to True) then do (Unit - Kill (Picked unit)) else do (Unit - Move (Picked unit) instantly to (Random point in Home Base <gen>)))
If (((Race of Player 1 (Red)) Equal to Human) or ((Race of Player 1 (Red)) Equal to Orc)) then do (Unit - Create 1 Gold Mine for Neutral Passive at (Center of Mine 1 <gen>) facing Default building facing degrees) else do (Do nothing)
If ((Race of Player 1 (Red)) Equal to Undead) then do (Unit - Create 1 Haunted Gold Mine for Player 1 (Red) at (Center of Mine 1 <gen>) facing Default building facing degrees) else do (Do nothing)
If ((Race of Player 1 (Red)) Equal to Night Elf) then do (Unit - Create 1 Entangled Gold Mine for Player 1 (Red) at (Center of Mine 1 <gen>) facing Default building facing degrees) else do (Do nothing)
Set Mine1 = (Last created unit)
Set Mine1Alive = True
Neutral Building - Set Mine1 to 1000 gold
Collapse Else - Actions
Neutral Building - Add 1000 gold to Mine1
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Mine2Alive Equal to False
Collapse Then - Actions
Unit Group - Pick every unit in (Units in Mine 2 <gen> owned by Player 1 (Red)) and do (If (((Picked unit) is A structure) Equal to True) then do (Unit - Kill (Picked unit)) else do (Unit - Move (Picked unit) instantly to (Random point in Home Base <gen>)))
If (((Race of Player 1 (Red)) Equal to Human) or ((Race of Player 1 (Red)) Equal to Orc)) then do (Unit - Create 1 Gold Mine for Neutral Passive at (Center of Mine 2 <gen>) facing Default building facing degrees) else do (Do nothing)
If ((Race of Player 1 (Red)) Equal to Undead) then do (Unit - Create 1 Haunted Gold Mine for Player 1 (Red) at (Center of Mine 2 <gen>) facing Default building facing degrees) else do (Do nothing)
If ((Race of Player 1 (Red)) Equal to Night Elf) then do (Unit - Create 1 Entangled Gold Mine for Player 1 (Red) at (Center of Mine 2 <gen>) facing Default building facing degrees) else do (Do nothing)
Set Mine2 = (Last created unit)
Set Mine2Alive = True
Neutral Building - Set Mine2 to 1000 gold
Collapse Else - Actions
Neutral Building - Add 1000 gold to Mine2
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Mine3Alive Equal to False
Collapse Then - Actions
Unit Group - Pick every unit in (Units in Mine 3 <gen> owned by Player 1 (Red)) and do (If (((Picked unit) is A structure) Equal to True) then do (Unit - Kill (Picked unit)) else do (Unit - Move (Picked unit) instantly to (Random point in Home Base <gen>)))
If (((Race of Player 1 (Red)) Equal to Human) or ((Race of Player 1 (Red)) Equal to Orc)) then do (Unit - Create 1 Gold Mine for Neutral Passive at (Center of Mine 3 <gen>) facing Default building facing degrees) else do (Do nothing)
If ((Race of Player 1 (Red)) Equal to Undead) then do (Unit - Create 1 Haunted Gold Mine for Player 1 (Red) at (Center of Mine 3 <gen>) facing Default building facing degrees) else do (Do nothing)
If ((Race of Player 1 (Red)) Equal to Night Elf) then do (Unit - Create 1 Entangled Gold Mine for Player 1 (Red) at (Center of Mine 3 <gen>) facing Default building facing degrees) else do (Do nothing)
Set Mine3 = (Last created unit)
Set Mine3Alive = True
Neutral Building - Set Mine3 to 1000 gold
Collapse Else - Actions
Neutral Building - Add 1000 gold to Mine3
Set ReplenishGold = False
Trigger - Turn off (This trigger)