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

Player Selects a Unit

Status
Not open for further replies.
Level 19
Joined
Oct 7, 2014
Messages
2,209
I'm working on a trigger when a player selects a specific unit in the map, a text message will be displayed for the player. The units that I refer are Capitals, Large Cities and Cities in the map so it will be around 130 units.

I just want to see how should I do this because I couldn't figure it out. :vw_wtf:
 
Level 10
Joined
Apr 4, 2010
Messages
509
  • Selection
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
      • ((Triggering unit) is A City) Equal to True
    • Actions
      • Game - Display to Player Group - Player 1 (Red) for 30.00 seconds the text: (Name of (Triggering unit))
      • Game - Display to Player Group - Player 1 (Red) for 30.00 seconds the text: Income
Add the Ancient, Giant or Tauren classification to the cities. If a city gets selected, then display the name of the selected unit and display income. I don't know how you are triggering your income so I wouldn't know how to display it as text. You'll need to make one of these for each player.
 
Level 19
Joined
Oct 7, 2014
Messages
2,209
Would the player group create a leak? Is this efficient enough since there would be 140 cities in my map??

  • Floaters
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
      • Player - Player 9 (Gray) Selects a unit
      • Player - Player 10 (Light Blue) Selects a unit
      • Player - Player 11 (Dark Green) Selects a unit
      • Player - Player 12 (Brown) Selects a unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to Capital (North) 0005 <gen>
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) for 30.00 seconds the text: London Income: G...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to Large City (North) 0006 <gen>
        • Then - Actions
          • Game - Display to (Player group((Triggering player))) for 30.00 seconds the text: Wales Income: Go...
        • Else - Actions
 

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,239
It does not leak, at least I have not seen anyone comment on it. However I think you should be able to make it more efficient than that.

Put the second if in the else section of the first one. The third in the second ones else and so on.

Even so, 130 conditions is simply too much. There has to be another way.

Maybe give every faction an ID and store that with custom value of unit (or hashtables). That way you can easily see which faction to write out.
 
Level 19
Joined
Oct 7, 2014
Messages
2,209
It does not leak, at least I have not seen anyone comment on it. However I think you should be able to make it more efficient than that.

Put the second if in the else section of the first one. The third in the second ones else and so on.

Even so, 130 conditions is simply too much. There has to be another way.

Maybe give every faction an ID and store that with custom value of unit (or hashtables). That way you can easily see which faction to write out.

All cities are neutral to each player except for the capitals of the nation a player chose.
 
Status
Not open for further replies.
Top