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

How to Show Enemy's Current Gold?

Status
Not open for further replies.
Level 5
Joined
May 8, 2020
Messages
87
1711030806270.png


I have a formula like this but don't know how to do it when I enter a command or something

for example: -show

It will display the gold of all enemies in play
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
Enemies in this case are Players and when you want to work with multiple Players at once you use a Player Group. Just like when you want to work with multiple Units you would use a Unit Group. I recommend trying to get into the habit of relying on these "Group" actions because you're going to be using them a lot. Unit/Player = a single thing, Unit Group/Player Group = multiple things.

With that in mind, here's one way to do it:
  • Enemy Gold Command
    • Events
      • Player - Player 1 (Red) types a chat message containing -enemy gold as An exact match
      • Player - Player 2 (Blue) types a chat message containing -enemy gold as An exact match
    • Conditions
    • Actions
      • Set Player_Group_Self = (Player group((Triggering player)))
      • Set Player_Group_Enemies = (All enemies of (Triggering player))
      • Player Group - Pick every player in Player_Group_Enemies and do (Actions)
        • Loop - Actions
          • Set Current_Gold = ((Picked player) Current gold)
          • Game - Display to Player_Group_Self for 10.00 seconds the text: ((Name of (Picked player)) + ( current gold: + (String(Current_Gold))))
      • Custom script: call DestroyForce( udg_Player_Group_Self )
      • Custom script: call DestroyForce( udg_Player_Group_Enemies )
^ This will only show the text to the Player that typed the chat command. The Custom Scripts help clean up the memory leaks but you don't NEED them for the trigger to work.

conc.png
 
Last edited:
Status
Not open for further replies.
Top