• 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.

[Trigger] How to reference a haunted gold mine?

Status
Not open for further replies.
Level 4
Joined
Nov 23, 2007
Messages
113
Sorry, I've searched for hours and can't seem to find an answer to this.

In my trigger, I detect when a specific gold mine is empty (dies). So I use this:

Player4 TimerStart
Events
Unit - Gold Mine 0006 <gen> Dies
Conditions
Actions
Trigger - Turn off (This trigger)
Game - Display to (All players) for 12.00 seconds the text: ((Player 4 Gold Mine < + (String(AI_MinGoldAmount))) + - will now receive gifts of Gold & Lumber!)
Countdown Timer - Start AI_Plr4_ResourceTimer as a Repeating timer that will expire in AI_Plr4_TimeInterval seconds



It works fine, except if player 4 is undead :( I've tried everything I can think of but cannot reference the gold mine once it has been haunted at the start of the game. Using "Gold Mine 0006 <gen>" is simply ignored.

How do I detect if a haunted gold mine is empty (died) in the event?

Any advice greatly appreciated.
 
Level 4
Joined
Nov 23, 2007
Messages
113
Thanks for your response.

From what I understand you are saying, I should do the following:

Event
Unit - A unit dies

Conditions
(Unit-type of (Triggering unit)) Equal to Haunted Gold Mine


However, that doesn't tell me which gold mine it is, nor which player it belongs to.

Is there a way to determine which player that dieing haunted gold mine belongs to? Because determining this is the primary point of the trigger.

Regards
 
Level 4
Joined
Nov 23, 2007
Messages
113
Thanks for your reply. Yes, that works in identifying the undead owner of the gold mine.

However, I'm still experiencing some odd issues.

1. In the above example (my prior post) the Generic Unit - Dies does not trigger when a gold mine has collapsed (whereas using the specific Unit - Dies does). Therefore, I would have to write a number of triggers just to determine which gold mine has collapsed.

2. Is there a way to determine and reference the gold mine that is haunted?

3. When the haunted gold mine gets destroy by an army, it triggers the Unit - Dies (when the actual gold mine still exists) and I need to determine when that gold mine actually collapses after running out of gold.


Perhaps an overview of what I'm trying to do would help clarify.

Two computer players start at individual gold mines and have access to expansions. When the gold mine at their main base is depleted, I want to start a timer that keeps adding Gold and Lumber to their resources (a sort of "better beat them now because they will have huge resources type scenario").

So the problems I'm having are related to referencing the specific gold mines after they have been depleted, and awarding the computer player this bounty after the gold mine at his main base is gone (meaning I have to know when writing my trigger which computer player "owns" what mine).

Regards

Example: This only works with a haunted gold mine. When any other gold mine "Dies", the trigger is not executed (it would seem, at least). Additionally, I don't know if other races "own" the gold mine unit (as the undead do) to make the sort of references I have below valid.

--------------------------------------
  • Start Player Resource Timer
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Unit-type of (Triggering unit)) Equal to Gold Mine) or ((Unit-type of (Triggering unit)) Equal to Haunted Gold Mine)
      • ((Player 3 Gold mine <gen> contains (Triggering unit)) Equal to True) or ((Player 4 Gold Mine <gen> contains (Triggering unit)) Equal to True)
      • ((Owner of (Triggering unit)) controller) Equal to Computer
    • Actions
      • Game - Display to (All players) the text: (AI_PlayerColorText[(Player number of (Owner of (Triggering unit)))] + depleted his main Gold Mine - Will now receive gifts of Gold & Lumber!)
      • Countdown Timer - Start AI_PlayerTimers[(Player number of (Owner of (Triggering unit)))] as a Repeating timer that will expire in AI_PlayerTimeInterval seconds
 
Last edited by a moderator:
Level 4
Joined
Nov 23, 2007
Messages
113
seurimas,
I can't seem to find any reference to "Dying Unit" nor do I see an event that refers to when a player haunts a gold mine. :/

Could you perhaps be specific and refer to actual trigger code so I can follow your references in the trigger editor? Sorry, I'm just not connecting what you're saying with what I see available as options in the editor.

GhostWolf,
Thanks, but as Just_Spectating pointed out, the gold mine becomes something different altogether once it has been haunted and when checking the amount of gold, it returns 0 the moment it is haunted (ie. there appears no way to determine the amount of gold in that mine once it has been haunted).


I used the following code and for undead, the amount of gold was 0 right at the start of the game - for night elf, it would not detect when the mine had zero resources at all.

  • Check Gold in Mines
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set GoldInMine5 = (Real((Resource quantity contained in Gold Mine 0005 <gen>)))
      • Set GoldInMine6 = (Real((Resource quantity contained in Gold Mine 0006 <gen>)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (GoldInMine5 Less than or equal to 0.00) and (GoldInMine6 Less than or equal to 0.00)
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Do nothing
Start Timer
  • Start Player3 Resource Timer
    • Events
      • Game - GoldInMine5 becomes Less than or equal to 0.00
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Game - Display to (All players) the text: (AI_PlayerColorText[3] + depleted his main Gold Mine - Will now receive gifts of Gold & Lumber!)
      • Countdown Timer - Start AI_PlayerTimers[3] as a Repeating timer that will expire in AI_PlayerTimeInterval seconds
Same for the other gold mine

PS - Thanks to Dr Super Good for cleaning up my prior post and showing me the trigger tags :)
 
Level 4
Joined
Nov 23, 2007
Messages
113
Well, it seems just Just_Spectating was correct in the first place with the Generic Unit - Dies event. I must have screwed up the trigger somehow the first time I tried it.

Thanks for all your help.

For the curious, here is how it was finally implemented:

Determining what player "owns" the gold mine:
  • Determine player at gold mine5
    • Events
      • Unit - A unit enters GoldMine5Region <gen>
    • Conditions
      • (((Triggering unit) is A peon-type unit) Equal to True) and (((Owner of (Triggering unit)) controller) Equal to Computer)
    • Actions
      • Trigger - Turn off (This trigger)
      • Set PlayerAtGoldMine5 = (Owner of (Triggering unit))

setting the timer and text display for the player who's gold mine just "died":
  • A Gold Mine Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Gold Mine
      • ((GoldMine5Region <gen> contains (Triggering unit)) Equal to True) or ((GoldMine6Region <gen> contains (Triggering unit)) Equal to True)
    • Actions
      • If ((GoldMine5Region <gen> contains (Triggering unit)) Equal to True) then do (Set IndexOfPlayerWhosGoldMineDied = (Player number of PlayerAtGoldMine5)) else do (Set IndexOfPlayerWhosGoldMineDied = (Player number of PlayerAtGoldMine6))
      • Set AI_GoldMineDead[IndexOfPlayerWhosGoldMineDied] = True
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (AI_GoldMineDead[3] Equal to True) and (AI_GoldMineDead[4] Equal to True)
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Do nothing
      • Countdown Timer - Start AI_PlayerTimers[IndexOfPlayerWhosGoldMineDied] as a Repeating timer that will expire in AI_PlayerTimeInterval seconds
      • Game - Display to (All players) the text: (AI_PlayerColorText[IndexOfPlayerWhosGoldMineDied] + depleted his main Gold Mine - Will now receive gifts of Gold & Lumber!)
 
Status
Not open for further replies.
Top